-
Notifications
You must be signed in to change notification settings - Fork 50
289 lines (278 loc) · 10.2 KB
/
cross.yml
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
name: cross
on:
push:
branches:
- '*'
- '!generate/aws-lc-*'
pull_request:
branches:
- '*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
env:
RUST_BACKTRACE: 1
# We can pin the version if nightly is too unstable.
# Otherwise, we test against the latest version.
RUST_NIGHTLY_TOOLCHAIN: nightly
jobs:
aws-lc-rs-cross-test:
if: github.repository_owner == 'aws'
name: cross tests ${{ matrix.target }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
target:
- aarch64-linux-android
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- arm-linux-androideabi
- arm-unknown-linux-gnueabihf
- armv7-linux-androideabi
- armv7-unknown-linux-gnueabihf
- i686-unknown-linux-gnu
- powerpc-unknown-linux-gnu
- powerpc64-unknown-linux-gnu
- powerpc64le-unknown-linux-gnu
- riscv64gc-unknown-linux-gnu
- s390x-unknown-linux-gnu
- x86_64-pc-windows-gnu
- x86_64-unknown-linux-musl
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 'stable'
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross
- uses: dtolnay/rust-toolchain@master
id: toolchain
with:
toolchain: 'stable'
target: ${{ matrix.target }}
- name: Set Rust toolchain override
run: rustup override set ${{ steps.toolchain.outputs.name }}
# The flag below is set to avoid the following error with GCC 11.4.0 on the riscv64 platform:
# /home/runner/work/aws-lc-rs/aws-lc-rs/aws-lc-sys/aws-lc/crypto/pem/pem_lib.c:707:11: error: 'strncmp' of strings of length 1 and 9 and bound of 9 evaluates to nonzero [-Werror=string-compare]
# 707 | if (strncmp(buf, "-----END ", 9) == 0) {
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
- if: ${{ matrix.target == 'riscv64gc-unknown-linux-gnu' }}
run: |
echo 'AWS_LC_SYS_CFLAGS="-Wno-string-compare"' >> "$GITHUB_ENV"
- name: Cross-compilation (build debug)
run: cross build -p aws-lc-rs --features unstable --target ${{ matrix.target }}
- name: Cross-compilation (test release)
run: cross test -p aws-lc-rs --release --features unstable --target ${{ matrix.target }}
aws-lc-rs-cross-0_2_5-test:
if: github.repository_owner == 'aws'
name: cross tests ${{ matrix.target }}
runs-on: ubuntu-latest
env:
CROSS_CONFIG: './Cross.toml.x86_64-unknown-linux-gnu'
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 'stable'
- name: Install cross
run: cargo install cross --locked --version 0.2.5
- uses: dtolnay/rust-toolchain@master
id: toolchain
with:
toolchain: 'stable'
target: ${{ matrix.target }}
- name: Set Rust toolchain override
run: rustup override set ${{ steps.toolchain.outputs.name }}
- name: Cross-compilation (build debug)
run: cross build -p aws-lc-rs --features unstable --target ${{ matrix.target }}
- name: Cross-compilation (test release)
run: cross test -p aws-lc-rs --release --features unstable --target ${{ matrix.target }}
aws-lc-rs-ios-aarch64:
if: github.repository_owner == 'aws'
name: iOS aarch64 cross-platform build
runs-on: macos-14-xlarge
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- run: |
brew install llvm
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"'
echo 'export LIBCLANG_PATH=/opt/homebrew/opt/llvm' >> "$GITHUB_ENV"
- uses: dtolnay/rust-toolchain@master
id: toolchain
with:
toolchain: stable
target: aarch64-apple-ios-sim
- name: Install bash
run: brew install bash
- name: iOS Simulator Runner
run: ./scripts/ci/ios-simulator-runner.sh
aws-lc-rs-ios-x86_64:
if: github.repository_owner == 'aws'
name: iOS x86-64 cross-platform build
runs-on: macos-14-xlarge
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- run: |
brew install llvm
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"'
echo 'export LIBCLANG_PATH=/opt/homebrew/opt/llvm' >> "$GITHUB_ENV"
- uses: dtolnay/rust-toolchain@master
id: toolchain
with:
toolchain: stable
target: x86_64-apple-ios
- name: Debug build for `x86_64-apple-ios`
run: cargo build -p aws-lc-rs --target x86_64-apple-ios --features bindgen
- name: Release build for `x86_64-apple-ios`
run: cargo build -p aws-lc-rs --release --target x86_64-apple-ios --features bindgen
cargo-xwin:
if: github.repository_owner == 'aws'
runs-on: ubuntu-latest
steps:
- name: Install build dependencies
# cargo-xwin apparently require ninja-build
run: |
sudo apt-get update && sudo apt-get install --assume-yes nasm clang ninja-build llvm
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: x86_64-pc-windows-msvc
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: aarch64-pc-windows-msvc
- name: Install cargo-xwin and bindgen-cli
run: cargo install --locked cargo-xwin bindgen-cli
- name: cargo xwin build for `x86_64-pc-windows-msvc`
run: cargo xwin build -p aws-lc-rs --release --all-targets --target x86_64-pc-windows-msvc
- name: cargo xwin build for `aarch64-pc-windows-msvc`
run: cargo xwin build -p aws-lc-rs --release --all-targets --target aarch64-pc-windows-msvc
aws-lc-rs-windows-gnu:
if: github.repository_owner == 'aws'
name: ${{ matrix.target }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
target:
- 'x86_64-pc-windows-gnu'
# TODO: Fails in GitHub CI. Appears to be related to bindgen.
# .../base.h:61:10: fatal error: 'stdlib.h' file not found
# - 'i686-pc-windows-gnu'
steps:
- uses: ilammy/setup-nasm@v1
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: dtolnay/rust-toolchain@master
id: toolchain
with:
toolchain: stable
target: ${{ matrix.target }}
- name: Debug Test on `${{ matrix.target }}`
run: cargo test -p aws-lc-rs --target ${{ matrix.target }} --features bindgen
- name: Release test on `${{ matrix.target }}`
run: cargo test -p aws-lc-rs --release --target ${{ matrix.target }} --features bindgen
aws-lc-rs-windows-msvc:
if: ${{ github.repository_owner == 'aws' }}
name: ${{ matrix.target }} - ${{ (matrix.crt_static == '1' && 'crt-static and /WX') || '/WX' }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
target:
- 'x86_64-pc-windows-msvc'
- 'i686-pc-windows-msvc'
- 'aarch64-pc-windows-msvc'
crt_static:
- '0'
- '1'
steps:
- name: Install NASM
if: ${{ matrix.target == 'x86_64-pc-windows-msvc' || matrix.target == 'i686-pc-windows-msvc' }}
uses: ilammy/setup-nasm@v1
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: dtolnay/rust-toolchain@master
id: toolchain
with:
toolchain: stable
target: ${{ matrix.target }}
- name: Set ACTION_CARGO
run: |
if ('${{ matrix.target }}' -like '*aarch64*') {
echo "ACTION_CARGO=build" | Out-File -FilePath $env:GITHUB_ENV -Append
} else {
echo "ACTION_CARGO=test" | Out-File -FilePath $env:GITHUB_ENV -Append
}
- name: Set RUSTFLAGS
run: |
if ('${{ matrix.crt_static }}' -eq '1') {
echo "RUSTFLAGS=-Clink-arg=/WX -Ctarget-feature=+crt-static" | Out-File -FilePath $env:GITHUB_ENV -Append
} else {
echo "RUSTFLAGS=-Clink-arg=/WX" | Out-File -FilePath $env:GITHUB_ENV -Append
}
- name: Debug build
run: cargo ${{ env.ACTION_CARGO }} -p aws-lc-rs --all-targets --target ${{ matrix.target }} --features bindgen
- name: Release Build for ${{ matrix.target }}
run: cargo ${{ env.ACTION_CARGO }} --release -p aws-lc-rs --all-targets --target ${{ matrix.target }}
freebsd:
if: github.repository_owner == 'aws'
name: aws-lc-rs freebsd test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [ 13.4, 14.1 ]
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Prepare VM
uses: vmactions/freebsd-vm@v1
with:
release: ${{ matrix.target }}
usesh: true
copyback: false
prepare: |
pkg install -y git gmake bash sudo cmake-core llvm-devel-lite curl go
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env"
cargo test -p aws-lc-rs
cargo test -p aws-lc-rs --no-default-features --features=fips
cross-x86_64-pc-windows-gnu:
if: github.repository_owner == 'aws'
name: cross (prebuilt nasm) - x86_64-pc-windows-gnu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: dtolnay/rust-toolchain@stable
id: toolchain
with:
toolchain: 'stable'
target: x86_64-pc-windows-gnu
- name: Install mingw
run: sudo apt-get update && sudo apt-get install --assume-yes mingw-w64
- name: Run cargo test
run: cargo build -p aws-lc-rs --features prebuilt-nasm --target x86_64-pc-windows-gnu