-
Notifications
You must be signed in to change notification settings - Fork 73
241 lines (228 loc) · 7.45 KB
/
ci.yaml
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
name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
test:
name: Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
klayout_version: [klayout27, klayout28, latest]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10.x'
- name: Init KQCircuits
run: ci/init_kqc.sh
- name: Select KLayout version
run: pip install --force-reinstall -r "ci/requirements/${{ matrix.klayout_version }}-requirements.txt"
if: ${{ matrix.klayout_version != 'latest' }}
- name: Run tests
run: tox -e matrix
- name: Upload test results
if: always()
uses: actions/upload-artifact@v2
with:
name: Test results (KLayout=${{ matrix.klayout_version }})
path: test_report.xml
test_non_linux:
name: Tests (non-🐧)
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest]
klayout_version: [klayout27, klayout28, latest]
include:
- os-folder: win
os: windows-latest
- os-folder: mac
os: macos-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10.x'
- name: macOS setup
run: |
brew install python
ln -s -f /usr/local/bin/python3.10 /usr/local/bin/python
if: ${{ matrix.os == 'macos-latest' }}
- name: Init KQCircuits
run: |
python -m pip install -r ci/requirements/tomli-requirements.txt
python -m pip install -r klayout_package/python/requirements/${{ matrix.os-folder }}/pip-requirements.txt
pip-sync klayout_package/python/requirements/${{ matrix.os-folder }}/requirements.txt klayout_package/python/requirements/linux/test-requirements.txt
pip3 install --no-deps -e "klayout_package/python/"
- name: Select KLayout version
run: pip3 install --force-reinstall -r "ci/requirements/${{ matrix.klayout_version }}-requirements.txt"
if: ${{ matrix.klayout_version != 'latest' }}
- name: Run tests
run: tox -e matrix
- name: Upload test results
if: always()
uses: actions/upload-artifact@v2
with:
name: Test results (${{ matrix.os }} KLayout=${{ matrix.klayout_version }})
path: test_report.xml
publish_test_results:
name: Publish test results
needs: [ test, test_non_linux ]
runs-on: ubuntu-latest
if: success() || failure()
steps:
- name: Download test results
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
files: artifacts/**/*.xml
check_name: Test results
static_analysis:
name: Static code analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10.x'
- name: Init KQCircuits
run: ci/init_kqc.sh
- name: Run static code analysis
run: tox -e static_analysis
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
verify_documentation:
name: Verify documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # fetch tags as well
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10.x'
- name: Install graphviz
run: sudo apt-get update && sudo apt-get install -y graphviz
- name: Init KQCircuits
run: ci/init_kqc.sh
- name: Make docs
run: |
cd docs
make html SPHINXOPTS="-W --keep-going"
- name: Docs to artifact
uses: actions/upload-artifact@v2
if: always()
with:
name: docs
path: docs/_build/html/
check_copyright_headers:
name: Check copyright headers
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10.x'
- name: Run copyright headers check
run: >
python ci/check_copyright_headers.py --exclude-paths
klayout_package/python/kqcircuits/_static_version.py
klayout_package/python/kqcircuits/_version.py
check_license:
name: Check license
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10.x'
- name: Run license check
run: sha256sum -c ci/license_manifest.txt
verify_layer_properties:
name: Verify layer properties
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10.x'
- name: Init KQCircuits
run: ci/init_kqc.sh
- name: Run check_layer_props.py
run: python util/check_layer_props.py
pypi_package_build_and_publish:
name: Build & Publish kqcircuits 🐍 📦
needs: [ verify_documentation, verify_layer_properties, test, test_non_linux, shellcheck]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10.x'
- name: Build and test
run: |
git fetch --unshallow --tags
echo "GIT_TAG=$(git tag --contains HEAD | grep -P '^v\d+\.\d+\.\d+.*')" >> $GITHUB_ENV
python -m pip install -r klayout_package/python/requirements/linux/pip-requirements.txt
python -m pip install -r ci/requirements/twine-requirements.txt
cd klayout_package/python
python -m build
python -m twine check dist/*
- name: Publish to PyPI
if: env.GIT_TAG
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
repository_url: https://upload.pypi.org/legacy/
packages_dir: klayout_package/python/dist/
pages:
name: Deploy documentation
needs: [ check_copyright_headers, check_license, verify_documentation ]
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10.x'
- name: Download docs artifact
uses: actions/download-artifact@v2
with:
name: docs
path: public
- name: Add redirect and 404
run: |
mkdir -p public/_build/html
cp public/_static/redirect.html public/_build/html/index.html
cp public/_static/404.html public/404.html
- name: Install rsync # https://github.com/JamesIves/github-pages-deploy-action#using-a-container-
run: sudo apt-get update && sudo apt-get install -y rsync
- name: Upload pages
uses: JamesIves/github-pages-deploy-action@v4.3.3
with:
branch: gh-pages
folder: public