-
-
Notifications
You must be signed in to change notification settings - Fork 244
113 lines (109 loc) · 3.8 KB
/
ci.yml
File metadata and controls
113 lines (109 loc) · 3.8 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
name: CI
on:
pull_request:
push:
branches: [master]
workflow_dispatch:
inputs:
pytest_addopts:
description:
Extra options for pytest; use -vv for full details; see
https://docs.pytest.org/en/latest/example/simple.html#how-to-change-command-line-options-defaults
required: false
env:
LANG: "en_US.utf-8"
LC_ALL: "en_US.utf-8"
PRE_COMMIT_HOME: ${{ github.workspace }}/.cache/pre-commit
PYTEST_ADDOPTS: ${{ github.event.inputs.pytest_addopts }}
PYTHONIOENCODING: "UTF-8"
# renovate: datasource=devbox depName=uv
UV_VERSION: "0.10.6"
# renovate: datasource=github-tags depName=devbox packageName=jetify-com/devbox
DEVBOX_VERSION: "0.17.0"
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
include:
# HACK: Limit the number of pytest workers on macOS to 3 to avoid a
# timeout for a few test cases. For unknown reasons, the number of
# auto-configured workers on macOS runners increased from 3 to 6 on
# 2025-07-08.
# FIXME: Remove this hack when the issue has been fixed.
- os: macos-latest
pytest-xdist-maxprocesses: 3
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # Needs all tags to compute dynamic version
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: ${{ env.UV_VERSION }}
python-version: ${{ matrix.python-version }}
enable-cache: "true"
cache-suffix: ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --frozen
- name: Run pytest
run:
uv run poe test --cov=./ --cov-report=xml -ra
${PYTEST_XDIST_MAXPROCESSES:+--maxprocesses=$PYTEST_XDIST_MAXPROCESSES} .
env:
PYTEST_XDIST_MAXPROCESSES: ${{ matrix.pytest-xdist-maxprocesses }}
- name: Upload coverage to Codecov
continue-on-error: true
uses: codecov/codecov-action@v5
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
with:
env_vars: OS,PYTHON
fail_ci_if_error: true
file: ./coverage.xml
flags: unittests
name: copier
token: ${{ secrets.CODECOV_TOKEN }}
devbox:
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
include:
# HACK: Limit the number of pytest workers on macOS to 3 to avoid a
# timeout for a few test cases. For unknown reasons, the number of
# auto-configured workers on macOS runners increased from 3 to 6 on
# 2025-07-08.
# FIXME: Remove this hack when the issue has been fixed.
- os: macos-latest
pytest-xdist-maxprocesses: 3
runs-on: ${{ matrix.os }}
permissions:
contents: write # Allow pushing back pre-commit changes
steps:
- uses: actions/checkout@v6
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.14.0
with:
devbox-version: ${{ env.DEVBOX_VERSION }}
enable-cache: "true"
- run: devbox run -- uv run copier --version
- run: devbox run -- uv run pre-commit run --all-files --show-diff-on-failure
- run:
devbox run test
${PYTEST_XDIST_MAXPROCESSES:+--maxprocesses=$PYTEST_XDIST_MAXPROCESSES}
env:
PYTEST_XDIST_MAXPROCESSES: ${{ matrix.pytest-xdist-maxprocesses }}