Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI

on:
push:
branches: [main]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test --all-targets

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-targets -- -D warnings

rustfmt:
name: Rust Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all --check

rue:
name: Rue Format & Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install Rue
run: |
RUE_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Rue.toml)
cargo install rue-cli --version "$RUE_VERSION" --locked
- name: Check formatting
run: rue fmt --check
- name: Check compiled puzzles are up to date
run: |
rue build -a -s -x -h
git status --porcelain puzzles
test -z "$(git status --porcelain puzzles)"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ The compiled puzzles are checked into the repository next to their sources (as `
rue build -a -s -x -h
```

CI should run the same command followed by `git diff --exit-code puzzles` to ensure that the compiled puzzles are up to date. Then run the tests with:
CI runs the same command and fails if anything in `puzzles` changes, to ensure that the compiled puzzles are up to date. Then run the tests with:

```bash
cargo test
Expand Down
Loading