-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (86 loc) · 2.49 KB
/
Copy pathunit_tests.yml
File metadata and controls
103 lines (86 loc) · 2.49 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
# This workflow will install Python dependencies,
# run tests with a variety of Python versions,
# and upload a new build to TestPyPI.
#
# For more information see:
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Unit tests
on:
push:
branches:
- 'main'
tags-ignore:
- 'v*' # Avoid re-running existing commit on release
pull_request:
branches:
- 'main'
permissions:
contents: read
env:
FORCE_COLOR: 1
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: [
'3.11',
'3.12',
'3.13',
'3.14',
'pypy-3.11',
]
env:
PYTHON_VERSION: ${{ matrix.python-version }}
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
cache-dependency-glob: "uv.lock"
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Install library and dependencies
run: uv sync --frozen
- name: Run Tox (Pytest + Coverage)
run: uv run tox
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLATFORM: ${{ matrix.os }}
- name: Upload Results to CodeCov
if: success()
uses: codecov/codecov-action@v7
with:
env_vars: PYTHON_VERSION
fail_ci_if_error: false
files: ./tests/reports/coverage-html/index.html,./tests/reports/coverage.xml
flags: unittests
name: "${{ matrix.os }} - Python ${{ matrix.python-version }}"
token: ${{ secrets.CODECOV_TOKEN }}
testpypi-deploy:
name: Build and publish Python 🐍 distributions 📦 to TestPyPI
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0 # Fetch all history for versioning
fetch-tags: true # Fetch tags for versioning
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
cache-dependency-glob: "uv.lock"
enable-cache: true
- name: Build release
run: uv build
- name: Publish test release 📦 to Test PyPI
continue-on-error: true
run: uv publish
env:
UV_PUBLISH_URL: https://test.pypi.org/legacy/
UV_PUBLISH_CHECK_URL: https://test.pypi.org/simple/
UV_PUBLISH_TOKEN: ${{ secrets.TEST_PYPI_PASSWORD }}