-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (119 loc) · 3.21 KB
/
release.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
name: release
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#TWINE_USERNAME: __token__
#TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
on:
push:
paths:
- "**"
- ".github/workflows/release.yml"
defaults:
run:
working-directory: ./
permissions:
id-token: write
contents: write
jobs:
lint:
name: Lint
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- run: pip install -e .[dev]
- run: python -m ruff .
- run: python -m mypy --strict .
test:
name: Unit tests
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: run tests
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- run: pip install -e .[dev]
- run: coverage run -m pytest -vv python/tests/
- run: coverage report | grep 'TOTAL' | awk '{print "COVERAGE_PCT=" $4}' >> $GITHUB_ENV
# TODO: publish coverage report
build-widgets:
name: Build Widgets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: js/package-lock.json
- name: Install dependencies
run: npm ci
working-directory: js
- name: Build widgets
run: bash build-widgets.sh
working-directory: js
- name: Upload built widgets
uses: actions/upload-artifact@v4
with:
name: widgets
path: python/src/widgets/static/*.mjs
build:
needs: build-widgets
timeout-minutes: 15
runs-on: ubuntu-latest
name: Build package
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- uses: actions/setup-go@v5
with:
cache: false
- run: python3 -m pip install python-semantic-release==9.6.0 build>=1.2.1
- run: semantic-release version --no-commit --no-tag --no-push --no-changelog # update version locally to build new version
- run: python -m build
- uses: actions/upload-artifact@v4
with:
name: package
path: ./dist/*
release:
if: github.ref == 'refs/heads/main'
timeout-minutes: 15
runs-on: ubuntu-latest
name: Release
environment: release
needs:
- lint
- test
- build-widgets
- build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- uses: actions/download-artifact@v4
id: download
with:
name: package
path: ./dist
- run: pip install python-semantic-release==9.6.0
- run: semantic-release version --commit --tag --push
- run: semantic-release publish
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1