Debian Codegraph @

.github/workflows/ci.yml

raw symbols SCIP
1 on:
2 push:
3 branches: [ main ]
4 pull_request:
5 branches: [ main ]
6 merge_group:
7
8 name: CI
9
10 env:
11 CARGO_TERM_COLOR: always
12 CARGO_INCREMENTAL: 0
13
14 jobs:
15 tests:
16 runs-on: ubuntu-latest
17 strategy:
18 matrix:
19 include:
20 - rust: 1.85.0 # MSRV
21 features:
22 - rust: stable
23 features: arbitrary
24 - rust: stable
25 features: quickcheck
26 - rust: stable
27 features: rayon
28 - rust: stable
29 features: serde
30 - rust: stable
31 features: sval
32 - rust: stable
33 features: borsh
34 - rust: stable
35 features: std
36 - rust: beta
37 features:
38 - rust: nightly
39 bench: test build benchmarks
40
41 steps:
42 - uses: actions/checkout@v4
43 - uses: dtolnay/rust-toolchain@master
44 with:
45 toolchain: ${{ matrix.rust }}
46 - name: Tests
47 run: |
48 cargo build --verbose --features "${{ matrix.features }}"
49 cargo doc --verbose --features "${{ matrix.features }}"
50 cargo test --verbose --features "${{ matrix.features }}"
51 cargo test --release --verbose --features "${{ matrix.features }}"
52 - name: Tests (serde)
53 if: matrix.features == 'serde'
54 run: |
55 cargo test --verbose -p test-serde
56 - name: Tests (sval)
57 if: matrix.features == 'sval'
58 run: |
59 cargo test --verbose -p test-sval
60 - name: Test run benchmarks
61 if: matrix.bench != ''
62 run: cargo test -v --benches
63
64 nostd_build:
65 runs-on: ubuntu-latest
66 strategy:
67 matrix:
68 include:
69 - rust: 1.85.0
70 target: thumbv6m-none-eabi
71 - rust: stable
72 target: thumbv6m-none-eabi
73
74 steps:
75 - uses: actions/checkout@v4
76 - uses: dtolnay/rust-toolchain@master
77 with:
78 toolchain: ${{ matrix.rust }}
79 target: ${{ matrix.target }}
80 - name: Tests
81 run: |
82 cargo build -vv --target=${{ matrix.target }} --no-default-features
83 cargo build -v -p test-nostd --target=${{ matrix.target }}
84
85 clippy:
86 runs-on: ubuntu-latest
87 steps:
88 - uses: actions/checkout@v4
89 - uses: dtolnay/rust-toolchain@beta
90 with:
91 components: clippy
92 - run: cargo clippy --all-features
93
94 miri:
95 runs-on: ubuntu-latest
96 steps:
97 - uses: actions/checkout@v4
98 - uses: dtolnay/rust-toolchain@nightly
99 with:
100 components: miri, rust-src
101 - uses: taiki-e/install-action@v2
102 with:
103 tool: cargo-nextest
104 if: github.event_name == 'merge_group'
105 - run: cargo miri nextest run
106 if: github.event_name == 'merge_group'
107 - run: cargo miri test --doc
108
109 minimal-versions:
110 name: Check MSRV and minimal-versions
111 runs-on: ubuntu-latest
112 steps:
113 - uses: actions/checkout@v4
114 - uses: dtolnay/rust-toolchain@nightly
115 - uses: dtolnay/[email protected] # MSRV
116 - uses: taiki-e/install-action@v2
117 with:
118 tool: cargo-hack
119 - name: Lock minimal direct dependencies
120 run: cargo +nightly hack generate-lockfile --remove-dev-deps -Z direct-minimal-versions
121 - name: Build (nightly)
122 run: cargo +nightly build --verbose --all-features
123 - name: Build (MSRV)
124 run: cargo build --verbose --features arbitrary,quickcheck,serde,sval,rayon
125
126 # One job that "summarizes" the success state of this pipeline. This can then be added to branch
127 # protection, rather than having to add each job separately.
128 success:
129 name: Success
130 runs-on: ubuntu-latest
131 needs: [tests, nostd_build, clippy, miri, minimal-versions]
132 # Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
133 # failed" as success. So we have to do some contortions to ensure the job fails if any of its
134 # dependencies fails.
135 if: always() # make sure this is never "skipped"
136 steps:
137 # Manually check the status of all dependencies. `if: failure()` does not work.
138 - name: check if any dependency failed
139 run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'