-
Notifications
You must be signed in to change notification settings - Fork 60
183 lines (154 loc) · 6.71 KB
/
tests-external-cfitsio.yml
File metadata and controls
183 lines (154 loc) · 6.71 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
name: tests-external-cfitsio
on:
push:
branches:
- master
pull_request: null
env:
PY_COLORS: "1"
# These compiler flags force the tests to fail if arrays are
# accessed at the C level from an unaligned location.
TEST_CFLAGS: "-fsanitize=alignment -fno-sanitize-recover=alignment"
LATEST_CFITSIO_VER: "-4.6.3"
defaults:
run:
shell: bash -leo pipefail {0}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests-external-cfitsio:
name: tests-external-cfitsio
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
config:
# 3.44 is the last version that did not support uint64
- { pyver: "3.9", npver: "1", cftsver: "3440", doslow: "", ft: "", cf: ""}
# python 3 string writing fails on all 3.* builds
# so test first 4.* release
- { pyver: "3.9", npver: "1", cftsver: "-4.0.0", doslow: "", ft: "", cf: ""}
# 4.1.0 is the first version for which tests pass for uint64
- { pyver: "3.9", npver: "1", cftsver: "-4.1.0", doslow: "", ft: "", cf: ""}
# 4.4.0 is first version for which tests pass for compressed
# binary tables that exceed 2**32 bytes
- { pyver: "3.9", npver: "1", cftsver: "-4.4.0", doslow: "--slow", ft: "", cf: ""}
- { pyver: "3.9", npver: "1", cftsver: "latest", doslow: "--slow", ft: "", cf: ""}
- { pyver: "3.14", npver: "2", cftsver: "latest", doslow: "--slow", ft: "python-gil", cf: "--enable-reentrant"}
- { pyver: "3.14", npver: "2", cftsver: "latest", doslow: "--slow", ft: "python-freethreading", cf: ""}
- { pyver: "3.14", npver: "2", cftsver: "latest", doslow: "--slow", ft: "python-freethreading", cf: "--enable-reentrant"}
runs-on: ${{ matrix.os }}
env:
PIP_OPTIONS: "--no-cache-dir --no-deps --no-build-isolation -v"
steps:
- name: free disk space
if: matrix.os == 'ubuntu-latest'
uses: endersonmenezes/free-disk-space@v3
with:
remove_android: true
remove_dotnet: true
remove_haskell: true
rm_cmd: "rmz"
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
fetch-tags: true
- uses: mamba-org/setup-micromamba@add3a49764cedee8ee24e82dfde87f5bc2914462 #v2.0.7
with:
environment-name: fitsio-dev
environment-file: environment.yml
condarc: |
channels:
- conda-forge
show_channel_urls: true
channel_priority: strict
always_yes: true
create-args: >-
python=${{ matrix.config.pyver }}
numpy=${{ matrix.config.npver }}
${{ matrix.config.ft }}
- name: set parallel testing flags
run: |
if [[ "${{ matrix.config.ft }}" == "python-freethreading" ]]; then
echo "PRP_FLAGS=--parallel-threads 4 --iterations 4 --ignore-gil-enabled" >> ${GITHUB_ENV}
fi
- name: set cfitsio config flags and version
run: |
if [[ "${{ matrix.config.cftsver }}" == "latest" ]]; then
cftsver=${LATEST_CFITSIO_VER}
else
cftsver="${{ matrix.config.cftsver }}"
fi
echo "CFITSIO_VER=${cftsver}" >> ${GITHUB_ENV}
if [[ "${{ matrix.config.cftsver }}" == *3* ]]; then
config_flags="${{ matrix.config.cf }}"
else
config_flags="--without-fortran --disable-shared ${{ matrix.config.cf }}"
fi
echo "CFITSIO_CONFIG_FLAGS=${config_flags}" >> ${GITHUB_ENV}
- name: build external cfitsio
run: |
export CFLAGS="${CFLAGS} ${TEST_CFLAGS} -fPIC"
mkdir -p cfitsio-external-build
cd cfitsio-external-build
rm -rf *
cfitsio_name=cfitsio${CFITSIO_VER}
wget https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/${cfitsio_name}.tar.gz
cfitsio_dir=`tar -tzf ${cfitsio_name}.tar.gz | sed -n "1,1p" | cut -f1 -d"/"`
tar -xzvf ${cfitsio_name}.tar.gz
cd ${cfitsio_dir}
./configure --prefix=$HOME/cfitsio-static-install ${CFITSIO_CONFIG_FLAGS}
make install -j 4
cd ..
cd ..
- name: test non-bundled build
run: |
export CFLAGS="${CFLAGS} ${TEST_CFLAGS}"
pip install ${PIP_OPTIONS} -e . \
--config-settings="--global-option=--use-system-fitsio" \
--config-settings="--global-option=--system-fitsio-includedir=$HOME/cfitsio-static-install/include" \
--config-settings="--global-option=--system-fitsio-libdir=$HOME/cfitsio-static-install/lib"
python -c "import fitsio; assert not fitsio.cfitsio_has_bzip2_support()"
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
python -c "import fitsio; assert not fitsio.cfitsio_has_curl_support()"
else
python -c "import fitsio; assert fitsio.cfitsio_has_curl_support()"
fi
pytest -vv ${PRP_FLAGS} fitsio
- name: install bzip2 on linux
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install libbz2-dev
- name: build external cfitsio w/ bzip2
run: |
export CFLAGS="${CFLAGS} ${TEST_CFLAGS} -fPIC"
mkdir -p cfitsio-external-build
cd cfitsio-external-build
rm -rf *
cfitsio_name=cfitsio${CFITSIO_VER}
wget https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/${cfitsio_name}.tar.gz
cfitsio_dir=`tar -tzf ${cfitsio_name}.tar.gz | sed -n "1,1p" | cut -f1 -d"/"`
tar -xzvf ${cfitsio_name}.tar.gz
cd ${cfitsio_dir}
./configure --prefix=$HOME/cfitsio-static-install ${CFITSIO_CONFIG_FLAGS} --with-bzip2
make install -j 4
cd ..
cd ..
- name: test non-bundled build w/ env vars w/ bzip2
run: |
export CFLAGS="${CFLAGS} ${TEST_CFLAGS}"
pip cache purge
rm -rf build*
find . -name "*.so" -type f -delete
export FITSIO_USE_SYSTEM_FITSIO=1
export FITSIO_SYSTEM_FITSIO_INCLUDEDIR=$HOME/cfitsio-static-install/include
export FITSIO_SYSTEM_FITSIO_LIBDIR=$HOME/cfitsio-static-install/lib
pip install ${PIP_OPTIONS} -e .
python -c "import fitsio; assert fitsio.cfitsio_has_bzip2_support()"
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
python -c "import fitsio; assert not fitsio.cfitsio_has_curl_support()"
else
python -c "import fitsio; assert fitsio.cfitsio_has_curl_support()"
fi
pytest -vv ${{ matrix.config.doslow }} ${PRP_FLAGS} fitsio