-
Notifications
You must be signed in to change notification settings - Fork 3
237 lines (192 loc) · 6.85 KB
/
Copy pathbuild.yml
File metadata and controls
237 lines (192 loc) · 6.85 KB
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
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: '*'
release:
types: [published]
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
defaults:
run:
shell: bash -l {0}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup conda
uses: mamba-org/setup-micromamba@main
with:
environment-file: test-environment.yml
- name: Install bqplot
run: pip install --pre bqplot
- name: Install bqplot-gl
run: pip install . -vvv
- name: Test installation files
run: |
test -d $CONDA_PREFIX/share/jupyter/nbextensions/bqplot-gl
test -f $CONDA_PREFIX/share/jupyter/nbextensions/bqplot-gl/extension.js
test -f $CONDA_PREFIX/share/jupyter/nbextensions/bqplot-gl/index.js
test -d $CONDA_PREFIX/share/jupyter/labextensions/bqplot-gl
test -f $CONDA_PREFIX/share/jupyter/labextensions/bqplot-gl/package.json
test -d $CONDA_PREFIX/share/jupyter/labextensions/bqplot-gl/static
- name: Validate the labextension
run: jupyter labextension list 2>&1 | grep bqplot-gl
- name: Python PEP8 check
run: flake8 bqplot_gl --ignore=E501,W504,W503
- name: JavaScript prettyfier
run: jlpm run prettier:check
- name: Build Python package
run: python -m build
- name: Twine check
run: |
pip install --upgrade twine
twine check dist/*.whl dist/*.tar.gz
- name: Pack JavaScript package
run: |
jlpm pack -o bqplot-gl.tgz
mv bqplot-gl.tgz dist/
- name: Upload builds
uses: actions/upload-artifact@v5
with:
name: dist-${{ github.run_number }}
path: ./dist
visual-regression-tests:
runs-on: ubuntu-latest
needs: [build]
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup conda
uses: mamba-org/setup-micromamba@main
with:
environment-file: test-environment.yml
- uses: actions/download-artifact@v4
with:
name: dist-${{ github.run_number }}
path: ./dist
- name: Install the package
run: |
cd dist
pip install -vv bqplot*.whl
- name: Install dependencies
shell: bash -l {0}
working-directory: ui-tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: jlpm install
- name: Set up browser cache
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/pw-browsers
key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }}
- name: Install browser
shell: bash -l {0}
run: npx playwright install chromium
working-directory: ui-tests
- name: Execute integration tests
shell: bash -l {0}
working-directory: ui-tests
run: npx playwright test
- name: Upload Playwright Test report
if: always()
uses: actions/upload-artifact@v5
with:
name: bqplot-playwright-tests
path: |
ui-tests/test-results
ui-tests/playwright-report
publish-pypi:
runs-on: ubuntu-latest
needs: [build, visual-regression-tests]
permissions:
id-token: write
environment:
name: ${{ github.event_name == 'release' && 'release-pypi' || '' }}
steps:
- uses: actions/download-artifact@v4
with:
name: dist-${{ github.run_number }}
path: ./dist
- name: Keep only PyPI artifacts
run: |
mkdir pypi-dist
mv dist/*.whl dist/*.tar.gz pypi-dist/
rm -rf dist
mv pypi-dist dist
ls -la dist/
- name: Verify tag matches wheel version
if: github.event_name == 'release'
run: |
TAG="${{ github.event.release.tag_name }}"
WHEEL_VERSION=$(ls dist/bqplot_gl-*.whl | sed -E 's|.*/bqplot_gl-([^-]+)-.*\.whl|\1|')
echo "Release tag: $TAG"
echo "Wheel version: $WHEEL_VERSION"
if [ "$TAG" != "$WHEEL_VERSION" ]; then
echo "::error::Release tag '$TAG' does not match wheel version '$WHEEL_VERSION'"
exit 1
fi
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Twine check
run: |
python -m pip install --upgrade pip twine
twine check dist/*.whl dist/*.tar.gz
- name: Publish to PyPI (Trusted Publisher)
if: github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1
publish-npm:
runs-on: ubuntu-latest
needs: [build, visual-regression-tests]
permissions:
id-token: write
contents: read
environment:
name: ${{ github.event_name == 'release' && 'release-npm' || '' }}
steps:
- uses: actions/download-artifact@v4
with:
name: dist-${{ github.run_number }}
path: ./dist
- uses: actions/setup-node@v4
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
- name: Upgrade npm to a version that supports trusted publishing
run: npm install -g npm@latest
- name: Show npm package version
run: |
NPM_VERSION=$(tar -xOf dist/bqplot-gl.tgz package/package.json | node -p "JSON.parse(require('fs').readFileSync(0, 'utf8')).version")
echo "Will publish bqplot-gl@$NPM_VERSION"
echo "NPM_VERSION=$NPM_VERSION" >> "$GITHUB_ENV"
- name: Check npm version
id: npm_check
run: |
if npm view "bqplot-gl@$NPM_VERSION" version > /dev/null 2>&1; then
echo "already_published=true" >> "$GITHUB_OUTPUT"
echo "bqplot-gl@$NPM_VERSION is already on npm"
else
echo "already_published=false" >> "$GITHUB_OUTPUT"
echo "bqplot-gl@$NPM_VERSION not yet on npm"
fi
- name: Fail if releasing an already-published version
if: github.event_name == 'release' && steps.npm_check.outputs.already_published == 'true'
run: |
echo "::error::bqplot-gl@$NPM_VERSION is already on npm; bump package.json before releasing"
exit 1
- name: npm publish (dry-run)
if: github.event_name != 'release' && steps.npm_check.outputs.already_published == 'false'
run: npm publish ./dist/bqplot-gl.tgz --access public --dry-run
- name: Skip dry-run (version already published)
if: github.event_name != 'release' && steps.npm_check.outputs.already_published == 'true'
run: echo "::notice::bqplot-gl@$NPM_VERSION is already on npm; skipping dry-run. Bump package.json on a release-prep PR to exercise the full publish flow."
- name: npm publish (Trusted Publisher)
if: github.event_name == 'release'
run: npm publish ./dist/bqplot-gl.tgz --access public --provenance