forked from swig/swig
-
Notifications
You must be signed in to change notification settings - Fork 0
325 lines (285 loc) · 9.6 KB
/
windows.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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
name: windows
on:
push:
paths-ignore:
- 'CHANGES*'
- 'Doc/**'
- 'appveyor.yml'
pull_request:
branches: master
paths-ignore:
- 'CHANGES*'
- 'Doc/**'
- 'appveyor.yml'
permissions:
contents: read
jobs:
win_ci:
# When continue-on-error is true for an individual build,
# that build can fail (it'll show red),
# but it won't fail the overall tests
continue-on-error: ${{ matrix.continue-on-error || false }}
# https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md
runs-on: ${{ matrix.os || 'windows-2022' }}
# The name of the test follow the tested language
name: >
${{ matrix.SWIGLANG }} ${{ matrix.VER }}
${{ matrix.COMPILER || 'msvc' }} ${{ matrix.os }} ${{ matrix.NOTEST }}
${{ matrix.continue-on-error && '(can fail)' }}
strategy:
matrix:
include:
- SWIGLANG: csharp
INSTALL: 'true'
- SWIGLANG: csharp
os: 'windows-2019'
- SWIGLANG: csharp
COMPILER: gcc
- SWIGLANG: csharp
INSTALL: 'true'
COMPILER: gcc
os: 'windows-2019'
- SWIGLANG: java
VER: 8
- SWIGLANG: java
VER: 17
- SWIGLANG: java
COMPILER: gcc
VER: 8
- SWIGLANG: java
COMPILER: gcc
VER: 11
# Next two are using old VC++ as the new visual c++ not handling containers of enums
# See https://github.com/swig/swig/issues/3008
- SWIGLANG: python
VER: '3.7'
os: 'windows-2019'
- SWIGLANG: python
VER: '3.12'
os: 'windows-2019'
# TODO require fixing of probing in configure.ac
#- SWIGLANG: python
# INSTALL: 'true'
# COMPILER: gcc
# NOTEST: 'no-test'
- SWIGLANG: ruby
# VER: '3.0.7'
NOTEST: 'no-test'
- SWIGLANG: ruby
VER: '3.1.6'
NOTEST: 'no-test'
- SWIGLANG: ruby
INSTALL: 'true'
COMPILER: gcc
NOTEST: 'no-test'
# Run all of them, as opposed to aborting when one fails
fail-fast: false
env:
CFLAGS: '-O2'
CXXFLAGS: '-O2'
CCCL_OPTIONS: '--cccl-muffle /W3 /EHsc'
PCRE2_CCCL_LD: '-lpcre2-8-static --cccl-link /NODEFAULTLIB:MSVCRT'
CHECK_OPTIONS: 'CSHARPOPTIONS=-platform:x64'
SWIGLANG: ${{ matrix.SWIGLANG }}
COMPILER: ${{ matrix.COMPILER }}
INSTALL: ${{ matrix.INSTALL }}
NOTEST: ${{ matrix.NOTEST }}
VER: ${{ matrix.VER }}
OS: ${{ matrix.os }}
# cl.exe:
# https://learn.microsoft.com//cpp/build/reference/compiler-options
# /EHc extern "C" defaults to nothrow.
# /EHs Enable C++ exception handling (no SEH exceptions).
# /W3 Warning level.
# /WX Treat warnings as errors.
# https://learn.microsoft.com//cpp/build/reference/linker-options
# cl.exe pass linker:
# /VERBOSE:LIB Outputs progress messages during the link process.
# /NODEFAULTLIB:lib Ignore library 'lib'
steps:
- name: Machine Info
shell: powershell
run: |
systeminfo | findstr /B /C:"OS Name" /B /C:"OS Version"
- name: Checkout
uses: actions/checkout@v4
with:
show-progress: true
- name: Install CCache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ matrix.os || 'windows-2022' }}-${{ matrix.COMPILER || 'msvc' }}
- name: Install NuGet Packages
if: ${{ env.COMPILER == '' }}
shell: powershell
run: |
# 'nuget build for .NET: https://www.nuget.org/packages'
nuget install PCRE2 -OutputDirectory C:\Tools
nuget install boost -OutputDirectory C:\Tools
# Set MSVC compilers path and environment variables.
- name: Setup MSVC
if: ${{ env.COMPILER == '' || env.SWIGLANG == 'csharp' }}
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x64
- name: Prepare Environment
shell: bash
run: |
uname --all
if [[ "$COMPILER" = "gcc" ]]; then
# MinGW-w64 packages to install with MSYS2
for n in binutils make autotools pcre2 boost; do
MORE_MSYS_PKGS+=" mingw-w64-x86_64-$n"
done
case "$SWIGLANG" in
python)
MORE_MSYS_PKGS+=" mingw-w64-x86_64-python"
;;
ruby)
MORE_MSYS_PKGS+=" mingw-w64-x86_64-ruby"
;;
perl)
MORE_MSYS_PKGS+=" mingw-w64-x86_64-perl"
;;
esac
# MinGW-w64 pcre2
echo "PCRE2_CFLAGS=-I/mingw64/include -DPCRE2_STATIC" >> $GITHUB_ENV
echo "PCRE2_LIBS=-L/mingw64/lib -lpcre2-8" >> $GITHUB_ENV
echo "MORE_MSYS_PKGS=base-devel $MORE_MSYS_PKGS" >> $GITHUB_ENV
echo "BOOST_PATH=/c/msys64/mingw64" >> $GITHUB_ENV
else
# COMPILER: cccl wrapping MSVC
curl --retry 15 -s -L https://github.com/swig/cccl/raw/master/cccl > /usr/bin/cccl
chmod +x /usr/bin/cccl
cp -p /usr/bin/cccl /c/msys64/usr/bin/cccl
# Using pcre2 installed with NuGet
PCRE2_PATH=$(ls -d /c/tools/PCRE2*)
echo "PCRE2_CFLAGS=-I$PCRE2_PATH/include -DPCRE2_STATIC" >> $GITHUB_ENV
echo "PCRE2_LIBS=-L$PCRE2_PATH/lib $PCRE2_CCCL_LD" >> $GITHUB_ENV
echo "CXX=/usr/bin/cccl" >> $GITHUB_ENV
echo "CC=/usr/bin/cccl" >> $GITHUB_ENV
echo "BOOST_PATH=$(ls -d /c/tools/boost*)/lib/native" >> $GITHUB_ENV
if [[ -n "$VER" ]]; then
case "$SWIGLANG" in
python)
PY3VER=$(cygpath -w $(ls -d /c/hostedtoolcache/windows/Python/$VER*)/x64)
echo "$PY3VER\\Script" >> $GITHUB_PATH
echo "$PY3VER" >> $GITHUB_PATH
;;
ruby)
RUBYDIR=$(cygpath -w $(ls -d /c/hostedtoolcache/windows/Ruby/$VER*)/x64)
echo "$RUBYDIR\\bin" >> $GITHUB_PATH
;;
esac
fi
fi # COMPILER
# Java must use VER!
if [[ "$SWIGLANG" = "java" ]]; then
declare -n java_path="JAVA_HOME_${VER}_X64"
echo "JAVA_HOME=$java_path" >> $GITHUB_ENV
fi
echo "SWIGJOBS=-j$NUMBER_OF_PROCESSORS" >> $GITHUB_ENV
echo 'C:\msys64\usr\bin' >> $GITHUB_PATH
- name: Install MSYS2 Packages
shell: cmd
run: |
rem 'MSYS2 uses MinGW-w64 https://packages.msys2.org/'
pacman -Syu --noconfirm --needed
if %ErrorLevel% NEQ 0 (exit 1)
pacman -Syu --noconfirm --needed autoconf automake bison %MORE_MSYS_PKGS%
if %ErrorLevel% NEQ 0 (exit 1)
- name: Autoconf
shell: bash
run: |
uname --all
if [[ -z "$COMPILER" ]]; then
which cl.exe
cl.exe /? 2>&1 | head -n1
else
# Use MinGW-w64 compiler
# We can not use GITHUB_PATH, as bash insert /usr/bin
export PATH="/mingw64/bin:$PATH"
which gcc
gcc --version | head -n1
which g++
g++ --version | head -n1
fi
case "$SWIGLANG" in
csharp)
which csc.exe
csc.exe /? | head -n1
;;
python)
which python.exe
python -V
;;
ruby)
which ruby.exe
ruby -v
;;
perl)
which perl.exe
perl -v | head -n3
;;
esac
make --version | head -n2
./autogen.sh
- name: Configure
shell: bash
run: |
if [[ "$COMPILER" = "gcc" ]]; then
# Use MinGW-w64 compiler
export PATH="/mingw64/bin:$PATH"
./configure --disable-dependency-tracking --with-boost="$BOOST_PATH" --with-csharp-compiler="csc.exe"
else
# cccl wrapping MSVC
./configure --disable-dependency-tracking --with-boost="$BOOST_PATH" --with-csharp-compiler="csc.exe" --disable-ccache
fi
- name: Build
shell: bash
run: |
if [[ "$COMPILER" = "gcc" ]]; then
# Use MinGW-w64 compiler
export PATH="/mingw64/bin:$PATH"
fi
make -s $SWIGJOBS
# Test the Windows swig have a proper SWIG library path
- name: Test swiglib
shell: bash
run: |
# path is based on executable location
if ! [[ "$(./swig.exe -swiglib)" = "$(cygpath -w "$PWD")\\Lib" ]]; then
exit 1
fi
- name: Test
if: ${{ matrix.NOTEST == '' }}
shell: bash
run: |
if [[ "$COMPILER" = "gcc" ]]; then
# Use MinGW-w64 compiler
export PATH="/mingw64/bin:$PATH"
fi
./swig.exe -version
make check-$SWIGLANG-version
make check-$SWIGLANG-enabled
make -k check-$SWIGLANG-examples $SWIGJOBS $CHECK_OPTIONS
make -k check-$SWIGLANG-test-suite $SWIGJOBS $CHECK_OPTIONS
- name: Install
if: ${{ env.INSTALL == 'true' }}
shell: bash
run: |
make -s install > /dev/null
which swig.exe
swig.exe -version
# TODO: Make install of ccache-swig do not work on Windows
#if [[ "$COMPILER" = "gcc" ]]; then
# which ccache-swig.exe
# ccache-swig.exe -V
#fi
# The test by itself is not related to the installation.
# We just want to save testing time :-)
- name: Clean
if: ${{ env.INSTALL == 'true' }}
shell: bash
run: |
make check-maintainer-clean