-
-
Notifications
You must be signed in to change notification settings - Fork 56
512 lines (489 loc) · 16.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
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
name: CI
on:
schedule:
- cron: '0 2 * * 0'
push:
branches:
- master
pull_request:
branches:
- master
jobs:
pip:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10']
name: Pip install with Python ${{ matrix.python-version }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install xraylib with pip
run: |
python -m pip install -U numpy pip
python -m pip install . -vv
- name: Test importing xraylib
run: |
python -c "import xraylib"
python -c "import xraylib_np"
visual-studio:
timeout-minutes: 60
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']
compiler:
- cl
- clang-cl
name: Visual Studio with ${{matrix.compiler}} and Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/[email protected]
with:
auto-update-conda: true
channels: conda-forge
python-version: ${{ matrix.python-version }}
- name: Install meson, ninja, numpy and cython
run: |
conda install -q -y meson ninja numpy cython swig
- uses: ilammy/[email protected]
- name: Build with meson
run: |
meson setup meson-build --buildtype=release -Dpython=python -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled
meson compile -C meson-build
meson test -C meson-build
# ninja -v -C meson-build dist
env:
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.compiler }}
msys2:
timeout-minutes: 60
strategy:
matrix:
buildsystem:
- autotools
- 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/[email protected]
# with:
# args: install innosetup lazarus
# required for the lib command
- uses: ilammy/[email protected]
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
automake
autoconf
libtool
make
patch
wget
tar
- uses: actions/checkout@v3
- 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
set +ex
env:
CC: ${{matrix.cc}}
CXX: ${{matrix.cxx}}
- name: Primary build and test with Autotools
if: matrix.buildsystem == 'autotools'
run: |
set -ex
autoreconf -fi
./configure --disable-all-bindings CFLAGS="-std=c89 -pedantic" || (cat config.log && exit 1)
make
make check
make windows
make distclean
./configure --disable-all-bindings --disable-shared --enable-static
make
make check
make distclean
./configure --disable-python --disable-python-numpy --enable-fortran2003 --disable-ruby
make
make check
make distclean
./configure --enable-python --enable-python-numpy PYTHON=python3 --disable-ruby
make
make check
set +ex
env:
CC: ${{matrix.cc}}
CXX: ${{matrix.cxx}}
CYTHON: cython
PYTHON: python3
macos:
timeout-minutes: 60
runs-on: macos-latest
strategy:
matrix:
buildsystem:
- autotools
- meson
compiler:
- llvm
- gcc
include:
- ldflags: ""
# at least some versions of clang cannot compile php bindings
- compiler: llvm
cc: /usr/local/opt/llvm/bin/clang
cxx: /usr/local/opt/llvm/bin/clang++
ldflags: -L/usr/local/opt/llvm/lib
enable_ruby: enable
- compiler: gcc
cc: gcc-11
cxx: g++-11
# -fdeclspec is only supported by llvm's clang!
enable_ruby: disable
steps:
- uses: actions/checkout@v3
- name: Install Homebrew dependencies
run: |
set -ex
rm -f /usr/local/bin/2to3
brew uninstall -f bazel bazelisk mongodb-community
brew update
brew upgrade
brew install git autoconf automake libtool pkg-config python ${{ matrix.compiler }} swig ruby fpc lua perl [email protected] bash numpy meson ninja
set +ex
env:
HOMEBREW_CURL_RETRIES: 5
- name: Install Cython
run: |
/usr/local/bin/pip3 install Cython
- name: Primary Build and test with Meson
if: matrix.buildsystem == 'meson'
run: |
set -ex
meson setup meson-build -Dpython=/usr/local/bin/python3 -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
cd meson-build/meson-dist/
TARBALL=$(ls *.tar.xz)
tar xfJ $TARBALL
cd ${TARBALL%.tar.xz}
autoreconf -fi
./configure --enable-python SHELL=${SHELL} PYTHON=/usr/local/bin/python3
make
make check
set +ex
env:
CC: ${{matrix.cc}}
CXX: ${{matrix.cxx}}
SHELL: /usr/local/bin/bash
- name: Build with Autotools
if: matrix.buildsystem == 'autotools'
run: |
set -ex
autoreconf -fi
# Build without python
./configure --disable-python --disable-python-numpy --enable-perl --enable-lua --enable-pascal --disable-java --enable-php --${{matrix.enable_ruby}}-ruby PHP=/usr/local/opt/[email protected]/bin/php PHP_CONFIG=/usr/local/opt/[email protected]/bin/php-config SHELL=${SHELL} RUBY=/usr/local/opt/ruby/bin/ruby
make
make check || (cat perl/tests/test-suite.log && exit 1)
make distclean
# Build without bindings in ANSI-C
./configure --disable-all-bindings CFLAGS="-std=c89 -pedantic" SHELL=${SHELL}
make
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
make check
make distclean
# Build static library
./configure --disable-all-bindings --disable-shared --enable-static SHELL=${SHELL}
make
make check
make distclean
# Run make distcheck
./configure
make distcheck SHELL=${SHELL} PYTHON=${XRL_PYTHON3} DISTCHECK_CONFIGURE_FLAGS="--${{matrix.enable_ruby}}-ruby" RUBY=/usr/local/opt/ruby/bin/ruby
set +ex
env:
CC: ${{matrix.cc}}
CXX: ${{matrix.cxx}}
SHELL: /usr/local/bin/bash
XRL_PYTHON3: /usr/local/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:focal
- ubuntu:devel
- debian:bullseye
- debian:sid
- centos:7
- rockylinux:8
- fedora:latest
- fedora:rawhide
cc:
- clang
- gcc
buildsystem:
- autotools
- meson
exclude:
- image: ubuntu:focal
buildsystem: meson
- image: centos:7
buildsystem: meson
- image: rockylinux:8
buildsystem: meson
include:
# at least some versions of clang cannot compile php bindings
- cython: cython
perl: enable
fpc: enable
fortran: enable
python: enable
- cc: clang
cxx: clang++
php: disable
- cc: gcc
cxx: g++
php: enable
- cc: clang
image: rockylinux:8
perl: disable
libs: -stdlib=libstdc++
fortran: disable
clang_cflags: -Qunused-arguments
python: disable
- image: centos:7
fpc: disable
cython: cython3.6
- image: centos:7
cc: clang
libs: -stdlib=libstdc++
fortran: disable
clang_cflags: -Qunused-arguments
python: disable
- cc: clang
image: fedora:latest
perl: disable
python: disable
clang_cflags: -Qunused-arguments
- cc: clang
image: fedora:rawhide
perl: disable
python: disable
clang_cflags: -Qunused-arguments
- image: ubuntu:focal
lua: /usr/bin/lua5.3
- image: ubuntu:devel
lua: /usr/bin/lua5.3
- image: debian:bullseye
lua: /usr/bin/lua5.3
- image: debian:sid
lua: /usr/bin/lua5.3
php: disable # comes with PHP 8, unsupported by SWIG
- image: centos:7
lua: /usr/bin/lua
- 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, 'centos') || startsWith(matrix.image, 'fedora')
run: |
set -ex
yum install -y git
set +ex
- uses: actions/checkout@v3
- 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 fpc gfortran gcc php-dev swig libperl-dev perl lua5.3 liblua5.3-dev ruby-dev default-jdk clang
pip3 install Cython
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 CentOS 8 PowerTools and EPEL repo
if: matrix.image == 'rockylinux:8'
run: |
set -ex
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf install -y 'dnf-command(config-manager)'
dnf config-manager --set-enabled powertools
set +ex
- name: Activate CentOS 7 EPEL repo
if: matrix.image == 'centos:7'
run: |
set -ex
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install -y python36-Cython # this one needs to be brought in separately for CentOS 7
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-Cython python3-setuptools python3-devel python3-numpy fpc gcc-gfortran gcc php-devel swig perl-devel perl perl-Test-Simple 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 rpm-build rpmdevtools lua-srpm-macros perl-macros
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:
CYTHON: ${{matrix.cython}}
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 --${PERL_ENABLE}-perl --enable-lua --${FPC_ENABLE}-pascal --disable-java --${PHP_ENABLE}-php --enable-ruby --${FORTRAN_ENABLE}-fortran2003 || (cat config.log && exit 1)
make
make check || (cat example/xrlexample12.sh.log && exit 1)
make distclean
./configure --disable-all-bindings CFLAGS="-std=c89 -pedantic $CFLAGS"
make
make check
make distclean
./configure --disable-ruby --disable-perl --disable-lua --disable-fortran2003 --${PYTHON_ENABLE}-python-numpy --${PYTHON_ENABLE}-python PYTHON=${XRL_PYTHON3}
make
make check
make distclean
./configure --disable-all-bindings --disable-shared --enable-static
make
make check
make distclean
./configure --disable-all-bindings
make distcheck PYTHON=${XRL_PYTHON3}
set +ex
env:
CYTHON: ${{matrix.cython}}
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
PHP_ENABLE: ${{matrix.php}}
PYTHON_ENABLE: ${{matrix.python}}
FORTRAN_ENABLE: ${{matrix.fortran}}
PERL_ENABLE: ${{matrix.perl}}
FPC_ENABLE: ${{matrix.fpc}}
DISTCHECK_CONFIGURE_FLAGS: --${{matrix.fpc}}-pascal --enable-java --${{matrix.perl}}-perl --enable-lua --${{matrix.python}}-python --${{matrix.python}}-python-numpy --${{matrix.php}}-php --enable-ruby --${{matrix.fortran}}-fortran2003
CFLAGS: ${{matrix.clang_cflags}}
- name: Test rpm-build
if: matrix.buildsystem == 'autotools' && (startsWith(matrix.image, 'centos') || startsWith(matrix.image, 'fedora') || startswith(matrix.image, 'rockylinux'))
run: |
set -ex
rpmdev-setuptree
cp xraylib-*.tar.gz ~/rpmbuild/SOURCES
cp xraylib.spec ~/rpmbuild/SPECS
rpmbuild -ba ~/rpmbuild/SPECS/xraylib.spec
set +ex