forked from coconut-svsm/svsm
-
Notifications
You must be signed in to change notification settings - Fork 1
163 lines (129 loc) · 4.82 KB
/
Copy pathrust.yml
File metadata and controls
163 lines (129 loc) · 4.82 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
jobs:
checkout:
name: Checkout
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive
- name: Upload source
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: source-code
path: .
retention-days: 1
# Make sure .cargo/ is uploaded as well
include-hidden-files: true
check:
name: Format / Clippy / Documentation
runs-on: ubuntu-latest
needs: checkout
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: Checkout
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: source-code
- name: Install rust toolchain
run: rustup toolchain install --profile minimal
- name: Add clippy
run: rustup component add clippy rustfmt
- name: Install TPM 2.0 Reference Implementation build dependencies
run: sudo apt install -y build-essential cmake pkg-config
# release/src/git_version.rs is auto-generated via a build.rs file. Touch
# it here to avoid CI failures.
- name: Touch release/src/git_version.rs
run: echo "" > release/src/git_version.rs
- name: Format
run: cargo fmt --all -- --check
- name: Clippy
run: make clippy
- name: Documentation
run: make doc
env:
RUSTDOCFLAGS: -D warnings
- name: Check that Cargo.lock is up to date
run: cargo update --workspace --locked
build-test-debug:
name: Build & test (debug)
runs-on: ubuntu-latest
needs: checkout
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: Checkout
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: source-code
- name: Install rust toolchain
run: rustup toolchain install --profile minimal
- name: Install TPM 2.0 Reference Implementation build dependencies
run: sudo apt install -y build-essential cmake pkg-config
- name: Build (non-test) debug images
run: cargo xbuild ./configs/*.json
- name: Build (non-test) debug images with all features
run: cargo xbuild --all-features ./configs/*.json
- name: Run tests
run: make test
build-test-release:
name: Build & test (release)
runs-on: ubuntu-latest
needs: checkout
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: Checkout
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: source-code
- name: Install rust toolchain
run: rustup toolchain install --profile minimal
- name: Install TPM 2.0 Reference Implementation build dependencies
run: sudo apt install -y build-essential cmake pkg-config
- name: Build (non-test) release images
run: cargo xbuild --release ./configs/*.json
- name: Run tests on release image
run: make test RELEASE=1
nightly-check:
runs-on: ubuntu-latest
needs: checkout
continue-on-error: true
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: Checkout
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: source-code
- name: Install latest nightly
run: rustup toolchain install nightly -t x86_64-unknown-none --profile minimal --force -c rustfmt
# release/src/git_version.rs is auto-generated via a build.rs file. Touch
# it here to avoid CI failures.
- name: Touch release/src/git_version.rs
run: echo "" > release/src/git_version.rs
- name: Format doctests
run: cargo +nightly fmt --all -- --check --config "format_code_in_doc_comments=true"