1name: CI 2on: 3 pull_request: 4 push: 5 branches: 6 - master 7 8jobs: 9 10 test: 11 name: Test 12 runs-on: ubuntu-latest 13 strategy: 14 matrix: 15 rust: [1.0.0, 1.5.0, 1.10.0, 1.15.0, 1.20.0, 1.25.0, 1.30.0, 1.35.0, 16 1.40.0, 1.45.0, 1.50.0, 1.55.0, 1.60.0, 1.65.0, 1.70.0, 1.75.0, 17 1.80.0, # first version with rustc-check-cfg 18 stable, beta, nightly] 19 steps: 20 - uses: actions/checkout@v4 21 - uses: dtolnay/rust-toolchain@master 22 with: 23 toolchain: ${{ matrix.rust }} 24 - run: cargo build --verbose 25 - run: cargo test --verbose 26 - run: cargo run 27 working-directory: ./ci/verify-check-cfg 28 29 # try probing a target that doesn't have std at all 30 no_std: 31 name: No Std 32 runs-on: ubuntu-latest 33 steps: 34 - uses: actions/checkout@v4 35 - uses: dtolnay/rust-toolchain@stable 36 with: 37 target: thumbv6m-none-eabi 38 - run: cargo test --verbose --lib 39 env: 40 TARGET: thumbv6m-none-eabi 41 42 # we don't even need an installed target for version checks 43 missing_target: 44 name: Missing Target 45 runs-on: ubuntu-latest 46 steps: 47 - uses: actions/checkout@v4 48 - uses: dtolnay/rust-toolchain@stable 49 - run: cargo test --verbose --lib -- version 50 env: 51 TARGET: thumbv6m-none-eabi 52 53 fmt: 54 name: Format 55 runs-on: ubuntu-latest 56 steps: 57 - uses: actions/checkout@v4 58 - uses: dtolnay/rust-toolchain@1.77.0 59 with: 60 components: rustfmt 61 - run: cargo fmt --all --check 62 63 # One job that "summarizes" the success state of this pipeline. This can then be added to branch 64 # protection, rather than having to add each job separately. 65 success: 66 name: Success 67 runs-on: ubuntu-latest 68 needs: [test, no_std, missing_target, fmt] 69 # Github branch protection is exceedingly silly and treats "jobs skipped because a dependency 70 # failed" as success. So we have to do some contortions to ensure the job fails if any of its 71 # dependencies fails. 72 if: always() # make sure this is never "skipped" 73 steps: 74 # Manually check the status of all dependencies. `if: failure()` does not work. 75 - name: check if any dependency failed 76 run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' 77