mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-04 17:23:33 +01:00
ci: add Rust CI
Check rustfmt/clippy/tests.
This commit is contained in:
parent
14e57d2085
commit
d39e35508f
1 changed files with 81 additions and 0 deletions
81
.github/workflows/ci.yml
vendored
Normal file
81
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,81 @@
|
|||
# A lot of this has been copied from https://github.com/axodotdev/cargo-dist/blob/main/.github/workflows/ci.yml
|
||||
|
||||
name: MinedMap Rust CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
|
||||
env:
|
||||
RUSTFLAGS: -Dwarnings
|
||||
RUSTDOCFLAGS: -Dwarnings
|
||||
|
||||
jobs:
|
||||
fmt:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
# Use beta for now for let-else formatting
|
||||
toolchain: beta
|
||||
components: rustfmt
|
||||
- run: cargo fmt --all -- --check
|
||||
|
||||
clippy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: stable
|
||||
components: clippy
|
||||
- uses: swatinem/rust-cache@v2
|
||||
- uses: actions-rs/clippy-check@v1
|
||||
env:
|
||||
PWD: ${{ env.GITHUB_WORKSPACE }}
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
args: --workspace --tests --examples
|
||||
|
||||
docs:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
RUSTDOCFLAGS: -Dwarnings
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: stable
|
||||
components: rust-docs
|
||||
- uses: swatinem/rust-cache@v2
|
||||
- run: cargo doc --workspace --no-deps --document-private-items
|
||||
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
rust: [stable]
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: ${{ matrix.rust }}
|
||||
- uses: swatinem/rust-cache@v2
|
||||
# Run the tests/doctests (default features)
|
||||
- run: cargo test --workspace
|
||||
env:
|
||||
PWD: ${{ env.GITHUB_WORKSPACE }}
|
||||
# Run the tests/doctests (no default features)
|
||||
- run: cargo test --workspace --no-default-features
|
||||
env:
|
||||
PWD: ${{ env.GITHUB_WORKSPACE }}
|
||||
# Test the examples (default features)
|
||||
- run: cargo test --workspace --examples --bins
|
||||
env:
|
||||
PWD: ${{ env.GITHUB_WORKSPACE }}
|
||||
# Test the examples (no default features)
|
||||
- run: cargo test --workspace --no-default-features --examples --bins
|
||||
env:
|
||||
PWD: ${{ env.GITHUB_WORKSPACE }}
|
Loading…
Add table
Reference in a new issue