Skip to content

Commit 1cd6167

Browse files
author
Thomas Fossati
committed
add CI
Signed-off-by: Thomas Fossati <thomas.fossati@linaro.org>
1 parent 82b4766 commit 1cd6167

2 files changed

Lines changed: 288 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: ci
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v5
15+
- name: Formatting checks
16+
run: cargo fmt --all -- --check
17+
- name: Clippy checks
18+
run: cargo clippy --all-targets -- -D clippy::all -D clippy::cargo -A clippy::multiple-crate-versions
19+
- name: Build
20+
run: cargo build --verbose
21+
- name: Run tests
22+
run: cargo test --verbose
23+
24+
# Recommended pipeline if using advisories, to avoid sudden breakages
25+
# From: https://github.com/EmbarkStudios/cargo-deny-action
26+
cargo-deny:
27+
runs-on: ubuntu-latest
28+
strategy:
29+
matrix:
30+
checks:
31+
- advisories
32+
- bans licenses sources
33+
34+
# Prevent sudden announcement of a new advisory from failing ci:
35+
continue-on-error: ${{ matrix.checks == 'advisories' }}
36+
37+
steps:
38+
- uses: actions/checkout@v4
39+
- uses: EmbarkStudios/cargo-deny-action@v2
40+
with:
41+
command: check ${{ matrix.checks }}

deny.toml

Lines changed: 247 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,247 @@
1+
# This template contains all of the possible sections and their default values
2+
3+
# Note that all fields that take a lint level have these possible values:
4+
# * deny - An error will be produced and the check will fail
5+
# * warn - A warning will be produced, but the check will not fail
6+
# * allow - No warning or error will be produced, though in some cases a note
7+
# will be
8+
9+
# The values provided in this template are the default values that will be used
10+
# when any section or field is not specified in your own configuration
11+
12+
# Root options
13+
[graph]
14+
# If 1 or more target triples (and optionally, target_features) are specified,
15+
# only the specified targets will be checked when running `cargo deny check`.
16+
# This means, if a particular package is only ever used as a target specific
17+
# dependency, such as, for example, the `nix` crate only being used via the
18+
# `target_family = "unix"` configuration, that only having windows targets in
19+
# this list would mean the nix crate, as well as any of its exclusive
20+
# dependencies not shared by any other crates, would be ignored, as the target
21+
# list here is effectively saying which targets you are building for.
22+
targets = [
23+
# The triple can be any string, but only the target triples built in to
24+
# rustc (as of 1.40) can be checked against actual config expressions
25+
#{ triple = "x86_64-unknown-linux-musl" },
26+
# You can also specify which target_features you promise are enabled for a
27+
# particular target. target_features are currently not validated against
28+
# the actual valid features supported by the target architecture.
29+
#{ triple = "wasm32-unknown-unknown", features = ["atomics"] },
30+
]
31+
# When creating the dependency graph used as the source of truth when checks are
32+
# executed, this field can be used to prune crates from the graph, removing them
33+
# from the view of cargo-deny. This is an extremely heavy hammer, as if a crate
34+
# is pruned from the graph, all of its dependencies will also be pruned unless
35+
# they are connected to another crate in the graph that hasn't been pruned,
36+
# so it should be used with care. The identifiers are [Package ID Specifications]
37+
# (https://doc.rust-lang.org/cargo/reference/pkgid-spec.html)
38+
#exclude = []
39+
# If true, metadata will be collected with `--all-features`. Note that this can't
40+
# be toggled off if true, if you want to conditionally enable `--all-features` it
41+
# is recommended to pass `--all-features` on the cmd line instead
42+
all-features = false
43+
# If true, metadata will be collected with `--no-default-features`. The same
44+
# caveat with `all-features` applies
45+
no-default-features = false
46+
# If set, these feature will be enabled when collecting metadata. If `--features`
47+
# is specified on the cmd line they will take precedence over this option.
48+
#features = []
49+
50+
# This section is considered when running `cargo deny check advisories`
51+
# More documentation for the advisories section can be found here:
52+
# https://embarkstudios.github.io/cargo-deny/checks/advisories/cfg.html
53+
[advisories]
54+
# The path where the advisory database is cloned/fetched into
55+
db-path = "~/.cargo/advisory-db"
56+
# The url(s) of the advisory databases to use
57+
db-urls = ["https://github.com/rustsec/advisory-db"]
58+
# The lint level for unmaintained crates
59+
unmaintained = "workspace"
60+
# The lint level for crates that have been yanked from their source registry
61+
yanked = "warn"
62+
# A list of advisory IDs to ignore. Note that ignored advisories will still
63+
# output a note when they are encountered.
64+
ignore = [
65+
# NOTE: This is a TEMPORARY recognition of the cbindgen use of clap+atty that
66+
# requires clap to update its dependencies
67+
#"RUSTSEC-2021-0145",
68+
"RUSTSEC-2026-0009",
69+
]
70+
# Threshold for security vulnerabilities, any vulnerability with a CVSS score
71+
# lower than the range specified will be ignored. Note that ignored advisories
72+
# will still output a note when they are encountered.
73+
# * None - CVSS Score 0.0
74+
# * Low - CVSS Score 0.1 - 3.9
75+
# * Medium - CVSS Score 4.0 - 6.9
76+
# * High - CVSS Score 7.0 - 8.9
77+
# * Critical - CVSS Score 9.0 - 10.0
78+
#severity-threshold =
79+
80+
# If this is true, then cargo deny will use the git executable to fetch advisory database.
81+
# If this is false, then it uses a built-in git library.
82+
# Setting this to true can be helpful if you have special authentication requirements that cargo-deny does not support.
83+
# See Git Authentication for more information about setting up git authentication.
84+
#git-fetch-with-cli = true
85+
86+
# This section is considered when running `cargo deny check licenses`
87+
# More documentation for the licenses section can be found here:
88+
# https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html
89+
[licenses]
90+
# List of explicitly allowed licenses
91+
# See https://spdx.org/licenses/ for list of possible licenses
92+
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
93+
allow = [
94+
"MIT",
95+
"Apache-2.0",
96+
"BSD-3-Clause",
97+
"ISC",
98+
"Unicode-3.0",
99+
"Zlib",
100+
"MIT-0",
101+
#"Apache-2.0 WITH LLVM-exception",
102+
# Considered Copyleft, but permitted in this project
103+
"MPL-2.0",
104+
]
105+
# The confidence threshold for detecting a license from license text.
106+
# The higher the value, the more closely the license text must be to the
107+
# canonical license text of a valid SPDX license file.
108+
# [possible values: any between 0.0 and 1.0].
109+
confidence-threshold = 0.8
110+
# Allow 1 or more licenses on a per-crate basis, so that particular licenses
111+
# aren't accepted for every possible crate as with the normal allow list
112+
exceptions = [
113+
# Each entry is the crate and version constraint, and its specific allow
114+
# list
115+
#{ allow = ["Zlib"], name = "adler32", version = "*" },
116+
]
117+
118+
# Some crates don't have (easily) machine readable licensing information,
119+
# adding a clarification entry for it allows you to manually specify the
120+
# licensing information
121+
[[licenses.clarify]]
122+
# The name of the crate the clarification applies to
123+
name = "ring"
124+
# The optional version constraint for the crate
125+
version = "*"
126+
# The SPDX expression for the license requirements of the crate
127+
expression = "MIT AND ISC AND OpenSSL"
128+
# One or more files in the crate's source used as the "source of truth" for
129+
# the license expression. If the contents match, the clarification will be used
130+
# when running the license check, otherwise the clarification will be ignored
131+
# and the crate will be checked normally, which may produce warnings or errors
132+
# depending on the rest of your configuration
133+
license-files = [
134+
# Each entry is a crate relative path, and the (opaque) hash of its contents
135+
{ path = "LICENSE", hash = 0xbd0eed23 }
136+
]
137+
138+
[licenses.private]
139+
# If true, ignores workspace crates that aren't published, or are only
140+
# published to private registries.
141+
# To see how to mark a crate as unpublished (to the official registry),
142+
# visit https://doc.rust-lang.org/cargo/reference/manifest.html#the-publish-field.
143+
ignore = false
144+
# One or more private registries that you might publish crates to, if a crate
145+
# is only published to private registries, and ignore is true, the crate will
146+
# not have its license(s) checked
147+
registries = [
148+
#"https://sekretz.com/registry
149+
]
150+
151+
# This section is considered when running `cargo deny check bans`.
152+
# More documentation about the 'bans' section can be found here:
153+
# https://embarkstudios.github.io/cargo-deny/checks/bans/cfg.html
154+
[bans]
155+
# Lint level for when multiple versions of the same crate are detected
156+
# NOTE: Veraison has unusually complex dependencies across platforms
157+
# Explicitly allowing duplicates here TEMPORARILY.
158+
multiple-versions = "allow"
159+
# Lint level for when a crate version requirement is `*`
160+
wildcards = "allow"
161+
# The graph highlighting used when creating dotgraphs for crates
162+
# with multiple versions
163+
# * lowest-version - The path to the lowest versioned duplicate is highlighted
164+
# * simplest-path - The path to the version with the fewest edges is highlighted
165+
# * all - Both lowest-version and simplest-path are used
166+
highlight = "all"
167+
# The default lint level for `default` features for crates that are members of
168+
# the workspace that is being checked. This can be overriden by allowing/denying
169+
# `default` on a crate-by-crate basis if desired.
170+
workspace-default-features = "allow"
171+
# The default lint level for `default` features for external crates that are not
172+
# members of the workspace. This can be overriden by allowing/denying `default`
173+
# on a crate-by-crate basis if desired.
174+
external-default-features = "allow"
175+
# List of crates that are allowed. Use with care!
176+
allow = [
177+
#{ name = "ansi_term", version = "=0.11.0" },
178+
]
179+
# List of crates to deny
180+
deny = [
181+
# Each entry the name of a crate and a version range. If version is
182+
# not specified, all versions will be matched.
183+
#{ name = "ansi_term", version = "=0.11.0" },
184+
#
185+
# Wrapper crates can optionally be specified to allow the crate when it
186+
# is a direct dependency of the otherwise banned crate
187+
#{ name = "ansi_term", version = "=0.11.0", wrappers = [] },
188+
]
189+
190+
# List of features to allow/deny
191+
# Each entry the name of a crate and a version range. If version is
192+
# not specified, all versions will be matched.
193+
#[[bans.features]]
194+
#name = "reqwest"
195+
# Features to not allow
196+
#deny = ["json"]
197+
# Features to allow
198+
#allow = [
199+
# "rustls",
200+
# "__rustls",
201+
# "__tls",
202+
# "hyper-rustls",
203+
# "rustls",
204+
# "rustls-pemfile",
205+
# "rustls-tls-webpki-roots",
206+
# "tokio-rustls",
207+
# "webpki-roots",
208+
#]
209+
# If true, the allowed features must exactly match the enabled feature set. If
210+
# this is set there is no point setting `deny`
211+
#exact = true
212+
213+
# Certain crates/versions that will be skipped when doing duplicate detection.
214+
skip = [
215+
#{ name = "ansi_term", version = "=0.11.0" },
216+
]
217+
# Similarly to `skip` allows you to skip certain crates during duplicate
218+
# detection. Unlike skip, it also includes the entire tree of transitive
219+
# dependencies starting at the specified crate, up to a certain depth, which is
220+
# by default infinite.
221+
skip-tree = [
222+
#{ name = "ansi_term", version = "=0.11.0", depth = 20 },
223+
]
224+
225+
# This section is considered when running `cargo deny check sources`.
226+
# More documentation about the 'sources' section can be found here:
227+
# https://embarkstudios.github.io/cargo-deny/checks/sources/cfg.html
228+
[sources]
229+
# Lint level for what to happen when a crate from a crate registry that is not
230+
# in the allow list is encountered
231+
unknown-registry = "warn"
232+
# Lint level for what to happen when a crate from a git repository that is not
233+
# in the allow list is encountered
234+
unknown-git = "warn"
235+
# List of URLs for allowed crate registries. Defaults to the crates.io index
236+
# if not specified. If it is specified but empty, no registries are allowed.
237+
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
238+
# List of URLs for allowed Git repositories
239+
allow-git = []
240+
241+
[sources.allow-org]
242+
# 1 or more github.com organizations to allow git sources for
243+
github = ["veraison"]
244+
# 1 or more gitlab.com organizations to allow git sources for
245+
# gitlab = [""]
246+
# 1 or more bitbucket.org organizations to allow git sources for
247+
# bitbucket = [""]

0 commit comments

Comments
 (0)