Skip to content

Commit 3fd1006

Browse files
ci: fix dependabot, commit & check Cargo.toml (#5065)
Co-authored-by: Sam Clark <[email protected]>
1 parent c6b41ef commit 3fd1006

File tree

5 files changed

+95
-6
lines changed

5 files changed

+95
-6
lines changed

Diff for: .github/dependabot.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ updates:
3131
# restricted-MSRV, so don't do batch updates
3232
- package-ecosystem: "cargo"
3333
directories:
34-
- "/bindings/rust"
34+
- "/bindings/rust/standard"
35+
- "/bindings/rust/extended"
3536
schedule:
3637
interval: "daily"

Diff for: .github/workflows/ci_rust.yml

+32
Original file line numberDiff line numberDiff line change
@@ -423,3 +423,35 @@ jobs:
423423
run: |
424424
cargo +${{env.RUST_NIGHTLY_TOOLCHAIN}} minimal-versions check --direct --ignore-private
425425
cargo +${{env.RUST_NIGHTLY_TOOLCHAIN}} minimal-versions check --direct --ignore-private --all-features
426+
427+
# compare generated s2n-tls-sys/Cargo.toml with the existing one to check if it's up-to-date
428+
# unstable features might be updated in the future, new Cargo.toml should be committed in this case
429+
check-generated-cargo-toml:
430+
runs-on: ubuntu-latest
431+
steps:
432+
- uses: actions/checkout@v4
433+
434+
- name: Install Rust toolchain
435+
id: toolchain
436+
run: |
437+
rustup toolchain install stable
438+
rustup override set stable
439+
440+
- uses: camshaft/rust-cache@v1
441+
442+
- name: Generate
443+
run: ${{env.ROOT_PATH}}/generate.sh --skip-tests
444+
445+
- name: Compare Cargo
446+
working-directory: ${{env.ROOT_PATH}}/s2n-tls-sys
447+
id: diff
448+
run: git diff --exit-code Cargo.toml
449+
continue-on-error: true
450+
451+
- name: Failure
452+
if: steps.diff.outcome != 'success'
453+
run: |
454+
echo "A mismatch between the existing s2n-tls-sys/Cargo.toml and the Cargo.toml generated \
455+
from s2n-tls-sys/templates/Cargo.template has been found. Please ensure that the committed \
456+
Cargo.toml is up-to-date by regenerating it with ${{env.ROOT_PATH}}/generate.sh"
457+
exit 1

Diff for: bindings/rust/extended/.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ s2n-tls-sys/lib
77
s2n-tls-sys/src/api.rs
88
s2n-tls-sys/src/tests.rs
99
s2n-tls-sys/src/features*
10-
s2n-tls-sys/Cargo.toml

Diff for: bindings/rust/extended/generate/src/main.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ fn main() {
8888
}
8989

9090
// generate a cargo.toml that defines the correct features
91-
let features_definition_token = unstable_headers
91+
let mut features_definition_token = unstable_headers
9292
.iter()
9393
.map(|(header_name, _header)| format!("unstable-{header_name} = []"))
94-
.collect::<Vec<String>>()
95-
.join("\n");
94+
.collect::<Vec<String>>();
95+
features_definition_token.sort();
9696
let cargo_template = out_dir.join("templates/Cargo.template");
9797
let cargo_template = read_to_string(cargo_template).expect("unable to read cargo template");
98-
let cargo_toml = cargo_template.replace(FEATURE_TOKEN_PLACEHOLDER, &features_definition_token);
98+
let cargo_toml = cargo_template.replace(FEATURE_TOKEN_PLACEHOLDER, &(features_definition_token.join("\n")));
9999
fs::write(out_dir.join("Cargo.toml"), cargo_toml).unwrap();
100100

101101
// generate a features.rs that includes the correct modules

Diff for: bindings/rust/extended/s2n-tls-sys/Cargo.toml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
[package]
2+
name = "s2n-tls-sys"
3+
description = "A C99 implementation of the TLS/SSL protocols"
4+
version = "0.3.10"
5+
authors = ["AWS s2n"]
6+
edition = "2021"
7+
rust-version = "1.63.0"
8+
links = "s2n-tls"
9+
repository = "https://github.com/aws/s2n-tls"
10+
license = "Apache-2.0"
11+
include = [
12+
"build.rs",
13+
"Cargo.toml",
14+
"files.rs",
15+
"lib/**/*.c",
16+
"lib/**/*.h",
17+
"lib/**/*.S",
18+
"lib/CMakeLists.txt",
19+
"lib/**/*.cmake",
20+
"lib/**/*.flags", # for feature probes
21+
"src/**/*.rs",
22+
"tests/**/*.rs",
23+
]
24+
25+
[features]
26+
default = []
27+
# preserve the cmake feature in case any consumers had it enabled before
28+
cmake = []
29+
quic = []
30+
fips = ["aws-lc-rs/fips"]
31+
pq = []
32+
internal = []
33+
stacktrace = []
34+
unstable-cleanup = []
35+
unstable-crl = []
36+
unstable-fingerprint = []
37+
unstable-ktls = []
38+
unstable-npn = []
39+
unstable-renegotiate = []
40+
# e.g. something like
41+
# unstable-foo = []
42+
43+
[dependencies]
44+
# aws-lc-rs 1.6.4 adds DEP_AWS_LC environment variables which are required to build s2n-tls-sys:
45+
# https://github.com/aws/aws-lc-rs/pull/335
46+
aws-lc-rs = { version = "1.6.4" }
47+
# aws-lc-rs 1.6.4 depends on aws-lc-sys 0.14.0, which requires libc 0.2.121:
48+
# https://github.com/aws/aws-lc-rs/blob/2298ca861234d4f43aecef2c7d7e822c60bc488a/aws-lc-sys/Cargo.toml#L65
49+
libc = "0.2.121"
50+
51+
[build-dependencies]
52+
cc = { version = "1.0.100", features = ["parallel"] }
53+
54+
[dev-dependencies]
55+
home = "=0.5.5" # newer versions require rust 1.70, see https://github.com/aws/s2n-tls/issues/4395
56+
regex = "=1.9.6" # newer versions require rust 1.65, see https://github.com/aws/s2n-tls/issues/4242
57+
zeroize = "=1.7.0" # newer versions require rust 1.72, see https://github.com/aws/s2n-tls/issues/4518

0 commit comments

Comments
 (0)