-
Notifications
You must be signed in to change notification settings - Fork 4
230 lines (218 loc) · 7.35 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
name: build
on:
push:
branches: [main]
pull_request:
branches: ['main**']
release:
types: [created]
env:
BUILD_TYPE: Debug
jobs:
test_linux:
name: Test on Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'True'
path: 'NGSTrefftz'
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: install ngstrefftz
run: cd NGSTrefftz && pip install . && pip install numpy
- name: run test
run: cd $GITHUB_WORKSPACE/NGSTrefftz/test && python3 -m doctest -v *.py
build_wheels:
name: Build wheels on ${{ matrix.os }}
needs: [ test_linux ]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-13]
include:
- os: windows-2019
cibw-arch: AMD64
cmake-generator: "Visual Studio 16 2019"
cmake_generator_platform: "x64"
steps:
- uses: actions/checkout@v4
with:
submodules: 'True'
fetch-tags: 'true'
fetch-depth: 0
- name: Build wheels
uses: pypa/cibuildwheel@v2.19.0
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
needs: [ test_linux ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'True'
fetch-tags: 'true'
fetch-depth: 0
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
if: github.ref == 'refs/heads/main' || github.event_name == 'release'
with:
skip-existing: true
password: ${{ secrets.PYPI_API_TOKEN }}
# To test: repository-url: https://test.pypi.org/legacy/
docker:
needs: [upload_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/login-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: [upload_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