-
Notifications
You must be signed in to change notification settings - Fork 43
196 lines (162 loc) · 6.01 KB
/
Copy pathci.yml
File metadata and controls
196 lines (162 loc) · 6.01 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
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
run: |
Write-Host "Check formatting"
cargo fmt --all -- --check
if ($LastExitCode -eq 1) {
throw "Bad formatting, please run 'cargo +stable fmt --all'"
}
cargo fmt --manifest-path ./ffi/wasm/Cargo.toml -- --check
if ($LastExitCode -eq 1) {
throw "Bad formatting, please run 'cargo +stable fmt --manifest-path ./ffi/wasm/Cargo.toml'"
}
shell: pwsh
lints:
name: Lints [${{ matrix.os }}]
needs: [formatting]
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
os: [ windows, linux ]
include:
- os: windows
runner: windows-latest
- os: linux
runner: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Run clippy
run: cargo clippy --locked --workspace --all-features --all-targets -- -D warnings
lints-wasm:
name: Lints [wasm]
needs: [formatting]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Run clippy
run: cargo clippy --locked --all-features --all-targets --manifest-path ./ffi/wasm/Cargo.toml -- -D warnings
- name: Lint picky-ava-tests
run: |
Set-Location ./ffi/wasm/ava_tests
npm install
npm run ci
shell: pwsh
tests:
name: Tests [${{ matrix.os }}]
needs: [formatting]
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
os: [ windows, linux ]
include:
- os: windows
runner: windows-latest
- os: linux
runner: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Run tests
run: cargo test --locked --verbose --workspace --all-features
msrv:
# Minimum supported Rust version check for published crates.
# If this break, bump crate version minor number.
# See https://github.com/Devolutions/picky-rs/issues/89
name: Check MSRV [${{ matrix.crate }}]
needs: [formatting]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
crate: [ picky-asn1, picky-asn1-der, picky-asn1-x509, picky ]
include:
- crate: picky-asn1
msvc: "1.85"
- crate: picky-asn1-der
msvc: "1.85"
- crate: picky-asn1-x509
msvc: "1.85"
- crate: picky
msvc: "1.85"
steps:
- uses: actions/checkout@v6
- name: Configure runner
run: |
set -e
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain ${{ matrix.msvc }}
- name: cargo check ${{ matrix.crate }}
run: cargo +${{ matrix.msvc }} check -p ${{ matrix.crate }}
dotnet-tests:
name: .NET binding tests
needs: [formatting]
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
# The .NET bindings are compatible up to .NET 6 SDK.
# We run the tests of the oldest compatible framework.
- name: Install .NET 6 SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
# Release matches what ships (the ffi-production/NuGet build).
# Furthermore, debug builds currently trip std precondition checks at the FFI boundary.
# FIXME/TODO: Once we updated Diplomat to a newer version, it’s worth switching to a matrix
# for testing both the debug and release builds.
# NOTE: support for netstandard2.0 will be dropped once we get rid of the specialized Diplomat fork.
- name: Build native library
run: cargo build --locked --release -p picky-ffi
shell: pwsh
# Devolutions.Picky multi-targets net9.0-ios, so the iOS workload is required
# just to build it.
- name: Install iOS workload
run: dotnet workload install ios
shell: pwsh
# GeneratePackageOnBuild is on by default; disable it so the build does not try to
# pack native libraries for every RID (only the win-x64 one is available here).
# The committed bindings are built as-is (not regenerated) so a stale binding fails CI.
- name: Build .NET bindings and tests
run: dotnet build ./ffi/dotnet/Devolutions.Picky.Tests/Devolutions.Picky.Tests.csproj -c Release -p:GeneratePackageOnBuild=false
shell: pwsh
# The project intentionally does not copy the native lib to output
# (CopyToOutputDirectory=Never), so manually place it next to the test host.
- name: Place native library next to the test host
run: |
$testDll = Get-ChildItem -Recurse -Path ./ffi/dotnet/Devolutions.Picky.Tests/bin/Release -Filter Devolutions.Picky.Tests.dll | Select-Object -First 1
Copy-Item ./target/release/picky.dll (Join-Path $testDll.DirectoryName DevolutionsPicky.dll) -Force
shell: pwsh
# The tests read fixtures via paths relative to the test host CWD that resolve to
# <repo-parent>/test_assets; provision them from picky-test-data.
# FIXME: It would be worth repointing them at picky-test-data/test_assets.
- name: Provision test assets
run: Copy-Item picky-test-data/test_assets ../test_assets -Recurse -Force
shell: pwsh
- name: Run .NET tests
run: dotnet test ./ffi/dotnet/Devolutions.Picky.Tests/Devolutions.Picky.Tests.csproj -c Release --no-build
shell: pwsh
success:
name: Success
if: ${{ always() }}
needs: [formatting, lints, lints-wasm, tests, msrv, dotnet-tests]
runs-on: ubuntu-latest
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