-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (95 loc) · 2.82 KB
/
unit_tests.yml
File metadata and controls
114 lines (95 loc) · 2.82 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
# 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-ignore:
- 'dependabot/**' # Avoid duplicates; only run the PR, not the push
- 'gh-pages' # GitHub Pages do not trigger all tests
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',
]
env:
PYTHON_VERSION: ${{ matrix.python-version }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
cache-dependency-glob: "uv.lock"
enable-cache: false
python-version: ${{ matrix.python-version }}
version: "0.5.13"
- name: Install library and dependencies
run: |
uv sync --frozen
uv run maturin develop
- name: Run Tox (Pytest + Coverage)
run: |
uvx --with tox-uv tox
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLATFORM: ${{ matrix.os }}
- name: Upload Results to CodeCov
if: success()
uses: codecov/codecov-action@v6
with:
env_vars: TOXENV
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@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
cache-dependency-glob: "uv.lock"
enable-cache: true
- name: Install Python
uses: actions/setup-python@v6
with:
python-version-file: "pyproject.toml"
- name: Build test release 📦
uses: messense/maturin-action@v1
with:
manylinux: auto
command: build
args: --release --sdist -o dist --find-interpreter
- name: Publish test release 📦 to Test PyPI
uses: messense/maturin-action@v1
continue-on-error: true
env:
MATURIN_PYPI_TOKEN: ${{ secrets.TEST_PYPI_PASSWORD }}
with:
command: upload
args: --skip-existing * --repository-url "https://test.pypi.org/legacy"