-
Notifications
You must be signed in to change notification settings - Fork 1
129 lines (116 loc) · 3.97 KB
/
Copy pathrust-crates-ci.yml
File metadata and controls
129 lines (116 loc) · 3.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Rust Crates CI
permissions:
contents: read
on:
push:
branches: [main, develop, "release/**"]
pull_request:
branches: [main, develop, "release/**"]
workflow_dispatch:
env:
RUST_VERSION: "1.85.0"
jobs:
rust-quality:
name: Rust Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- name: Run clippy across Rust crates
shell: bash
run: |
set -euo pipefail
manifests=(
"crates/core/Cargo.toml"
"crates/consensus/Cargo.toml"
"crates/mempool/Cargo.toml"
"crates/bridge/Cargo.toml"
"sdk/rust/Cargo.toml"
"sdk/aethelred-sdk/Cargo.toml"
"sdk/aethelred-py/Cargo.toml"
)
for manifest in "${manifests[@]}"; do
echo ">>> cargo clippy --manifest-path ${manifest}"
cargo clippy --manifest-path "${manifest}"
done
rust-tests:
name: Rust Tests
runs-on: ubuntu-latest
needs: rust-quality
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
- name: Run crate tests
shell: bash
run: |
set -euo pipefail
manifests=(
"crates/core/Cargo.toml"
"crates/consensus/Cargo.toml"
"crates/mempool/Cargo.toml"
"crates/bridge/Cargo.toml"
"sdk/rust/Cargo.toml"
"sdk/aethelred-sdk/Cargo.toml"
"sdk/aethelred-py/Cargo.toml"
)
for manifest in "${manifests[@]}"; do
echo ">>> cargo test --manifest-path ${manifest} --lib --bins --tests --no-run"
cargo test --manifest-path "${manifest}" --lib --bins --tests --no-run
done
echo ">>> verify SDK full source presence"
cargo test --manifest-path sdk/aethelred-sdk/Cargo.toml --lib source_presence_tests::lib_full_source_is_present -- --nocapture
echo ">>> cargo test --manifest-path crates/consensus/Cargo.toml"
cargo test --manifest-path crates/consensus/Cargo.toml
rust-build:
name: Rust Release Build
runs-on: ubuntu-latest
needs: rust-tests
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
- name: Build release artifacts
shell: bash
run: |
set -euo pipefail
manifests=(
"crates/core/Cargo.toml"
"crates/consensus/Cargo.toml"
"crates/mempool/Cargo.toml"
"crates/bridge/Cargo.toml"
"sdk/rust/Cargo.toml"
)
for manifest in "${manifests[@]}"; do
echo ">>> cargo build --release --manifest-path ${manifest}"
cargo build --release --manifest-path "${manifest}"
done
- name: Verify full-pqc crypto builds
run: |
echo ">>> cargo test --manifest-path crates/core/Cargo.toml --features full-pqc"
cargo test --manifest-path crates/core/Cargo.toml --features full-pqc --lib --no-run
rust-required-gate:
name: Rust Required Gate
if: ${{ always() && github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
needs:
- rust-quality
- rust-tests
- rust-build
steps:
- name: Enforce required gate status
run: |
echo "rust-quality=${{ needs.rust-quality.result }}"
echo "rust-tests=${{ needs.rust-tests.result }}"
echo "rust-build=${{ needs.rust-build.result }}"
test "${{ needs.rust-quality.result }}" = "success"
test "${{ needs.rust-tests.result }}" = "success"
test "${{ needs.rust-build.result }}" = "success"