11# This workflow runs whenever a PR is opened or updated, or a commit is pushed to main. It runs
22# several checks:
3- # - commit_list: produces a list of commits to be checked
43# - fmt: checks that the code is formatted according to rustfmt
54# - clippy: checks that the code does not contain any clippy warnings
65# - doc: checks that the code can be documented without errors
@@ -23,47 +22,13 @@ concurrency:
2322name : check
2423jobs :
2524
26- commit_list :
27- runs-on : ubuntu-latest
28- steps :
29-
30- - uses : actions/checkout@v4
31- with :
32- fetch-depth : 0
33-
34- - name : Get commit list (push)
35- id : get_commit_list_push
36- if : ${{ github.event_name == 'push' }}
37- run : |
38- echo "id0=$GITHUB_SHA" > $GITHUB_OUTPUT
39- echo "List of tested commits:" > $GITHUB_STEP_SUMMARY
40- sed -n 's,^id[0-9]\+=\(.*\),- ${{ github.repositoryUrl }}/commit/\1,p' -- $GITHUB_OUTPUT >> $GITHUB_STEP_SUMMARY
41-
42- - name : Get commit list (PR)
43- id : get_commit_list_pr
44- if : ${{ github.event_name == 'pull_request' }}
45- run : |
46- git rev-list --reverse refs/remotes/origin/${{ github.base_ref }}..${{ github.event.pull_request.head.sha }} | awk '{ print "id" NR "=" $1 }' > $GITHUB_OUTPUT
47- git diff --quiet ${{ github.event.pull_request.head.sha }} ${{ github.sha }} || echo "id0=$GITHUB_SHA" >> $GITHUB_OUTPUT
48- echo "List of tested commits:" > $GITHUB_STEP_SUMMARY
49- sed -n 's,^id[0-9]\+=\(.*\),- ${{ github.repositoryUrl }}/commit/\1,p' -- $GITHUB_OUTPUT >> $GITHUB_STEP_SUMMARY
50-
51- outputs :
52- commits : ${{ toJSON(steps.*.outputs.*) }}
53-
5425 fmt :
5526 runs-on : ubuntu-latest
5627 name : nightly / fmt
57- needs : commit_list
58- strategy :
59- fail-fast : false
60- matrix :
61- commit : ${{ fromJSON(needs.commit_list.outputs.commits) }}
6228 steps :
6329 - uses : actions/checkout@v4
6430 with :
6531 submodules : true
66- ref : ${{ matrix.commit }}
6732 - name : Install nightly
6833 uses : dtolnay/rust-toolchain@nightly
6934 with :
7338
7439 clippy :
7540 runs-on : ubuntu-latest
76- name : ${{ matrix.toolchain }} / clippy (${{ matrix.commit }})
77- needs : commit_list
41+ name : ${{ matrix.toolchain }} / clippy
7842 permissions :
7943 contents : read
8044 checks : write
@@ -83,12 +47,10 @@ jobs:
8347 matrix :
8448 # Get early warning of new lints which are regularly introduced in beta channels.
8549 toolchain : [stable, beta]
86- commit : ${{ fromJSON(needs.commit_list.outputs.commits) }}
8750 steps :
8851 - uses : actions/checkout@v4
8952 with :
9053 submodules : true
91- ref : ${{ matrix.commit }}
9254 - name : Install ${{ matrix.toolchain }}
9355 uses : dtolnay/rust-toolchain@master
9456 with :
@@ -105,16 +67,10 @@ jobs:
10567 # semver:
10668 # runs-on: ubuntu-latest
10769 # name: semver
108- # needs: commit_list
109- # strategy:
110- # fail-fast: false
111- # matrix:
112- # commit: ${{ fromJSON(needs.commit_list.outputs.commits) }}
11370 # steps:
11471 # - uses: actions/checkout@v4
11572 # with:
11673 # submodules: true
117- # ref: ${{ matrix.commit }}
11874 # - name: Install stable
11975 # uses: dtolnay/rust-toolchain@stable
12076 # with:
@@ -128,16 +84,10 @@ jobs:
12884 # API be documented as only available in some specific platforms.
12985 runs-on : ubuntu-latest
13086 name : nightly / doc
131- needs : commit_list
132- strategy :
133- fail-fast : false
134- matrix :
135- commit : ${{ fromJSON(needs.commit_list.outputs.commits) }}
13687 steps :
13788 - uses : actions/checkout@v4
13889 with :
13990 submodules : true
140- ref : ${{ matrix.commit }}
14191 - name : Install nightly
14292 uses : dtolnay/rust-toolchain@nightly
14393 - name : cargo doc
@@ -150,16 +100,10 @@ jobs:
150100 # which is required for feature unification
151101 runs-on : ubuntu-latest
152102 name : ubuntu / stable / features
153- needs : commit_list
154- strategy :
155- fail-fast : false
156- matrix :
157- commit : ${{ fromJSON(needs.commit_list.outputs.commits) }}
158103 steps :
159104 - uses : actions/checkout@v4
160105 with :
161106 submodules : true
162- ref : ${{ matrix.commit }}
163107 - name : Install stable
164108 uses : dtolnay/rust-toolchain@stable
165109 - name : cargo install cargo-hack
@@ -174,16 +118,10 @@ jobs:
174118 # our dependencies.
175119 runs-on : ubuntu-latest
176120 name : ubuntu / stable / deny
177- needs : commit_list
178- strategy :
179- fail-fast : false
180- matrix :
181- commit : ${{ fromJSON(needs.commit_list.outputs.commits) }}
182121 steps :
183122 - uses : actions/checkout@v4
184123 with :
185124 submodules : true
186- ref : ${{ matrix.commit }}
187125 - name : Install stable
188126 uses : dtolnay/rust-toolchain@stable
189127 - name : cargo install cargo-deny
@@ -197,16 +135,10 @@ jobs:
197135 test :
198136 runs-on : ubuntu-latest
199137 name : ubuntu / stable / test
200- needs : commit_list
201- strategy :
202- fail-fast : false
203- matrix :
204- commit : ${{ fromJSON(needs.commit_list.outputs.commits) }}
205138 steps :
206139 - uses : actions/checkout@v4
207140 with :
208141 submodules : true
209- ref : ${{ matrix.commit }}
210142 - name : Install stable
211143 uses : dtolnay/rust-toolchain@stable
212144 - name : cargo install cargo-hack
@@ -217,13 +149,11 @@ jobs:
217149 msrv :
218150 # check that we can build using the minimal rust version that is specified by this crate
219151 runs-on : ubuntu-latest
220- needs : commit_list
221152 # we use a matrix here just because env can't be used in job names
222153 # https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
223154 strategy :
224155 fail-fast : false
225156 matrix :
226- commit : ${{ fromJSON(needs.commit_list.outputs.commits) }}
227157 msrv : ["1.79"] # We're relying on namespaced-features, which
228158 # was released in 1.60
229159 #
@@ -235,12 +165,11 @@ jobs:
235165 #
236166 # embassy-time requires 1.79 due to
237167 # collapse_debuginfo
238- name : ubuntu / ${{ matrix.msrv }} (${{ matrix.commit }})
168+ name : ubuntu / ${{ matrix.msrv }}
239169 steps :
240170 - uses : actions/checkout@v4
241171 with :
242172 submodules : true
243- ref : ${{ matrix.commit }}
244173 - name : Install ${{ matrix.msrv }}
245174 uses : dtolnay/rust-toolchain@master
246175 with :
0 commit comments