|
1 | | -name: ci |
| 1 | +name: Rust CI |
2 | 2 |
|
3 | 3 | on: |
4 | | - pull_request: |
5 | 4 | push: |
6 | | - branches: [main] |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + |
| 14 | +env: |
| 15 | + CARGO_TERM_COLOR: always |
| 16 | + RUST_BACKTRACE: 1 |
7 | 17 |
|
8 | 18 | jobs: |
9 | 19 | checks: |
| 20 | + name: Format, lint, test, and package |
10 | 21 | runs-on: ubuntu-latest |
| 22 | + timeout-minutes: 30 |
11 | 23 | steps: |
12 | | - - uses: actions/checkout@v4 |
13 | | - - uses: dtolnay/rust-toolchain@stable |
| 24 | + - name: Checkout repository |
| 25 | + uses: actions/checkout@v6 |
| 26 | + |
| 27 | + - name: Install Rust toolchain |
| 28 | + shell: bash |
| 29 | + run: scripts/ci_install_rust.sh |
| 30 | + |
| 31 | + - name: Cache Rust build output |
| 32 | + uses: Swatinem/rust-cache@v2 |
| 33 | + with: |
| 34 | + cache-on-failure: true |
| 35 | + |
| 36 | + - name: Run checks |
| 37 | + run: scripts/checks.sh |
| 38 | + |
| 39 | + platform: |
| 40 | + name: Platform tests (${{ matrix.os }}) |
| 41 | + runs-on: ${{ matrix.os }} |
| 42 | + timeout-minutes: 20 |
| 43 | + strategy: |
| 44 | + fail-fast: false |
| 45 | + matrix: |
| 46 | + os: |
| 47 | + - ubuntu-latest |
| 48 | + - macos-latest |
| 49 | + - windows-latest |
| 50 | + |
| 51 | + steps: |
| 52 | + - name: Checkout repository |
| 53 | + uses: actions/checkout@v6 |
| 54 | + |
| 55 | + - name: Install Rust toolchain |
| 56 | + shell: bash |
| 57 | + run: scripts/ci_install_rust.sh |
| 58 | + |
| 59 | + - name: Cache Rust build output |
| 60 | + uses: Swatinem/rust-cache@v2 |
14 | 61 | with: |
15 | | - components: clippy, rustfmt |
16 | | - - run: bash scripts/checks.sh |
| 62 | + cache-on-failure: true |
| 63 | + |
| 64 | + - name: Test default features |
| 65 | + run: cargo test --all-targets |
| 66 | + |
| 67 | + - name: Test all features |
| 68 | + run: cargo test --all-targets --all-features |
| 69 | + |
| 70 | + - name: Check no_std library build |
| 71 | + run: cargo check --no-default-features --lib |
| 72 | + |
| 73 | + target-build: |
| 74 | + name: no_std target build (${{ matrix.target }}) |
| 75 | + runs-on: ubuntu-latest |
| 76 | + timeout-minutes: 20 |
| 77 | + strategy: |
| 78 | + fail-fast: false |
| 79 | + matrix: |
| 80 | + target: |
| 81 | + - x86_64-unknown-linux-gnu |
| 82 | + - aarch64-unknown-linux-gnu |
| 83 | + - wasm32-unknown-unknown |
| 84 | + - thumbv7em-none-eabihf |
| 85 | + |
| 86 | + steps: |
| 87 | + - name: Checkout repository |
| 88 | + uses: actions/checkout@v6 |
| 89 | + |
| 90 | + - name: Install Rust toolchain |
| 91 | + shell: bash |
| 92 | + run: scripts/ci_install_rust.sh |
| 93 | + |
| 94 | + - name: Install Rust target |
| 95 | + run: rustup target add ${{ matrix.target }} |
| 96 | + |
| 97 | + - name: Cache Rust build output |
| 98 | + uses: Swatinem/rust-cache@v2 |
| 99 | + with: |
| 100 | + cache-on-failure: true |
| 101 | + |
| 102 | + - name: Check no_std library build |
| 103 | + run: cargo check --no-default-features --lib --target ${{ matrix.target }} |
0 commit comments