-
Notifications
You must be signed in to change notification settings - Fork 21
285 lines (244 loc) · 9.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
name: CI
on: [push, pull_request]
jobs:
Build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
build: [fpm, meson]
os: [ubuntu-latest, macos-latest, windows-latest]
gcc: [10] # Version of GFortran we want to use.
build-type: [debug]
include:
- build: meson
os: ubuntu-latest
gcc: 10
build-type: coverage
defaults:
run:
shell: ${{ contains(matrix.os, 'windows') && 'powershell' || 'bash -l {0}' }}
env:
FC: gfortran
CC: gcc
FPM_FC: gfortran
FPM_CC: gcc
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive
- name: Cache GFortran install
if: ${{ contains(matrix.os, 'windows') }}
id: cache
uses: actions/cache@v2
with:
path: ./mingw-w64
key: gcc-${{ matrix.gcc }}-${{ matrix.os }}
- name: Install GFortran (MacOS)
if: ${{ contains(matrix.os, 'macos') }}
run: |
brew install gcc@${{ matrix.gcc }}
ln -s /usr/local/bin/gfortran-${{ matrix.gcc }} /usr/local/bin/gfortran
ln -s /usr/local/bin/gcc-${{ matrix.gcc }} /usr/local/bin/gcc
- name: Install GFortran (Linux)
if: ${{ contains(matrix.os, 'ubuntu') }}
run: |
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc }} 100 \
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ matrix.gcc }} \
--slave /usr/bin/gcov gcov /usr/bin/gcov-${{ matrix.gcc }}
- name: Install GFortran (Windows)
if: ${{ contains(matrix.os, 'windows') && steps.cache.outputs.cache-hit != 'true' }}
run: |
Invoke-WebRequest -Uri ${{ env.DOWNLOAD }} -OutFile mingw-w64.zip
Expand-Archive mingw-w64.zip
echo "$pwd\mingw-w64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
shell: pwsh
env:
DOWNLOAD: "https://github.com/brechtsanders/winlibs_mingw/releases/download/10.3.0-12.0.0-9.0.0-r2/winlibs-x86_64-posix-seh-gcc-10.3.0-mingw-w64-9.0.0-r2.zip"
- name: Install dependencies
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: config/ci/${{ matrix.build }}-env.yaml
extra-specs: |
${{ matrix.build-type == 'coverage' && 'gcovr' || '' }}
- name: Compile (fpm)
if: ${{ matrix.build == 'fpm' }}
run: fpm build --profile release
- name: Run test (fpm)
if: ${{ matrix.build == 'fpm' }}
run: fpm test
- name: Run examples (fpm)
if: ${{ matrix.build == 'fpm' }}
run: fpm run --example --all
- name: Setup build (meson)
if: ${{ matrix.build == 'meson' }}
run: >-
meson setup _build
--libdir=lib
--prefix=${{ contains(matrix.os, 'windows') && '$pwd\_dist' || '$PWD/_dist' }}
${{ matrix.build-type == 'coverage' && '-Db_coverage=true' || '' }}
- name: Compile project (meson)
if: ${{ matrix.build == 'meson' }}
run: meson compile -C _build
- name: Run testsuite (meson)
if: ${{ matrix.build == 'meson' }}
run: |
meson test -C _build --no-rebuild --print-errorlogs
${{ matrix.build-type == 'coverage' && 'ninja -C _build coverage' || '' }}
- name: Install project (meson)
if: ${{ matrix.build == 'meson' }}
run: meson install -C _build --no-rebuild
- name: Create package (Unix)
if: ${{ matrix.build == 'meson' && ! contains(matrix.os, 'windows') }}
run: |
tar cvf ${{ env.OUTPUT }} _dist
xz -T0 ${{ env.OUTPUT }}
echo "MINPACK_OUTPUT=${{ env.OUTPUT }}.xz" >> $GITHUB_ENV
env:
OUTPUT: minpack-${{ matrix.os }}.tar
- name: Create package (Windows)
if: ${{ matrix.build == 'meson' && contains(matrix.os, 'windows') }}
run: |
tar cvf ${{ env.OUTPUT }} _dist
xz -T0 ${{ env.OUTPUT }}
echo "MINPACK_OUTPUT=${{ env.OUTPUT }}.xz" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
env:
OUTPUT: minpack-${{ matrix.os }}.tar
- name: Upload package
if: ${{ matrix.build == 'meson' && matrix.build-type != 'coverage' }}
uses: actions/upload-artifact@v2
with:
name: ${{ env.MINPACK_OUTPUT }}
path: ${{ env.MINPACK_OUTPUT }}
- name: Upload coverage report
if: ${{ matrix.build-type == 'coverage' }}
uses: codecov/codecov-action@v2
Python:
needs:
- Build
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ contains(matrix.os, 'windows') && 'powershell' || 'bash -l {0}' }}
strategy:
fail-fast: false
matrix:
build: [meson]
os: [ubuntu-latest, macos-latest]
gcc: [10]
python: ['3.7', '3.8', '3.9']
# Additional test for setuptools build
include:
- build: setuptools
os: ubuntu-latest
gcc: 10
python: '3.9'
env:
FC: gfortran
CC: gcc
MINPACK_OUTPUT: minpack-${{ matrix.os }}.tar.xz
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache GFortran install
if: ${{ contains(matrix.os, 'windows') }}
id: cache
uses: actions/cache@v2
with:
path: ./mingw-w64
key: gcc-${{ matrix.gcc }}-${{ matrix.os }}
- name: Install dependencies
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: config/ci/python-env.yaml
extra-specs: |
python=${{ matrix.python }}
- name: Install GFortran (MacOS)
if: ${{ contains(matrix.os, 'macos') }}
run: |
brew install gcc@${{ matrix.gcc }}
ln -s /usr/local/bin/gfortran-${{ matrix.gcc }} /usr/local/bin/gfortran
ln -s /usr/local/bin/gcc-${{ matrix.gcc }} /usr/local/bin/gcc
- name: Install GFortran (Linux)
if: ${{ contains(matrix.os, 'ubuntu') }}
run: |
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc }} 100 \
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ matrix.gcc }} \
--slave /usr/bin/gcov gcov /usr/bin/gcov-${{ matrix.gcc }}
- name: Install GFortran (Windows)
if: ${{ contains(matrix.os, 'windows') && steps.cache.outputs.cache-hit != 'true' }}
run: |
Invoke-WebRequest -Uri ${{ env.DOWNLOAD }} -OutFile mingw-w64.zip
Expand-Archive mingw-w64.zip
echo "$pwd\mingw-w64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
shell: pwsh
env:
DOWNLOAD: "https://github.com/brechtsanders/winlibs_mingw/releases/download/10.3.0-12.0.0-9.0.0-r2/winlibs-x86_64-posix-seh-gcc-10.3.0-mingw-w64-9.0.0-r2.zip"
- name: Download package
uses: actions/download-artifact@v2
with:
name: ${{ env.MINPACK_OUTPUT }}
- name: Unpack package (Unix)
if: ${{ ! contains(matrix.os, 'windows') }}
run: |
tar xvf ${{ env.MINPACK_OUTPUT }}
echo "MINPACK_PREFIX=$PWD/_dist" >> $GITHUB_ENV
- name: Unpack package (Windows)
if: ${{ contains(matrix.os, 'windows') }}
run: |
tar xvf ${{ env.MINPACK_OUTPUT }}
echo "MINPACK_OUTPUT=${{ env.OUTPUT }}.xz" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install Python extension module (pip)
if: ${{ matrix.build == 'setuptools' }}
run: pip3 install . -vv
working-directory: python
env:
PKG_CONFIG_PATH: ${{ env.PKG_CONFIG_PATH }}:${{ env.MINPACK_PREFIX }}/lib/pkgconfig
LD_RUNPATH_SEARCH_PATH: ${{ env.MINPACK_PREFIX }}/lib
- name: Install Python extension module (meson)
if: ${{ matrix.build == 'meson' }}
run: |
set -ex
meson setup _build --prefix=$CONDA_PREFIX --libdir=lib
meson compile -C _build
meson install -C _build
working-directory: python
env:
PKG_CONFIG_PATH: ${{ env.PKG_CONFIG_PATH }}:${{ env.MINPACK_PREFIX }}/lib/pkgconfig
- name: Test Python API
run: pytest --doctest-modules --pyargs minpack --cov=minpack -vv
env:
LD_LIBRARY_PATH: ${{ env.LD_LIBRARY_PATH }}:${{ env.MINPACK_PREFIX }}/lib
DYLD_LIBRARY_PATH: ${{ env.DYLD_LIBRARY_PATH }}:${{ env.MINPACK_PREFIX }}/lib
- name: Upload coverage report
uses: codecov/codecov-action@v2
Docs:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- id: deploy-on-push
run:
echo "::set-output name=result::${{ env.DEPLOY_BRANCH }}"
env:
DEPLOY_BRANCH: ${{ secrets.DEPLOY_BRANCH && contains(github.ref, secrets.DEPLOY_BRANCH) && 1 || 0 }}
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install dependencies
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: config/ci/docs-env.yaml
- name: Build documentation
run: ford ./minpack.md
- name: Deploy Documentation
if: ${{ github.event_name == 'push' && steps.deploy-on-push.outputs.result != 0 }}
uses: JamesIves/[email protected]
with:
branch: gh-pages # The branch the action should deploy to.
folder: doc # The folder the action should deploy.