-
Notifications
You must be signed in to change notification settings - Fork 4
281 lines (266 loc) · 9.65 KB
/
build.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
name: build
on:
push:
branches: [main]
pull_request:
branches: ['main**']
release:
types: [created]
env:
BUILD_TYPE: Debug
jobs:
pypi-linux:
name: Build wheels for linux
runs-on: ubuntu-latest
#container:
#image: quay.io/pypa/manylinux2014_x86_64:latest
#image: sameli/manylinux2014_x86_64_cuda_11
steps:
- name: clear cache
run: rm -rf /opt/hostedtoolcache
- uses: actions/checkout@v4
with:
submodules: 'True'
path: 'NGSTrefftz'
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
- name: pull manylinux
run: docker pull sameli/manylinux2014_x86_64_cuda_11.7
- name: run test
run: docker run -v $GITHUB_WORKSPACE:/workspace sameli/manylinux2014_x86_64_cuda_11.7 /bin/sh /workspace/NGSTrefftz/.github/workflows/build_linux_test.sh
- name: build pip
run: docker run -v $GITHUB_WORKSPACE:/workspace sameli/manylinux2014_x86_64_cuda_11.7 /bin/sh /workspace/NGSTrefftz/.github/workflows/build_pip.sh
- name: Store the binary wheel
uses: actions/upload-artifact@v4
with:
name: python-package-distributions-linux
path: NGSTrefftz/wheelhouse
pypi-mac:
name: Build wheels for macOS
strategy:
matrix:
py: ['3.8', '3.9', '3.10', '3.11', '3.12']
runs-on: macos-11
env:
MACOSX_DEPLOYMENT_TARGET: '10.15'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
path: 'NGSTrefftz'
- name: Get Python ${{ matrix.py }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
- name: Run build script
run: cd NGSTrefftz/.github/workflows && bash build_pip_mac.sh ${{ matrix.py }}
- name: Store the binary wheel
uses: actions/upload-artifact@v4
with:
name: python-package-distributions-mac-${{ matrix.py }}
path: NGSTrefftz/wheelhouse
pypi-win:
name: Build wheels for Windows
strategy:
matrix:
py: ['3.8', '3.9', '3.10', '3.11', '3.12']
runs-on: windows-2019
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
path: 'NGSTrefftz'
- name: Get Python ${{ matrix.py }}
id: python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
- name: Run build script
run: Set-Location NGSTrefftz/.github/workflows; ./build_pip.ps1 ${{ env.pythonLocation }}
- name: Store the binary wheel
uses: actions/upload-artifact@v4
with:
name: python-package-distributions-win-${{ matrix.py }}
path: NGSTrefftz/wheelhouse
pypi-src:
name: pypi src
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'True'
fetch-depth: 0
path: 'NGSTrefftz'
- name: install pkgs
run: |
sudo apt-get update && DEBIAN_FRONTEND="noninteractive" sudo apt-get -y install vim python3 python3-pip python3-distutils python3-tk libpython3-dev libxmu-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev libblas-dev liblapack-dev
- name: Update pip and Install setuptools
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -U pytest-check numpy wheel scikit-build mkl==2023.* mkl-devel==2023.* setuptools setuptools_scm
python3 -m pip install ngsolve --pre
- name: Package ngstrefftz sources for PyPI
run: cd NGSTrefftz && python3 setup.py sdist -d wheelhouse
#- name: pip install ngstrefftz
#run: pip install dist/*
- name: Store the sdist
uses: actions/upload-artifact@v4
with:
name: python-package-distributions-src
path: NGSTrefftz/wheelhouse
publish-pypi:
name: Publish to PyPI
#if: github.event_name == 'release' && github.event.action == 'created'
needs: [pypi-linux, pypi-mac, pypi-win, pypi-src]
runs-on: ubuntu-latest
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
pattern: python-package-distributions-*
merge-multiple: true
path: NGSTrefftz/wheelhouse/
- name: Publish binary distributions to PyPI
if: github.ref == 'refs/heads/main' || github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: NGSTrefftz/wheelhouse/
#repository-url: https://test.pypi.org/legacy/
docker:
needs: [publish-pypi]
runs-on: ubuntu-latest
steps:
- name: clear cache
run: rm -rf /opt/hostedtoolcache
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: paulstdocker/ngstrefftz
# generate Docker tags based on the following events/attributes
tags: type=semver,pattern={{version}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/#-action@v3
if: github.event_name == 'release' && github.event.action == 'created'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: "Dockerfile"
push: ${{ github.event_name == 'release' && github.event.action == 'created' }}
tags: ${{ steps.meta.outputs.tags }}
#labels: ${{ steps.meta.outputs.labels }}
pyodide:
#needs: [publish-pypi]
if: false
runs-on: ubuntu-latest
steps:
- name: clear cache
run: rm -rf /opt/hostedtoolcache
- uses: actions/checkout@v4
with:
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
submodules: 'True'
path: 'NGSTrefftz'
- name: install pkgs
run: sudo apt-get update && DEBIAN_FRONTEND="noninteractive" sudo apt-get -y install docker
- name: build docker
run: cd $GITHUB_WORKSPACE/NGSTrefftz && docker build -t ngstpyodide -f .github/workflows/pyodide/Dockerfile .
- name: retrieve tar
run: id=$(docker create ngstpyodide) && docker cp $id:/root/output/ngstrefftz_pyodide.tar.bz2 $GITHUB_WORKSPACE/
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build the JupyterLite site
run: |
cd $GITHUB_WORKSPACE/NGSTrefftz/.github/workflows/pyodide && python -m pip install -r requirements.txt
cd $GITHUB_WORKSPACE && jupyter lite build --pyodide ngstrefftz_pyodide.tar.bz2 --contents ./NGSTrefftz/docs/notebooks/ --output-dir ngst-pyodide
#- name: upload
#uses: actions/upload-pages-artifact@v3
- name: Store the sdist
uses: actions/upload-artifact@v4
with:
name: ngst-pyodide
path: ./ngst-pyodide
docs:
needs: [publish-pypi]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
submodules: 'True'
path: 'NGSTrefftz'
- name: install pkgs
run: sudo apt-get update && DEBIAN_FRONTEND="noninteractive" sudo apt-get -y install libxmu-dev tk-dev tcl-dev git libglu1-mesa-dev libblas-dev liblapack-dev python3 python3-pip python3-distutils python3-tk libpython3-dev python3-testresources npm nodejs pandoc -y
#- name: pip pkgs
#run: python3 -m pip list
- name: pip install requirements
run: pip install --user -r $GITHUB_WORKSPACE/NGSTrefftz/docs/requirements.txt
- name: set path
run: |
echo "NETGENDIR=/usr/bin/" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=${{ env.LD_LIBRARY_PATH }}:/home/runner/.local/lib:/usr/local/lib/" >> $GITHUB_ENV
- name: Build and Commit
uses: sphinx-notes/pages@v2
with:
repository_path: 'NGSTrefftz'
publish: false
#requirements_path: ./docs/requirements.txt
- name: Download pyodide stuff
if: false
uses: actions/download-artifact@v4
with:
name: ngst-pyodide
path: NGSTrefftz/ngst-pyodide
- run: tree -d .
- name: Upload
uses: actions/upload-pages-artifact@v3
with:
path: 'NGSTrefftz/'
deploy-docs:
needs: docs
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
#if: github.event_name == 'release' && github.event.action == 'created'
if: github.ref == 'refs/heads/main'
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
paper:
runs-on: ubuntu-latest
name: Paper Draft
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build draft PDF
uses: openjournals/openjournals-draft-action@master
with:
journal: joss
paper-path: docs/paper/paper.md
- name: Upload
uses: actions/upload-artifact@v4
with:
name: joss_paper
path: docs/paper/paper.pdf