-
-
Notifications
You must be signed in to change notification settings - Fork 30
134 lines (116 loc) · 3.3 KB
/
test_and_release.yml
File metadata and controls
134 lines (116 loc) · 3.3 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
name: Test and Release
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
permissions:
contents: read
id-token: write # Required for OIDC
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# Many color libraries just need this to be set to any value, but at least
# one distinguishes color depth, where "3" -> "256-bit color".
FORCE_COLOR: 3
jobs:
pre-commit:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Run pre-commit
run: |
pip install pre-commit
pre-commit install
pre-commit run --all-files
npm-build:
runs-on: ubuntu-latest
needs: [pre-commit]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set Up Node
uses: actions/setup-node@v6
with:
node-version: 24
- name: Build js-lib
run: |
cd js-lib
npm ci
npm run typecheck
npm run build
checks:
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
runs-on: ${{ matrix.runs-on }}
needs: [pre-commit]
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.13"]
runs-on: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install package
run: |
python -m pip install .
python -m pip install "pytest >=6" "pytest-asyncio" "pytest-cov >=3"
- name: Test package
run: >-
python -m pytest -ra --cov --cov-report=xml --cov-report=term
--durations=20
release:
needs: [pre-commit, npm-build, checks]
name: Distribution build
runs-on: ubuntu-latest
if: github.event_name == 'push'
permissions:
id-token: write
attestations: write
contents: write
environment:
name: pypi
url: https://pypi.org/p/wslink
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@v10.5.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# for debug output
# root_options: "-vv"
- name: Generate artifact attestation for sdist and wheel
if: steps.release.outputs.released == 'true'
uses: actions/attest-build-provenance@v4.1.0
with:
subject-path: "dist/*"
- uses: pypa/gh-action-pypi-publish@release/v1
if: steps.release.outputs.released == 'true'
- uses: actions/setup-node@v6
if: steps.release.outputs.released == 'true'
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
- name: NPM
if: steps.release.outputs.released == 'true'
working-directory: js-lib
run: |
npm install -g npm@latest # Ensures OIDC support
npm ci
npm publish