-
Notifications
You must be signed in to change notification settings - Fork 252
131 lines (121 loc) · 4.31 KB
/
Copy pathmain.yml
File metadata and controls
131 lines (121 loc) · 4.31 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
name: Main testing workflow
on:
push:
pull_request:
workflow_dispatch:
jobs:
build:
name: Build package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
- name: Set up Python
uses: actions/setup-python@v5
- name: Build a binary wheel and a source tarball
run: uv build
- name: Check the distribution files with `twine`
run: uv run --only-group build twine check --strict dist/*
- name: Upload artifact
id: artifact-upload-step
uses: actions/upload-artifact@v4
with:
name: dist-files
path: dist/*
if-no-files-found: error
compression-level: 0 # They are already compressed
test-run:
runs-on: ubuntu-latest
needs: build
# Never fail the workflow for pre-release pythons, even when a step
# outside of typecheck/test breaks (e.g. a dependency that does not
# build yet on that version).
continue-on-error: ${{ matrix.ignore-test-outcome }}
strategy:
fail-fast: false
matrix:
include:
- python-version: "3.10"
toxfactor: py3.10
ignore-typecheck-outcome: false
ignore-test-outcome: false
- python-version: "3.11"
toxfactor: py3.11
ignore-typecheck-outcome: false
ignore-test-outcome: false
- python-version: "3.12"
toxfactor: py3.12
ignore-typecheck-outcome: false
ignore-test-outcome: false
- python-version: "3.13"
toxfactor: py3.13
ignore-typecheck-outcome: false
ignore-test-outcome: false
- python-version: "3.14"
toxfactor: py3.14
ignore-typecheck-outcome: false
ignore-test-outcome: false
- python-version: "3.15-dev"
toxfactor: py3.15
ignore-typecheck-outcome: false
ignore-test-outcome: false
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ matrix.python-version }}
- name: Install dev dependencies
run: uv sync --only-group dev
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: dist-files
path: dist/
- name: Type checking
# Ignore errors for older pythons
continue-on-error: ${{ matrix.ignore-typecheck-outcome }}
run: |
source .venv/bin/activate
tox -e mypy
- name: Test with tox
continue-on-error: ${{ matrix.ignore-test-outcome }}
run: |
source .venv/bin/activate
coverage erase
# Using `--parallel 4` as it's the number of CPUs in the GitHub Actions runner
# Using `installpkg dist/*.tar.gz` because we want to install the pre-built package (want to test against that)
tox run-parallel -f ${{ matrix.toxfactor }} --parallel 4 --parallel-no-spinner --parallel-live --installpkg dist/*.whl
coverage combine
coverage xml
- uses: codecov/codecov-action@v4
with:
# Explicitly using the token to avoid Codecov rate limit errors
# See https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: true # optional (default = false)
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pytest-bdd
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs:
- "test-run"
- "build"
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: dist-files
path: dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1