-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
66 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,74 @@ | ||
name: Rust | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ current, next ] | ||
pull_request: | ||
branches: [ current, next ] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
push: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-24.04 # Version 24 required for last version of CSFML | ||
|
||
test: | ||
strategy: | ||
matrix: | ||
os: [windows-latest, ubuntu-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup rust-cache | ||
uses: Swatinem/rust-cache@v1 | ||
|
||
- name: Update package manager | ||
run: sudo apt-get update | ||
|
||
- name: Install dependencies | ||
run: sudo apt-get install -y libsfml-dev libcsfml-dev libasound2-dev libudev-dev | ||
|
||
- name: Build library | ||
run: cargo build --lib --verbose | ||
|
||
- name: Run tests | ||
run: cargo test --verbose | ||
|
||
rustfmt: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get nightly Rust toolchain with rustfmt | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
override: true | ||
components: rustfmt | ||
|
||
- name: Run cargo fmt --all -- --check | ||
run: cargo fmt --all -- --check | ||
|
||
clippy: | ||
runs-on: ubuntu-24.04 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.toml') }} | ||
- uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: stable | ||
- name: Install alsa and udev | ||
run: sudo apt-get update; sudo apt-get install --no-install-recommends libudev-dev | ||
if: runner.os == 'linux' | ||
- name: Build & run tests | ||
run: cargo test | ||
all-doc-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Update package manager | ||
run: sudo apt-get update | ||
|
||
- name: Install dependencies | ||
run: sudo apt-get install -y libsfml-dev libcsfml-dev libasound2-dev libudev-dev | ||
|
||
- name: Get stable Rust toolchain with clippy | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
components: clippy | ||
|
||
- name: Run cargo clippy --all-targets --package mapgen | ||
run: cargo clippy --all-targets --package mapgen | ||
|
||
docs: | ||
runs-on: ubuntu-24.04 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ubuntu-latest-cargo-all-doc-tests-${{ hashFiles('**/Cargo.toml') }} | ||
- uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: stable | ||
- name: Install udev | ||
run: sudo apt-get update; sudo apt-get install --no-install-recommends libudev-dev | ||
- name: Run doc tests with all features (this also compiles README examples) | ||
run: cargo test --doc --all-features | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Update package manager | ||
run: sudo apt-get update | ||
|
||
- name: Install dependencies | ||
run: sudo apt-get install -y libsfml-dev libcsfml-dev libasound2-dev libudev-dev | ||
|
||
- name: Get stable Rust toolchain with doc | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
components: rust-docs | ||
|
||
- name: Run cargo doc -p mapgen --no-deps | ||
run: cargo doc -p mapgen --no-deps | ||
- uses: actions/checkout@v4 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ubuntu-latest-cargo-lint-${{ hashFiles('**/Cargo.toml') }} | ||
- uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: stable | ||
components: rustfmt, clippy | ||
- name: Install alsa and udev | ||
run: sudo apt-get update; sudo apt-get install --no-install-recommends libudev-dev | ||
- name: Run clippy | ||
run: cargo clippy --workspace --all-targets --all-features -- -Dwarnings | ||
- name: Check format | ||
run: cargo fmt --all -- --check |