-
Notifications
You must be signed in to change notification settings - Fork 3
262 lines (258 loc) · 9.77 KB
/
packaging.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
---
name: upload packages
# yamllint disable rule:line-length
# Controls when the action will run.
on: # yamllint disable-line rule:truthy
# schedule test for nightly build
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Note: the defaults are repeated within the 'env' section
# of some of the jobs so any change to the default
# need to be done (at least) twice!
inputs:
download:
type: choice
description: 'download location ( dune | lund ) [dune]'
required: true
default: 'dune'
options:
- dune
- github
- lund
upload:
type: choice
description: 'upload (none | testpypi | pypi) [none]'
required: true
default: 'none'
options:
- none
- pypi
- testpypi
branch:
# note: this should be either 'master' or a tag of the form
# vN where 'N' is a legal python package version
# e.g. N=2.8.0rc1
# otherwise the distributions will not be generated
# and the build will fail
description: 'core tag e.g. (master | v2.8.0) [master]'
required: true
default: 'master'
fembranch:
# note: this should be either 'master' or a tag of the form
# vN where 'N' is a legal python package version
# e.g. N=2.8.0rc1
# otherwise the distributions will not be generated
# and the build will fail
description: 'fem tag e.g. (master | v2.8.0.1) [master]'
required: true
default: 'master'
runTests:
type: boolean
description: run testing scenarios [true]
required: true
default: true
logLevel:
type: choice
description: 'Log level [Warning]'
required: true
default: 'Warning'
options:
- Debug
- Warning
- Info
- error
# needed only for dispatching from other repo
distinct_id:
required: false
description: 'set when dispatching from external repo - leave empty'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# build packages
build:
name: build
runs-on: [ubuntu-latest]
env:
DOWNURL: 'https://gitlab.dune-project.org'
RUNTESTS: ${{ !contains(github.event.inputs.runTests, 'false') }}
steps:
- name: echo distinct ID ${{ github.event.inputs.distinct_id }}
if: github.event.inputs.distinct_id != ''
run: echo ${{ github.event.inputs.distinct_id }}
- name: downloadGithub
if: github.event.inputs.download == 'github'
run: echo "DOWNURL=https://github.com/adedner" >> $GITHUB_ENV
- name: downloadLund
if: github.event.inputs.download == 'lund'
run: echo "DOWNURL=https://gitlab.maths.lu.se/dune" >> $GITHUB_ENV
- name: printParameters
run: |
echo "Workflow parameters"
echo "Using github branch : ${GITHUB_REF#refs/heads/}"
echo "Using log level : ${{ github.event.inputs.logLevel }}"
echo "Using download : ${{ env.DOWNURL }}"
echo "Using upload : ${{ github.event.inputs.upload }}"
echo "Using dune-core branch: ${{ github.event.inputs.branch }}"
echo "Using dune-fem branch: ${{ github.event.inputs.fembranch }}"
echo "Run tests: ${{ github.event.inputs.runTests }}"
echo "ref: ${{ github.ref }}"
- name: starting
uses: actions/checkout@v4
- name: Test on dune/dune-testpypi and get the run ID
uses: codex-/return-dispatch@v1
id: return_dispatch
with:
token: ${{ secrets.Dispatch_Secret }}
repo: dune-testpypi
owner: dune-project
ref: ${{ github.ref }}
workflow: testing.yml
workflow_inputs: '{ "logLevel": "${{ github.event.inputs.logLevel }}", "branch": "${{ github.event.inputs.branch }}", "fembranch": "${{ github.event.inputs.fembranch }}", "download": "${{ env.DOWNURL }}", "runTests": "${{ env.RUNTESTS }}" }'
# workflow_timeout_seconds: 120
- name: Await Run ID ${{ steps.return_dispatch.outputs.run_id }}
uses: Codex-/await-remote-run@v1
with:
token: ${{ secrets.Dispatch_Secret }}
repo: dune-testpypi
owner: dune-project
run_id: ${{ steps.return_dispatch.outputs.run_id }}
run_timeout_seconds: 7200
poll_interval_ms: 5000
- name: download artifacts from RUN ID ${{ steps.return_dispatch.outputs.run_id }}
uses: dawidd6/action-download-artifact@v3
with:
github_token: ${{ secrets.Dispatch_Secret }}
repo: dune-project/dune-testpypi
workflow: testing.yml
run_id: ${{ steps.return_dispatch.outputs.run_id }}
workflow_conclusion: success
name: packages
path: dist
if_no_artifact_found: fail
# find the latest - might fail...
# branch: main
# workflow_search: true
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: packages
path: dist
# test packages
test:
name: testing tutorial
needs: build
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest]
test: [coreA, coreB, extensions]
python: [3.8, 3.11]
runs-on: ${{ matrix.os }}
steps:
- name: starting
uses: actions/checkout@v4
- name: pipPreOrNot
run: |
echo "PIPPRE=--pre" >> $GITHUB_ENV
- name: setup python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: environmentLog
if: github.event.inputs.logLevel != ''
run: echo "LOGLEVEL=${{ github.event.inputs.logLevel }}" >> $GITHUB_ENV
- name: download artifacts
uses: actions/download-artifact@v4
# if all packages exist on pypi then no artifacts are uploaded so don't fail
continue-on-error: true
with:
name: packages
path: dist
- name: Install dependencies
run: |
curl 'https://raw.githubusercontent.com/dune-project/dune-testpypi/main/ossetup' > ossetup
bash ./ossetup "$RUNNER_OS"
shell: bash
- name: Setup venv
run: |
python3 -m venv dune-env
source dune-env/bin/activate
PYVERS=$(python3 --version)
echo "Selected python version $PYVERS"
pip3 install --upgrade pip
pip3 install matplotlib scipy scikit-build mpi4py pygmsh wheel
if [ "$RUNNER_OS" == "Linux" ]; then
echo "CURRENTLY PETSC4PY IS DISABLED"
# petsc4py is failing at the moment - need to check
# at the moment need to downgrade to 20.0.2 https://gitlab.com/petsc/petsc/-/issues/1369
# PETSC_CONFIGURE_OPTIONS="--download-scalapack --download-suitesparse --download-hypre --download-mumps --download-ml --download-superlu"
# pip3 install -v petsc petsc4py
else
echo "CURRENTLY PETSC4PY IS DISABLED on MACOs due to issues with mpif90 - needs checking"
# while building petsc the following error is produced
# Fortran compiler you provided with --with-fc=/usr/local/bin/mpif90 cannot be found or does not work.
# Cannot compile FC with /usr/local/bin/mpif90.
fi
shell: bash
- name: pip3 install dune modules
run: |
ls dist
source dune-env/bin/activate
pip3 install extract-version
python extractreq.py
cat requirements.txt
pip3 install $PIPPRE -U -v --find-links file://$PWD/dist -r requirements.txt
shell: bash
- name: Setup dune-py
run: |
set +e
source dune-env/bin/activate
pip3 list
python -m dune.fem # tutorial
shell: bash
- name: Run tutorial
run: |
set +e
source dune-env/bin/activate
echo "USING python"
python --version
export DUNEPY_DISABLE_PLOTTING=1
export DUNE_LOG_LEVEL=$LOGLEVEL
export OMP_NUM_THREADS=4
python -c "from dune.fem import threading; print(f'Default number of threads used {threading.use}')"
cd fem_tutorial
python ../run-tutorial.py ${{ matrix.test }}
shell: bash
# https://github.com/marketplace/actions/pypi-publish
upload:
name: uploading
if: ${{ github.event.inputs.upload != 'none' && github.event.inputs.upload != '' }}
needs: test
runs-on: [ubuntu-latest]
steps:
- name: download artifacts
uses: actions/download-artifact@v4
with:
name: packages
path: dist
- name: remove repository tar.gz since it can't be uploaded
run: rm dist/repos.tar.gz
shell: bash
- name: Publish package to pypi
if: github.event.inputs.upload == 'pypi'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Publish package to testpypi
if: github.event.inputs.upload == 'testpypi'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
## this is needed so long as versioning for
## fem and core packages can differ (i.e. 2.8.0.x) but are uploaded
## in same script.
## Test if required version for core is available on pypi and use
## instead of git?
# skip_existing: true