aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorFelipe Balbi <[email protected]>2025-11-07 10:43:32 -0800
committerFelipe Balbi <[email protected]>2025-11-07 10:51:04 -0800
commit812f3c840f4d505e285d1ddce6b0981dd745e344 (patch)
tree4425cdc41b4dd59c5e8dbbfdef3b8e10cad28063 /.github/workflows
parente75066820ad320495ca70570641c90d75247b19b (diff)
Reintroduce necessary files
Signed-off-by: Felipe Balbi <[email protected]>
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/cargo-vet-pr-comment.yml137
-rw-r--r--.github/workflows/cargo-vet.yml53
-rw-r--r--.github/workflows/check.yml205
-rw-r--r--.github/workflows/nostd.yml43
-rw-r--r--.github/workflows/rolling.yml68
5 files changed, 506 insertions, 0 deletions
diff --git a/.github/workflows/cargo-vet-pr-comment.yml b/.github/workflows/cargo-vet-pr-comment.yml
new file mode 100644
index 000000000..dd8ef37a6
--- /dev/null
+++ b/.github/workflows/cargo-vet-pr-comment.yml
@@ -0,0 +1,137 @@
1# This workflow triggers after cargo-vet workflow has run.
2# It adds a comment to the PR with the results of the cargo vet run.
3# It first adds a comment if the cargo vet run fails,
4# and updates the comment if the cargo vet run succeeds after having failed at least once.
5
6name: Cargo vet PR comment
7
8on:
9 workflow_run:
10 workflows: [cargo-vet]
11 types:
12 - completed
13
14permissions:
15 contents: read
16 pull-requests: write
17
18concurrency:
19 group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
20 cancel-in-progress: true
21
22jobs:
23
24 find-pr-comment:
25 # This job runs when the cargo-vet job fails or succeeds
26 # It will download the artifact from the failed job and post a comment on the PR
27 runs-on: ubuntu-latest
28 outputs:
29 comment-id: ${{ steps.get-comment-id.outputs.comment-id }}
30 pr-number: ${{ steps.get-pr-number.outputs.pr_number }}
31 if: github.event.workflow_run.event == 'pull_request'
32 steps:
33 - name: 'Download artifact'
34 uses: actions/download-artifact@v4
35 with:
36 github-token: ${{ secrets.GITHUB_TOKEN }}
37 name: pr
38 path: pr/
39 run-id: ${{ github.event.workflow_run.id }}
40
41 - name: 'Get PR number'
42 id: get-pr-number
43 run: echo "pr_number=$(cat ./pr/NR)" >> $GITHUB_OUTPUT
44
45 - name: 'Find existing comment'
46 id: find-comment
47 uses: peter-evans/find-comment@v3
48 with:
49 issue-number: ${{ steps.get-pr-number.outputs.pr_number }}
50 comment-author: 'github-actions[bot]'
51 body-includes: 'comment-tag: [cargo-vet]'
52
53 - name: 'Get comment ID'
54 id: get-comment-id
55 if: ${{ steps.find-comment.outputs.comment-id != '' }}
56 run: echo "comment-id=${{ steps.find-comment.outputs.comment-id }}" >> $GITHUB_OUTPUT
57
58 post-comment-failure:
59 # This job runs when the cargo-vet job fails
60 # It will download the artifact from the failed job and post a comment on the PR
61 runs-on: ubuntu-latest
62 needs: find-pr-comment
63 if: github.event.workflow_run.conclusion == 'failure'
64 steps:
65 - name: 'Comment on PR - Failure'
66 uses: peter-evans/create-or-update-comment@v4
67 with:
68 comment-id: ${{ needs.find-pr-comment.outputs.comment-id }}
69 issue-number: ${{ needs.find-pr-comment.outputs.pr-number }}
70 body: |
71 # Cargo Vet Audit Failed
72
73 `cargo vet` has failed in this PR. Please run `cargo vet --locked` locally to check for new or updated unvetted dependencies.
74 Details about the vetting process can be found in [supply-chain/README.md](../blob/main/supply-chain/README.md)
75
76 ## If the unvetted dependencies are not needed
77 Please modify Cargo.toml file to avoid including the dependencies.
78
79 ## If the unvetted dependencies are needed
80 Post a new comment with the questionnaire below to the PR to help the auditors vet the dependencies.
81 After the auditors have vetted the dependencies, the PR will need to be rebased to pick up the new audits and pass this check.
82
83 ### Copy and paste the questionnaire as a new comment and provide your answers:
84
85 **1. What crates (with version) need to be audited?**
86
87 **2. How many of the crates are version updates vs new dependencies?**
88
89 **3. To confirm none of the already included crates serve your needs, please provide a brief description of the purpose of the new crates.**
90
91 **4. Any extra notes to the auditors to help with their audits.**
92
93 <!--
94 This comment is auto-generated by the cargo-vet workflow.
95 Please do not edit it directly.
96
97 comment-tag: [cargo-vet]
98 -->
99 edit-mode: replace
100
101 - name: 'Label PR'
102 uses: actions/github-script@v7
103 with:
104 script: |
105 github.rest.issues.addLabels({
106 issue_number: ${{ needs.find-pr-comment.outputs.pr-number }},
107 owner: context.repo.owner,
108 repo: context.repo.repo,
109 labels: ['cargo vet']
110 })
111
112 post-comment-success:
113 # This job runs when the cargo-vet job succeeds
114 # It will update the comment on the PR with a success message
115 runs-on: ubuntu-latest
116 needs: find-pr-comment
117 if: github.event.workflow_run.conclusion == 'success'
118 steps:
119 - name: 'Comment on PR - Success'
120 # Only update the comment if it exists
121 # This is to avoid creating a new comment if the cargo-vet job has never failed before
122 if: ${{ needs.find-pr-comment.outputs.comment-id }}
123 uses: peter-evans/create-or-update-comment@v4
124 with:
125 comment-id: ${{ needs.find-pr-comment.outputs.comment-id }}
126 issue-number: ${{ needs.find-pr-comment.outputs.pr-number }}
127 body: |
128 # Cargo Vet Audit Passed
129 `cargo vet` has passed in this PR. No new unvetted dependencies were found.
130
131 <!--
132 This comment is auto-generated by the cargo-vet workflow.
133 Please do not edit it directly.
134
135 comment-tag: [cargo-vet]
136 -->
137 edit-mode: replace \ No newline at end of file
diff --git a/.github/workflows/cargo-vet.yml b/.github/workflows/cargo-vet.yml
new file mode 100644
index 000000000..864c138e9
--- /dev/null
+++ b/.github/workflows/cargo-vet.yml
@@ -0,0 +1,53 @@
1# This workflow runs whenever a PR is opened or updated. It runs cargo vet to check for unvetted dependencies in the Cargo.lock file.
2permissions:
3 contents: read
4on:
5 pull_request:
6
7concurrency:
8 group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9 cancel-in-progress: true
10
11name: cargo-vet
12jobs:
13 vet:
14 # cargo-vet checks for unvetted dependencies in the Cargo.lock file
15 # This is to ensure that new dependencies are vetted before they are added to the project
16 name: vet-dependencies
17 runs-on: ubuntu-latest
18 env:
19 CARGO_VET_VERSION: 0.10.1
20
21 steps:
22 - uses: actions/checkout@v4
23 with:
24 submodules: true
25
26 - uses: actions/cache@v4
27 with:
28 path: ${{ runner.tool_cache }}/cargo-vet
29 key: cargo-vet-bin-${{ env.CARGO_VET_VERSION }}
30
31 - name: Add the tool cache directory to the search path
32 run: echo "${{ runner.tool_cache }}/cargo-vet/bin" >> $GITHUB_PATH
33
34 - name: Ensure that the tool cache is populated with the cargo-vet binary
35 run: cargo install --root ${{ runner.tool_cache }}/cargo-vet --version ${{ env.CARGO_VET_VERSION }} cargo-vet
36
37 - name: Invoke cargo-vet
38 run: cargo vet --locked
39
40 - name: Save PR number
41 # PR number is saved as an artifact so it can be used to determine the PR to comment on by the vet-pr-comment workflow
42 # vet-pr-comment workflow is triggered by the workflow_run event so it runs in the context of the base branch and not the PR branch
43 if: ${{ failure() }} || ${{ success() }}
44 run: |
45 mkdir -p ./pr
46 echo ${{ github.event.number }} > ./pr/NR
47 - uses: actions/upload-artifact@v4
48 # Need to upload the artifact in both success and failure cases so comment can be updated in either case
49 if: ${{ failure() }} || ${{ success() }}
50 with:
51 name: pr
52 path: pr/
53 overwrite: true \ No newline at end of file
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
new file mode 100644
index 000000000..1a09a1492
--- /dev/null
+++ b/.github/workflows/check.yml
@@ -0,0 +1,205 @@
1# This workflow runs whenever a PR is opened or updated, or a commit is pushed to main. It runs
2# several checks:
3# - fmt: checks that the code is formatted according to rustfmt
4# - clippy: checks that the code does not contain any clippy warnings
5# - doc: checks that the code can be documented without errors
6# - hack: check combinations of feature flags
7# - msrv: check that the msrv specified in the crate is correct
8permissions:
9 contents: read
10
11# This configuration allows maintainers of this repo to create a branch and pull request based on
12# the new branch. Restricting the push trigger to the main branch ensures that the PR only gets
13# built once.
14on:
15
16 push:
17 branches: [main, main-nextgen]
18 pull_request:
19
20# If new code is pushed to a PR branch, then cancel in progress workflows for that PR. Ensures that
21# we don't waste CI time, and returns results quicker https://github.com/jonhoo/rust-ci-conf/pull/5
22concurrency:
23 group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
24 cancel-in-progress: true
25
26name: check
27
28jobs:
29
30 fmt:
31 runs-on: ubuntu-latest
32 name: nightly / fmt
33
34 strategy:
35 fail-fast: false
36 matrix:
37 workdir: [ ".", "examples/rt633", "examples/rt685s-evk",]
38
39 steps:
40 - uses: actions/checkout@v4
41 with:
42 submodules: true
43
44 - name: Install nightly
45 uses: dtolnay/rust-toolchain@nightly
46 with:
47 components: rustfmt
48
49 - name: cargo fmt --check
50 run: cargo fmt --check
51 working-directory: ${{ matrix.workdir }}
52
53 clippy-examples:
54 runs-on: ubuntu-latest
55 name: ${{ matrix.toolchain }} / clippy
56
57 permissions:
58 contents: read
59 checks: write
60
61 strategy:
62 fail-fast: false
63 matrix:
64 # Get early warning of new lints which are regularly introduced in beta channels.
65 toolchain: [stable]
66 workdir: ["examples"]
67
68 steps:
69 - uses: actions/checkout@v4
70 with:
71 submodules: true
72
73 - name: Install ${{ matrix.toolchain }}
74 uses: dtolnay/rust-toolchain@master
75 with:
76 toolchain: ${{ matrix.toolchain }}
77 components: clippy
78
79 - name: cargo clippy
80 working-directory: ${{ matrix.workdir }}
81 run: |
82 cargo clippy --locked -- -Dwarnings -D clippy::suspicious -D clippy::correctness -D clippy::perf -D clippy::style
83
84 # Enable once we have a released crate
85 # semver:
86 # runs-on: ubuntu-latest
87 # name: semver
88 # steps:
89 # - uses: actions/checkout@v4
90 # with:
91 # submodules: true
92 # - name: Install stable
93 # uses: dtolnay/rust-toolchain@stable
94 # with:
95 # components: rustfmt
96 # - name: cargo-semver-checks
97 # uses: obi1kenobi/cargo-semver-checks-action@v2
98
99 doc:
100 # run docs generation on nightly rather than stable. This enables features like
101 # https://doc.rust-lang.org/beta/unstable-book/language-features/doc-cfg.html which allows an
102 # API be documented as only available in some specific platforms.
103 runs-on: ubuntu-latest
104 name: nightly / doc
105
106 steps:
107 - uses: actions/checkout@v4
108 with:
109 submodules: true
110
111 - name: Install nightly
112 uses: dtolnay/rust-toolchain@nightly
113
114 - name: cargo doc
115 run: |
116 cargo doc --no-deps --all-features --locked
117 env:
118 RUSTDOCFLAGS: --cfg docsrs
119
120 hack:
121 # cargo-hack checks combinations of feature flags to ensure that features are all additive
122 # which is required for feature unification
123 runs-on: ubuntu-latest
124 name: ubuntu / stable / features
125
126 strategy:
127 fail-fast: false
128
129 steps:
130 - uses: actions/checkout@v4
131 with:
132 submodules: true
133
134 - name: Install stable
135 uses: dtolnay/rust-toolchain@stable
136 with:
137 toolchain: stable
138 components: clippy
139
140 - name: rustup target add thumbv8m.main-none-eabihf
141 run: rustup target add thumbv8m.main-none-eabihf
142
143 - name: cargo hack
144 run: cargo hack --feature-powerset check
145
146 deny:
147 # cargo-deny checks licenses, advisories, sources, and bans for
148 # our dependencies.
149 runs-on: ubuntu-latest
150 name: ubuntu / stable / deny
151
152 steps:
153 - uses: actions/checkout@v4
154 with:
155 submodules: true
156
157 - name: Install stable
158 uses: dtolnay/rust-toolchain@stable
159
160 - name: cargo install cargo-deny
161 uses: EmbarkStudios/cargo-deny-action@v2
162 with:
163 log-level: warn
164 manifest-path: ./Cargo.toml
165 command: check
166 arguments: --all-features --locked
167
168 msrv:
169 # check that we can build using the minimal rust version that is specified by this crate
170 runs-on: ubuntu-latest
171 # we use a matrix here just because env can't be used in job names
172 # https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
173 strategy:
174 fail-fast: false
175 matrix:
176 msrv: ["1.90"] # We're relying on namespaced-features, which
177 # was released in 1.60
178 #
179 # We also depend on `fixed' which requires rust
180 # 1.71
181 #
182 # Additionally, we depend on embedded-hal-async
183 # which requires 1.75
184 #
185 # embassy-time requires 1.79 due to
186 # collapse_debuginfo
187 #
188 # embassy upstream switched to rust 1.85
189 #
190 # unsigned_is_multiple_of requires 1.90, else we get clippy warnings
191
192 name: ubuntu / ${{ matrix.msrv }}
193 steps:
194 - uses: actions/checkout@v4
195 with:
196 submodules: true
197
198 - name: Install ${{ matrix.msrv }}
199 uses: dtolnay/rust-toolchain@master
200 with:
201 toolchain: ${{ matrix.msrv }}
202
203 - name: cargo +${{ matrix.msrv }} check
204 run: |
205 cargo check --all-features --locked
diff --git a/.github/workflows/nostd.yml b/.github/workflows/nostd.yml
new file mode 100644
index 000000000..92460bd0f
--- /dev/null
+++ b/.github/workflows/nostd.yml
@@ -0,0 +1,43 @@
1# This workflow checks whether the library is able to run without the std library (e.g., embedded).
2# This entire file should be removed if this crate does not support no-std. See check.yml for
3# information about how the concurrency cancellation and workflow triggering works
4permissions:
5 contents: read
6
7on:
8 push:
9 branches: [main, main-nextgen]
10 pull_request:
11
12concurrency:
13 group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
14 cancel-in-progress: true
15
16name: no-std
17
18jobs:
19 nostd:
20 runs-on: ubuntu-latest
21 name: ${{ matrix.target }}
22
23 strategy:
24 matrix:
25 target: [thumbv8m.main-none-eabihf]
26
27 steps:
28 - uses: actions/checkout@v4
29 with:
30 submodules: true
31
32 - name: Install stable
33 uses: dtolnay/rust-toolchain@stable
34
35 - name: rustup target add ${{ matrix.target }}
36 run: rustup target add ${{ matrix.target }}
37
38 - name: Show variable
39 run: echo ${{ env.TOKEN }}
40
41 - name: cargo check
42 run: |
43 cargo check --target ${{ matrix.target }} --all-features --locked
diff --git a/.github/workflows/rolling.yml b/.github/workflows/rolling.yml
new file mode 100644
index 000000000..f572954f9
--- /dev/null
+++ b/.github/workflows/rolling.yml
@@ -0,0 +1,68 @@
1# This workflow runs every morning at midnight. It will run cargo hack
2# and a build with msrv. If any dependency breaks our crate, we will
3# know ASAP.
4#
5# - check: build with all features
6# - msrv: check that the msrv specified in the crate is correct
7permissions:
8 contents: read
9
10on:
11 schedule:
12 - cron: '0 0 * * *'
13
14name: rolling
15jobs:
16
17 check:
18 runs-on: ubuntu-latest
19 name: ubuntu / stable / features
20 strategy:
21 fail-fast: false
22 steps:
23 - uses: actions/checkout@v4
24 with:
25 submodules: true
26 - name: Install stable
27 uses: dtolnay/rust-toolchain@stable
28 - name: cargo install cargo-hack
29 uses: taiki-e/install-action@cargo-hack
30 - name: cargo check
31 run: |
32 cargo update
33 cargo check --all-features check
34
35 msrv:
36 runs-on: ubuntu-latest
37 strategy:
38 fail-fast: false
39 matrix:
40 msrv: ["1.85"] # We're relying on namespaced-features, which
41 # was released in 1.60
42 #
43 # We also depend on `fixed' which requires rust
44 # 1.71
45 #
46 # Additionally, we depend on embedded-hal-async
47 # which requires 1.75
48 #
49 # embassy-time requires 1.79 due to
50 # collapse_debuginfo
51 #
52 # embassy upstream switched to rust 1.83
53 #
54 # embedded-services (storage bus) dependency
55 # requires 1.85
56 name: ubuntu / ${{ matrix.msrv }} (${{ matrix.commit }})
57 steps:
58 - uses: actions/checkout@v4
59 with:
60 submodules: true
61 - name: Install ${{ matrix.msrv }}
62 uses: dtolnay/rust-toolchain@master
63 with:
64 toolchain: ${{ matrix.msrv }}
65 - name: cargo +${{ matrix.msrv }} check
66 run: |
67 cargo update
68 cargo check --all-features check