@@ -246,29 +246,74 @@ jobs:
246246
247247 cargo-xwin :
248248 if : github.repository_owner == 'aws'
249- runs-on : ubuntu-latest
249+ runs-on : ${{ matrix.host }}
250+ strategy :
251+ fail-fast : false
252+ matrix :
253+ host :
254+ - ubuntu-latest
255+ - macos-latest
256+ - windows-latest
257+ - windows-11-arm
258+ target :
259+ - " x86_64-pc-windows-msvc"
260+ - " aarch64-pc-windows-msvc"
261+ crt_static :
262+ - " 0"
263+ - " 1"
250264 steps :
251265 - name : Install build dependencies
252- # cargo-xwin apparently require ninja-build
266+ if : matrix.host == 'ubuntu-latest'
267+ # cargo-xwin apparently requires ninja-build
253268 run : |
254- sudo apt-get update && sudo apt-get install --assume-yes nasm clang ninja-build llvm
269+ sudo apt-get update && sudo apt-get install --assume-yes nasm ninja-build llvm
270+ - name : Install build dependencies
271+ if : matrix.host == 'macos-latest'
272+ run : |
273+ brew install nasm ninja llvm
255274 - uses : actions/checkout@v3
256275 with :
257276 submodules : " recursive"
258277 - uses : dtolnay/rust-toolchain@master
259278 with :
260279 toolchain : stable
261- target : x86_64-pc-windows-msvc
262- - uses : dtolnay/rust-toolchain@master
263- with :
264- toolchain : stable
265- target : aarch64-pc-windows-msvc
266- - name : Install cargo-xwin and bindgen-cli
267- run : cargo install --locked cargo-xwin bindgen-cli
268- - name : cargo xwin build for `x86_64-pc-windows-msvc`
269- run : cargo xwin build -p aws-lc-rs --release --all-targets --target x86_64-pc-windows-msvc
270- - name : cargo xwin build for `aarch64-pc-windows-msvc`
271- run : cargo xwin build -p aws-lc-rs --release --all-targets --target aarch64-pc-windows-msvc
280+ target : ${{ matrix.target }}
281+ - name : Install cargo-xwin
282+ run : cargo install --locked cargo-xwin
283+ - name : Set RUSTFLAGS
284+ if : contains(matrix.host, 'windows') != true
285+ run : |
286+ if [[ '${{ matrix.crt_static }}' == '1' ]]; then
287+ echo "RUSTFLAGS=-Clink-arg=/WX -Ctarget-feature=+crt-static" >> $GITHUB_ENV
288+ else
289+ echo "RUSTFLAGS=-Clink-arg=/WX" >> $GITHUB_ENV
290+ fi
291+ echo "EXTRA_FLAGS=" >> $GITHUB_ENV
292+ - name : Set RUSTFLAGS
293+ if : contains(matrix.host, 'windows')
294+ run : |
295+ if ('${{ matrix.crt_static }}' -eq '1') {
296+ echo "RUSTFLAGS=-Clink-arg=/WX -Ctarget-feature=+crt-static" | Out-File -FilePath $env:GITHUB_ENV -Append
297+ } else {
298+ echo "RUSTFLAGS=-Clink-arg=/WX" | Out-File -FilePath $env:GITHUB_ENV -Append
299+ }
300+ if ('${{ matrix.host }}' -like '*arm*') {
301+ echo "EXTRA_FLAGS=--features=prebuilt-nasm" | Out-File -FilePath $env:GITHUB_ENV -Append
302+ } else {
303+ echo "EXTRA_FLAGS=" | Out-File -FilePath $env:GITHUB_ENV -Append
304+ }
305+ - name : cargo xwin build for ${{ matrix.target }}
306+ run : cargo xwin build -p aws-lc-rs --release --all-targets --target ${{ matrix.target }} ${{ env.EXTRA_FLAGS }}
307+ - name : cargo test for x86_64-pc-windows-msvc
308+ if : matrix.host == 'windows-latest' && matrix.target == 'x86_64-pc-windows-msvc'
309+ env :
310+ CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUNNER : ' cmd.exe'
311+ run : cargo xwin test -p aws-lc-rs --release --all-targets --target x86_64-pc-windows-msvc ${{ env.EXTRA_FLAGS }}
312+ - name : cargo test for aarch64-pc-windows-msvc
313+ if : matrix.host == 'windows-11-arm' && matrix.target == 'aarch64-pc-windows-msvc'
314+ env :
315+ CARGO_TARGET_AARCH64_PC_WINDOWS_MSVC_RUNNER : ' cmd.exe'
316+ run : cargo xwin test -p aws-lc-rs --release --all-targets --target aarch64-pc-windows-msvc ${{ env.EXTRA_FLAGS }}
272317
273318 aws-lc-rs-windows-msvc :
274319 if : ${{ github.repository_owner == 'aws' }}
0 commit comments