Repository navigation
298 lines (257 loc) · 8.79 KB
/
Copy pathci.yml
File metadata and controls
298 lines (257 loc) · 8.79 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
name: CI
on:
push:
branches:
- master
pull_request:
types: [ opened, synchronize, reopened ]
workflow_dispatch:
jobs:
formatting:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Check formatting
shell: pwsh
run: |
Write-Host "Check formatting"
cargo fmt --all -- --check
if ($LastExitCode -eq 1) {
throw "Bad formatting, please run 'cargo +stable fmt --all'"
}
lints:
name: Lints [${{ matrix.os }}]
runs-on: ${{ matrix.runner }}
needs: formatting
strategy:
fail-fast: true
matrix:
os: [ win, osx, linux ]
include:
- os: win
runner: windows-2022
additional-args: --features tsssp
- os: osx
runner: macos-14
- os: linux
runner: ubuntu-latest
steps:
- uses: actions/checkout@v6
# Compiling the ffi module is enough to lint the whole sspi workspace
- name: Check clippy
env:
AWS_LC_SYS_NO_ASM: true
run: cargo clippy --manifest-path ffi/Cargo.toml ${{ matrix.additional-args }} -- -D warnings -D clippy::print_stdout
tests:
name: Tests [${{ matrix.os }}] [${{ matrix.crate-name }}]
runs-on: ${{ matrix.runner }}
needs: formatting
env:
SSPI_RS_IS_RUNNING_TESTS: true
strategy:
fail-fast: true
matrix:
os: [ win, osx, linux ]
manifest:
- Cargo.toml
- ffi/Cargo.toml
- crates/dpapi/Cargo.toml
- crates/winscard/Cargo.toml
- crates/dpapi-pdu/Cargo.toml
- crates/ffi-types/Cargo.toml
- crates/dpapi-core/Cargo.toml
- crates/dpapi-transport/Cargo.toml
- crates/dpapi-native-transport/Cargo.toml
include:
# Map runner per OS
- os: win
runner: windows-2022
- os: osx
runner: macos-14
- os: linux
runner: ubuntu-latest
# Map crate name per manifest
- manifest: Cargo.toml
crate-name: sspi
- manifest: ffi/Cargo.toml
crate-name: sspi-ffi
- manifest: crates/dpapi/Cargo.toml
crate-name: dpapi
- manifest: crates/winscard/Cargo.toml
crate-name: winscard
- manifest: crates/dpapi-pdu/Cargo.toml
crate-name: dpapi-pdu
- manifest: crates/ffi-types/Cargo.toml
crate-name: ffi-types
- manifest: crates/dpapi-core/Cargo.toml
crate-name: dpapi-core
- manifest: crates/dpapi-transport/Cargo.toml
crate-name: dpapi-transport
- manifest: crates/dpapi-native-transport/Cargo.toml
crate-name: dpapi-native-transport
# Per-OS feature overrides for specific manifests.
# `__test-data` enables the `tests/sspi/client_server` suite (gated on
# `all(network_client, __test-data)`), which otherwise never runs in CI.
- os: win
manifest: Cargo.toml
additional-args: --features network_client,dns_resolver,scard,tsssp,__test-data
- os: osx
manifest: Cargo.toml
additional-args: --features network_client,scard,__test-data
- os: linux
manifest: Cargo.toml
additional-args: --features network_client,dns_resolver,scard,__test-data
- os: win
manifest: ffi/Cargo.toml
additional-args: --features tsssp
- os: win
manifest: crates/dpapi/Cargo.toml
additional-args: --features tsssp
steps:
- uses: actions/checkout@v6
- name: Test
env:
AWS_LC_SYS_NO_ASM: true
run: cargo test --manifest-path ${{ matrix.manifest }} ${{ matrix.additional-args }}
miri:
name: Miri FFI tests
runs-on: ubuntu-latest
needs: formatting
env:
SSPI_RS_IS_RUNNING_TESTS: true
steps:
- uses: actions/checkout@v6
# NOTE: Pinned to a specific nightly version for reproducibility.
# Update this manually on a regular basis.
- name: Install nightly toolchain and Miri
run: |
rustup toolchain install nightly-2026-02-11 --component miri
rustup override set nightly-2026-02-11
- name: Test
run: cargo miri test --manifest-path ffi/Cargo.toml --no-default-features --features ring
wasm:
name: WASM target
runs-on: ubuntu-latest
needs: formatting
steps:
- uses: actions/checkout@v6
- name: Prepare runner
run: sudo apt-get install wabt
- name: Check
shell: pwsh
run: ./tools/wasm-testcompile/check.ps1
build-native:
name: Build native
needs: formatting
uses: ./.github/workflows/build-native.yml
pack-musl:
name: Pack musl libraries
runs-on: ubuntu-latest
needs: build-native
steps:
- uses: actions/checkout@v6
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Download glibc x64 library
uses: actions/download-artifact@v8
with:
name: sspi-linux-x64-release
path: dependencies/runtimes/linux-x64
- name: Download glibc arm64 library
uses: actions/download-artifact@v8
with:
name: sspi-linux-arm64-release
path: dependencies/runtimes/linux-arm64
- name: Download musl x64 library
uses: actions/download-artifact@v8
with:
name: sspi-linux-musl-x64-release
path: dependencies/runtimes/linux-musl-x64
- name: Download musl arm64 library
uses: actions/download-artifact@v8
with:
name: sspi-linux-musl-arm64-release
path: dependencies/runtimes/linux-musl-arm64
- name: Build and check NuGet package
shell: pwsh
run: |
dotnet build ffi/dotnet/Devolutions.Sspi/Devolutions.Sspi.csproj -c Release -o package
if ($LASTEXITCODE -ne 0) { throw "NuGet build failed" }
Add-Type -AssemblyName System.IO.Compression
$Packages = @(Get-ChildItem package -Filter 'Devolutions.Sspi.*.nupkg')
if ($Packages.Count -ne 1) { throw "Expected one NuGet package, found $($Packages.Count)" }
$Archive = [System.IO.Compression.ZipFile]::OpenRead($Packages[0].FullName)
try {
$Paths = @($Archive.Entries | ForEach-Object FullName)
foreach ($Rid in @('linux-x64', 'linux-arm64', 'linux-musl-x64', 'linux-musl-arm64')) {
$NativePath = "runtimes/$Rid/native/libDevolutionsSspi.so"
if ($Paths -notcontains $NativePath) { throw "Missing $NativePath in NuGet package" }
}
} finally {
$Archive.Dispose()
}
- uses: actions/upload-artifact@v7
with:
name: sspi-musl-nupkg
path: package/*.nupkg
if-no-files-found: error
test-musl-package:
name: Test NuGet on Alpine [${{ matrix.arch }}]
runs-on: ${{ matrix.runner }}
needs: pack-musl
strategy:
fail-fast: false
matrix:
include:
- arch: x64
runner: ubuntu-24.04
- arch: arm64
runner: ubuntu-24.04-arm
steps:
- uses: actions/download-artifact@v8
with:
name: sspi-musl-nupkg
path: package
- name: Restore, publish and load the native library on Alpine
env:
RID: linux-musl-${{ matrix.arch }}
run: |
docker run --rm -v "$PWD:/workspace:ro" -w /tmp -e RID \
mcr.microsoft.com/dotnet/sdk:10.0-alpine sh -euc '
dotnet new console --framework net10.0 --no-restore -o smoke
dotnet add smoke package Devolutions.Sspi --source /workspace/package
printf "%s\n" \
"using Devolutions.Sspi;" \
"unsafe" \
"{" \
" var table = Sspi.InitSecurityInterfaceW();" \
" if (table == null || table->dwVersion > 1000)" \
" throw new Exception(\"Invalid SSPI table\");" \
"}" > smoke/Program.cs
dotnet publish smoke -r "$RID" --self-contained false -p:AllowUnsafeBlocks=true -o published
test -f published/libDevolutionsSspi.so
dotnet published/smoke.dll
'
success:
name: Success
runs-on: ubuntu-latest
if: ${{ always() }}
needs:
- formatting
- lints
- tests
- miri
- wasm
- build-native
- pack-musl
- test-musl-package
steps:
- name: CI succeeded
id: succeeded
if: ${{ !contains(needs.*.result, 'failure') }}
run: exit 0
- name: CI failed
if: ${{ steps.succeeded.outcome == 'skipped' }}
run: exit 1