-
Notifications
You must be signed in to change notification settings - Fork 1
130 lines (114 loc) · 3.07 KB
/
test.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
name: CI
on:
push:
branches:
- main
tags:
- "*"
pull_request:
branches:
- main
schedule:
- cron: '0 0 * * 1'
workflow_dispatch:
defaults:
run:
shell: bash
env:
FORCE_COLOR: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
name: Build & verify package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v2
id: baipp
outputs:
python-versions: ${{ steps.baipp.outputs.supported_python_classifiers_json_array }}
tests:
name: Tests on ${{ matrix.python-version }} (${{ matrix.os }})
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest']
python-version: ${{ fromJson(needs.build.outputs.python-versions) }}
include:
- os: macos-latest
python-version: 3
- os: windows-latest
python-version: 3
steps:
- name: Download packages
uses: actions/download-artifact@v4
with:
name: Packages
path: dist/
- run: tar xf dist/*.tar.gz --strip-components=1
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
cache: pip
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Update pip
run: pip install --upgrade pip
- name: Install tox
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Show tox config
run: tox c
- name: Run tox
run: tox -v --exit-and-dump-after 1200 run --installpkg dist/*.whl
- uses: codecov/codecov-action@v4
if: ${{ always() }}
with:
files: cov.xml
token: ${{ secrets.CODECOV_TOKEN }}
checks:
name: Checks
needs: build
runs-on: 'ubuntu-latest'
continue-on-error: true
strategy:
matrix:
check: ['style', 'typecheck', 'spellcheck']
steps:
- name: Download pre-built packages
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- run: tar xf dist/*.tar.gz --strip-components=1
- name: Show tox config
run: pipx run tox c
- name: Show tox config (this call)
run: pipx run tox c -e ${{ matrix.check }}
- name: Run check
run: pipx run tox -e ${{ matrix.check }}
publish:
runs-on: ubuntu-latest
environment: "Package deployment"
needs: [tests]
permissions:
# Required for trusted publishing
id-token: write
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- name: Download packages
uses: actions/download-artifact@v4
with:
name: Packages
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1