-
-
Notifications
You must be signed in to change notification settings - Fork 56
407 lines (392 loc) · 13.2 KB
/
ci.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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
name: CI
on:
schedule:
- cron: '0 2 * * 0'
push:
branches:
- master
pull_request:
branches:
- master
jobs:
visual-studio:
timeout-minutes: 60
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
compiler:
- cl
- clang-cl
name: Visual Studio with ${{matrix.compiler}} and Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install meson, ninja, numpy and cython
run: |
python -m pip install -U numpy pip
python -m pip install meson ninja cython
- uses: ilammy/msvc-dev-cmd@v1
- name: Build with meson
run: |
meson setup meson-build --buildtype=release -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled -Dfortran-bindings=disabled
meson compile -C meson-build
meson test -C meson-build || (cat meson-build\meson-logs\testlog.txt)
# ninja -v -C meson-build dist
env:
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.compiler }}
msys2:
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
buildsystem:
- meson
cc:
- clang
- gcc
include:
- cc: clang
cxx: clang++
- cc: gcc
cxx: g++
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: crazy-max/ghaction-chocolatey@v3
with:
args: install innosetup
# required for the lib command
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- uses: msys2/setup-msys2@v2
with:
path-type: inherit
update: true
install: >
base-devel
git
mingw-w64-x86_64-gcc
mingw-w64-x86_64-gcc-fortran
mingw-w64-x86_64-libxml2
mingw-w64-x86_64-clang
mingw-w64-x86_64-openmp
mingw-w64-x86_64-lld
mingw-w64-x86_64-pkg-config
mingw-w64-x86_64-curl
mingw-w64-x86_64-cython
mingw-w64-x86_64-python3-numpy
mingw-w64-x86_64-meson
mingw-w64-x86_64-swig
- uses: actions/checkout@v4
- name: Primary build and test with Meson
if: matrix.buildsystem == 'meson'
run: |
set -ex
meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled -Dwindows-installer=enabled
meson compile -C meson-build
meson test -C meson-build || (cat meson-build/meson-logs/testlog.txt && exit 1)
set +ex
env:
CC: ${{matrix.cc}}
CXX: ${{matrix.cxx}}
- name: Upload Windows installer
if: matrix.buildsystem == 'meson' && matrix.cc == 'gcc'
uses: actions/upload-artifact@v4
with:
name: windows-installer
path: meson-build\windows\xraylib-*-win64.exe
retention-days: 1
macos:
timeout-minutes: 60
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
buildsystem:
- meson
compiler:
- llvm
- gcc@14
include:
- ldflags: "-Wl,-ld_classic"
- compiler: llvm
cc: /opt/homebrew/opt/llvm/bin/clang
cxx: /opt/homebrew/opt/llvm/bin/clang++
# ldflags: -L/opt/homebrew/opt/llvm/lib
enable_ruby: enable
- compiler: gcc@14
cc: gcc-14
cxx: g++-14
# -fdeclspec is only supported by llvm's clang!
enable_ruby: disable
steps:
- uses: actions/checkout@v4
- name: Install Homebrew dependencies
run: |
set -ex
rm -f /opt/homebrew/bin/2to3
brew uninstall -f bazel bazelisk mongodb-community
brew update
brew upgrade
brew install git autoconf automake libtool pkg-config ${{ matrix.compiler }} swig ruby fpc lua bash numpy meson ninja cython
brew link --overwrite python
brew unlink python && brew link --overwrite python
ls -l /opt/homebrew/bin/python3
echo "/opt/homebrew/opt/cython/bin" >> "${GITHUB_PATH}"
set +ex
env:
HOMEBREW_CURL_RETRIES: 5
- name: Primary Build and test with Meson
if: matrix.buildsystem == 'meson'
run: |
set -ex
meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled
meson compile -C meson-build
meson test -C meson-build
meson dist -C meson-build
set +ex
env:
CC: ${{matrix.cc}}
CXX: ${{matrix.cxx}}
LDFLAGS: ${{matrix.ldflags}}
- name: Secondary build with Autotools
if: matrix.buildsystem == 'meson'
run: |
set -ex
export SHELL="$(which bash)"
cd meson-build/meson-dist/
TARBALL=$(ls *.tar.xz)
tar xfJ $TARBALL
cd ${TARBALL%.tar.xz}
autoreconf -fi
./configure --enable-python SHELL=${SHELL} PYTHON=/opt/homebrew/bin/python3
make -j$(nproc)
make check
set +ex
env:
CC: ${{matrix.cc}}
CXX: ${{matrix.cxx}}
LDFLAGS: ${{matrix.ldflags}}
- name: Build with Autotools
if: matrix.buildsystem == 'autotools'
run: |
set -ex
export SHELL="$(which bash)"
autoreconf -fi
# Build without python
./configure --disable-python --disable-python-numpy --disable-perl --enable-lua --enable-pascal --disable-java --disable-php --${{matrix.enable_ruby}}-ruby SHELL=${SHELL} RUBY=/opt/homebrew/opt/ruby/bin/ruby
make -j$(nproc)
make check
make distclean
# Build without bindings in ANSI-C
./configure --disable-all-bindings CFLAGS="-std=c89 -pedantic" SHELL=${SHELL}
make -j$(nproc)
make check
make distclean
# Build with Python3 bindings
./configure --disable-ruby --disable-perl --disable-lua --enable-python-numpy --enable-python PYTHON=${XRL_PYTHON3} SHELL=${SHELL}
make -j$(nproc)
make check
make distclean
# Build static library
./configure --disable-all-bindings --disable-shared --enable-static SHELL=${SHELL}
make -j$(nproc)
make check
make distclean
# Run make distcheck
./configure
make distcheck SHELL=${SHELL} PYTHON=${XRL_PYTHON3} DISTCHECK_CONFIGURE_FLAGS="--${{matrix.enable_ruby}}-ruby" RUBY=/opt/homebrew/opt/ruby/bin/ruby
set +ex
env:
CC: ${{matrix.cc}}
CXX: ${{matrix.cxx}}
LDFLAGS: ${{matrix.ldflags}}
XRL_PYTHON3: /opt/homebrew/bin/python3
- name: Secondary build with Meson
if: matrix.buildsystem == 'autotools'
run: |
set -ex
export PATH=${HOME}/.local/bin:${PATH}
TARBALL=$(ls *.tar.gz)
tar xfz $TARBALL
cd ${TARBALL%.tar.gz}
meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled
meson compile -C meson-build
set +ex
env:
CC: ${{matrix.cc}}
CXX: ${{matrix.cxx}}
LDFLAGS: ${{matrix.ldflags}}
linux:
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
image:
- ubuntu:jammy
- debian:bookworm
- rockylinux:9
- fedora:latest
cc:
- clang
- gcc
buildsystem:
- autotools
- meson
exclude:
# there's some weird segfault
- image: rockylinux:8
buildsystem: autotools
cc: clang
include:
- cc: gcc
cxx: g++
- cc: clang
cxx: clang++
- fpc: enable
fortran: enable
python: enable
# - cc: clang
# image: rockylinux:8
# libs: -stdlib=libstdc++
# fortran: disable
# clang_cflags: -Qunused-arguments
# python: enable
- cc: clang
image: fedora:latest
python: disable
clang_cflags: -Qunused-arguments
- image: rockylinux:8
lua: /usr/bin/lua
- image: fedora:latest
lua: /usr/bin/lua
runs-on: ubuntu-latest
container:
image: ${{ matrix.image }}
steps:
- name: Install Git
if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian')
run: |
set -ex
apt-get --yes --force-yes update
apt-get --yes --force-yes install git
set +ex
env:
DEBIAN_FRONTEND: noninteractive
- name: Install Git
if: startsWith(matrix.image, 'rockylinux') || startsWith(matrix.image, 'fedora')
run: |
set -ex
yum install -y git
set +ex
- uses: actions/checkout@v4
- name: Install ubuntu dependencies
if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian')
run: |
set -ex
apt-get --yes --force-yes update
apt-get --yes --force-yes install autoconf automake libtool python3-pip python3-all-dev python3-numpy cython3 fpc gfortran gcc swig lua5.3 liblua5.3-dev ruby-dev default-jdk clang
set +ex
env:
DEBIAN_FRONTEND: noninteractive
- name: Install ubuntu dependencies Meson and Ninja
if: matrix.buildsystem == 'meson' && (startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian'))
run: |
set -ex
apt-get --yes --force-yes install meson ninja-build
set +ex
env:
DEBIAN_FRONTEND: noninteractive
- name: Activate RockyLinux 8 PowerTools and EPEL repo
if: matrix.image == 'rockylinux:8'
run: |
set -ex
dnf install -y 'dnf-command(config-manager)'
dnf config-manager --set-enabled powertools
dnf install -y epel-release
set +ex
- name: Activate RockyLinux 9 PowerTools and EPEL repo
if: matrix.image == 'rockylinux:9'
run: |
set -ex
dnf install -y 'dnf-command(config-manager)'
dnf config-manager --set-enabled crb
dnf install -y epel-release
set +ex
- name: Install RHEL dependencies
if: startsWith(matrix.image, 'centos') || startsWith(matrix.image, 'fedora') || startsWith(matrix.image, 'rockylinux')
run: |
set -ex
yum update -y
yum install -y make autoconf automake libtool python3-setuptools python3-devel python3-numpy python3-Cython fpc gcc-gfortran gcc swig lua lua-devel ruby ruby-devel rubygem-minitest rubygem-test-unit java-1.8.0-openjdk java-1.8.0-openjdk-devel clang libstdc++-devel gcc-c++ which
java -version
which java
javac -version
which javac
set +ex
- name: Install RHEL dependencies Meson and Ninja
if: matrix.buildsystem == 'meson' && (startsWith(matrix.image, 'centos') || startsWith(matrix.image, 'fedora') || startsWith(matrix.image, 'rockylinux'))
run: |
set -ex
yum install -y meson ninja-build
set +ex
- name: Build and test with Meson
if: matrix.buildsystem == 'meson'
run: |
set -ex
git config --global --add safe.directory /__w/xraylib/xraylib
meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled
meson compile -C meson-build
meson test -C meson-build
meson dist -C meson-build
set +ex
env:
CC: ${{matrix.cc}}
CXX: ${{matrix.cxx}}
# LIBS: ${{matrix.libs}}
- name: Build and test with Autotools
if: matrix.buildsystem == 'autotools'
run: |
set -ex
autoreconf -fi
# disable java for now
./configure --disable-python --disable-python-numpy --disable-perl --enable-lua --${FPC_ENABLE}-pascal --disable-java --disable-php --enable-ruby --${FORTRAN_ENABLE}-fortran2003 || (cat config.log && exit 1)
make -j$(nproc)
make check || (cat example/xrlexample12.sh.log && exit 1)
make distclean
./configure --disable-all-bindings CFLAGS="-std=c89 -pedantic $CFLAGS"
make -j$(nproc)
make check
make distclean
./configure --disable-ruby --disable-perl --disable-lua --disable-fortran2003 --${PYTHON_ENABLE}-python-numpy --${PYTHON_ENABLE}-python PYTHON=${XRL_PYTHON3}
make -j$(nproc)
make check || (cat example/xrlexample13.sh.log && exit 1)
make distclean
./configure --disable-all-bindings --disable-shared --enable-static
make -j$(nproc)
make check
make distclean
./configure --disable-all-bindings
make distcheck PYTHON=${XRL_PYTHON3}
set +ex
env:
CC: ${{matrix.cc}}
CXX: ${{matrix.cxx}}
CXXFLAGS: -std=c++11
# LIBS: ${{matrix.libs}}
XRL_PYTHON3: /usr/bin/python3
LUA: ${{matrix.lua}}
JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
PYTHON_ENABLE: ${{matrix.python}}
FORTRAN_ENABLE: ${{matrix.fortran}}
FPC_ENABLE: ${{matrix.fpc}}
DISTCHECK_CONFIGURE_FLAGS: --${{matrix.fpc}}-pascal --enable-java --disable-perl --enable-lua --${{matrix.python}}-python --${{matrix.python}}-python-numpy --disable-php --enable-ruby --${{matrix.fortran}}-fortran2003
CFLAGS: ${{matrix.clang_cflags}}