-
Notifications
You must be signed in to change notification settings - Fork 183
297 lines (296 loc) · 10.8 KB
/
windows-alt.yml
File metadata and controls
297 lines (296 loc) · 10.8 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
name: Windows Alternative Compilers
on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
permissions:
contents: read
jobs:
mingw:
if: github.repository_owner == 'aws'
runs-on: windows-latest
steps:
- name: Install NASM
uses: ilammy/setup-nasm@v1.5.1
- name: Checkout
uses: actions/checkout@v6
with:
path: "path has spaces/aws-lc"
- name: Setup MinGW
uses: egor-tensin/setup-mingw@v3
id: setup_mingw
with:
static: 0
- name: Setup CMake
uses: threeal/cmake-action@v2.1.0
with:
generator: Ninja
source-dir: 'path has spaces/aws-lc'
build-dir: 'path has spaces/build'
c-compiler: ${{ steps.setup_mingw.outputs.gcc }}
cxx-compiler: ${{ steps.setup_mingw.outputs.gxx }}
options: |
CMAKE_SYSTEM_NAME=Windows
CMAKE_SYSTEM_PROCESSOR=x86_64
CMAKE_BUILD_TOOL=C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin/ninja.exe
CMAKE_FIND_ROOT_PATH=C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
CMAKE_BUILD_TYPE=Release
- name: Build Project
run: cmake --build "path has spaces/build" --target all
- name: Run tests
run: cmake --build "path has spaces/build" --target run_tests
clang:
if: github.repository_owner == 'aws'
runs-on: windows-latest
steps:
- name: Install NASM
uses: ilammy/setup-nasm@v1.5.1
- name: Checkout
uses: actions/checkout@v6
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v2
id: clang
with:
version: 19
env: true
- name: Setup CMake
uses: threeal/cmake-action@v2.1.0
with:
generator: Ninja
c-compiler: "C:/Program Files/LLVM/bin/clang.exe"
cxx-compiler: "C:/Program Files/LLVM/bin/clang++.exe"
options: |
CMAKE_SYSTEM_NAME=Windows
CMAKE_SYSTEM_PROCESSOR=x86_64
CMAKE_BUILD_TYPE=Release
- name: Build Project
run: cmake --build ./build --target all
- name: Run tests
run: cmake --build ./build --target run_tests
clang-cl-msbuild:
if: github.repository_owner == 'aws'
strategy:
fail-fast: false
matrix:
target:
- x64
- x64_arm64
runs-on: windows-latest
env:
CMAKE_GENERATOR: "Visual Studio 17 2022"
CMAKE_GENERATOR_TOOLSET: "ClangCL,host=x64"
steps:
- if: ${{ matrix.target == 'x64' }}
name: Install NASM
uses: ilammy/setup-nasm@v1.5.1
- name: Checkout
uses: actions/checkout@v6
- uses: TheMrMilchmann/setup-msvc-dev@v4
with:
arch: ${{ matrix.target }}
- if: ${{ matrix.target == 'x64' }}
name: Setup CMake
uses: threeal/cmake-action@v2.1.0
with:
options: |
CMAKE_BUILD_TYPE=Release
- if: ${{ matrix.target == 'x64_arm64' }}
name: Setup CMake
uses: threeal/cmake-action@v2.1.0
with:
options: |
CMAKE_GENERATOR_PLATFORM=ARM64
CMAKE_SYSTEM_NAME=Windows
CMAKE_SYSTEM_PROCESSOR=ARM64
CMAKE_BUILD_TYPE=Release
- name: Build Project
run: cmake --build ./build --target all_tests
- if: ${{ matrix.target == 'x64' }}
name: Run tests
run: cmake --build ./build --target run_tests
clang-cl-ninja:
if: github.repository_owner == 'aws'
strategy:
fail-fast: false
matrix:
target:
- x64
- x64_arm64
runs-on: windows-latest
steps:
- if: ${{ matrix.target == 'x64' }}
name: Install NASM
uses: ilammy/setup-nasm@v1.5.1
- name: Remove wrong clang-cl.exe
run: rm "C:/Program Files/LLVM/bin/clang-cl.exe"
- name: Checkout
uses: actions/checkout@v6
- uses: TheMrMilchmann/setup-msvc-dev@v4
with:
arch: ${{ matrix.target }}
- if: ${{ matrix.target == 'x64' }}
name: Setup CMake
uses: threeal/cmake-action@v2.1.0
with:
generator: Ninja
c-compiler: clang-cl
cxx-compiler: clang-cl
options: |
CMAKE_BUILD_TYPE=Release
- if: ${{ matrix.target == 'x64_arm64' }}
name: Setup CMake
uses: threeal/cmake-action@v2.1.0
with:
generator: Ninja
c-compiler: clang-cl
cxx-compiler: clang-cl
options: |
CMAKE_SYSTEM_NAME=Windows
CMAKE_SYSTEM_PROCESSOR=ARM64
CMAKE_C_COMPILER_TARGET=arm64-pc-windows-msvc
CMAKE_ASM_COMPILER_TARGET=arm64-pc-windows-msvc
CMAKE_CXX_COMPILER_TARGET=arm64-pc-windows-msvc
CMAKE_BUILD_TYPE=Release
- name: Build Project
run: cmake --build ./build --target all
- if: ${{ matrix.target == 'x64' }}
name: Run tests
run: cmake --build ./build --target run_tests
- if: ${{ matrix.target == 'x64' }}
name: Setup Go (for FIPS)
uses: actions/setup-go@v6
with:
go-version: '>=1.20'
- if: ${{ matrix.target == 'x64' }}
name: Build and test with FIPS
run: |
cmake -GNinja -B ./build-fips -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_BUILD_TYPE=Release -DFIPS=1 -DBUILD_SHARED_LIBS=1
cmake --build ./build-fips
$buildFips = (Resolve-Path ./build-fips).Path
$env:PATH = "$buildFips;$buildFips\crypto;$buildFips\ssl;$env:PATH"
cmake --build ./build-fips --target run_tests
cross-mingw:
if: github.repository_owner == 'aws'
runs-on: ubuntu-22.04
steps:
- name: Install Tools
run: |
set -ex
sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none
sudo apt-get install --assume-yes --no-install-recommends software-properties-common
sudo add-apt-repository --yes ppa:longsleep/golang-backports
sudo dpkg --add-architecture i386
sudo mkdir -pm755 /etc/apt/keyrings
sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none
sudo apt-get install --assume-yes --no-install-recommends build-essential cmake golang-go nasm clang wget mingw-w64
sudo apt-get install --assume-yes --install-recommends winehq-stable wine-binfmt
sudo update-binfmts --display
sudo update-binfmts --disable
sudo update-binfmts --enable wine
sudo update-binfmts --display
sudo rm -rf /tmp/*
- uses: actions/checkout@v6
- name: x86_64-w64-mingw32 Build/Test
run:
./tests/ci/run_cross_mingw_tests.sh x86_64 w64-mingw32 "-DCMAKE_BUILD_TYPE=Release"
cross-clang-cl-ninja:
# Cross-compile from Linux to x86_64-pc-windows-msvc with Ninja + clang-cl,
# mirroring the default aws-lc-rs setup. This catches command-line quoting
# regressions the Windows-native clang-cl-ninja job misses because cmd.exe
# and /bin/sh tokenize arguments differently (see aws/aws-lc-rs#981).
if: github.repository_owner == 'aws'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Setup toolchain
run: |
set -ex
sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none
sudo apt-get install --assume-yes --no-install-recommends \
cmake ninja-build nasm \
wget lsb-release software-properties-common gnupg
# Clang 19 (xwin's MSVC STL headers require Clang >= 19; 24.04 ships 18).
wget -qO- https://apt.llvm.org/llvm.sh | sudo bash -s -- 19
sudo ln -sf /usr/bin/clang-19 /usr/local/bin/clang-cl
sudo ln -sf /usr/bin/lld-19 /usr/local/bin/lld-link
sudo ln -sf /usr/bin/llvm-ar-19 /usr/local/bin/llvm-lib
sudo ln -sf /usr/bin/llvm-rc-19 /usr/local/bin/llvm-rc
sudo ln -sf /usr/bin/llvm-mt-19 /usr/local/bin/llvm-mt
# xwin provides the MSVC SDK headers/libs for cross-compiling.
XWIN_VERSION=0.6.5
wget -qO- https://github.com/Jake-Shadle/xwin/releases/download/${XWIN_VERSION}/xwin-${XWIN_VERSION}-x86_64-unknown-linux-musl.tar.gz | tar xz
sudo mv xwin-${XWIN_VERSION}-x86_64-unknown-linux-musl/xwin /usr/local/bin/
xwin --accept-license --arch x86_64 splat --output /tmp/xwin
- name: Build
run: |
set -ex
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=util/x86_64-windows-clang-cl-toolchain.cmake
cmake --build build --target all
msys2:
name: msys2 ${{ matrix.sys }} - ${{ matrix.generator }}
if: github.repository_owner == 'aws'
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
sys:
- mingw64
- ucrt64
- clang64
generator:
- 'Ninja'
- 'MinGW Makefiles'
- 'MSYS Makefiles'
steps:
- name: Install MSYS2
uses: msys2/setup-msys2@v2
id: setup_msys2
with:
msystem: ${{ matrix.sys }}
update: true
pacboy: >-
cmake
toolchain
llvm
rust
rust-bindgen
ninja
cc
go
nasm
- name: Update Environment
shell: bash
run: |
SYSROOT=$(cygpath -a -m '${{ steps.setup_msys2.outputs.msys2-location }}\${{ matrix.sys }}')
echo "GOPATH=${SYSROOT}" >> $GITHUB_ENV
echo "GOROOT=${SYSROOT}/lib/go" >> $GITHUB_ENV
echo "CMAKE_GENERATOR=${{ matrix.generator }}" >> $GITHUB_ENV
cygpath -m ${SYSROOT}/bin >> $GITHUB_PATH
- name: Checkout
uses: actions/checkout@v6
- name: Setup CMake
uses: threeal/cmake-action@v2.1.0
with:
build-dir: ./build
options: |
CMAKE_SYSTEM_NAME=Windows
CMAKE_SYSTEM_PROCESSOR=x86_64
CMAKE_FIND_ROOT_PATH='${{ steps.setup_msys2.outputs.msys2-location }}\${{ matrix.sys }}\'
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
CMAKE_BUILD_TYPE=Release
- name: Run tests
shell: 'msys2 {0}'
run: cmake --build ./build --target run_tests