|
| 1 | +name: Cargo Build, Test, and Linting |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +env: |
| 8 | + CARGO_TERM_COLOR: always |
| 9 | + RUSTFLAGS: "-Dwarnings" |
| 10 | + |
| 11 | +jobs: |
| 12 | + format: |
| 13 | + name: Check formatting |
| 14 | + runs-on: ubuntu-latest |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + toolchain: |
| 18 | + - stable |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} |
| 22 | + - uses: Swatinem/rust-cache@v2 |
| 23 | + - run: cargo fmt --check |
| 24 | + clippy: |
| 25 | + name: Run lints |
| 26 | + runs-on: ubuntu-latest |
| 27 | + strategy: |
| 28 | + matrix: |
| 29 | + toolchain: |
| 30 | + - stable |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v4 |
| 33 | + - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} |
| 34 | + - uses: Swatinem/rust-cache@v2 |
| 35 | + - run: cargo clippy --all-targets --all-features |
| 36 | + build_and_test: |
| 37 | + name: Build project and test |
| 38 | + runs-on: ${{ matrix.os }} |
| 39 | + strategy: |
| 40 | + matrix: |
| 41 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 42 | + toolchain: |
| 43 | + - stable |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} |
| 47 | + - uses: Swatinem/rust-cache@v2 |
| 48 | + - run: cargo test --verbose |
| 49 | + build_release: |
| 50 | + name: Build project in release |
| 51 | + runs-on: ${{ matrix.os }} |
| 52 | + strategy: |
| 53 | + matrix: |
| 54 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 55 | + toolchain: |
| 56 | + - stable |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@v4 |
| 59 | + |
| 60 | + - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} |
| 61 | + - uses: Swatinem/rust-cache@v2 |
| 62 | + - run: cargo build --verbose --release |
| 63 | + - name: Export executable |
| 64 | + uses: actions/upload-artifact@v4 |
| 65 | + with: |
| 66 | + name: pumpkin-${{ matrix.os }} |
| 67 | + compression-level: 9 |
| 68 | + path: target/${{ matrix.target }}/release/pumpkin* |
| 69 | + clippy_release: |
| 70 | + name: Run lints in release mode |
| 71 | + runs-on: ubuntu-latest |
| 72 | + strategy: |
| 73 | + matrix: |
| 74 | + toolchain: |
| 75 | + - stable |
| 76 | + steps: |
| 77 | + - uses: actions/checkout@v4 |
| 78 | + - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} |
| 79 | + - uses: Swatinem/rust-cache@v2 |
| 80 | + - run: cargo clippy --release --all-targets --all-features |
0 commit comments