forked from copier-org/copier
-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (108 loc) · 3.15 KB
/
ci.yml
File metadata and controls
116 lines (108 loc) · 3.15 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
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=pypi depName=uv
UV_VERSION: "0.7.1"
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Needs all tags to compute dynamic version
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: ${{ env.UV_VERSION }}
enable-cache: "true"
cache-suffix: ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
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 .
- 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 }}
flake-check:
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
runs-on: ${{ matrix.os }}
permissions:
contents: write # Allow pushing back pre-commit changes
steps:
- uses: actions/checkout@v4
# Install Nix
- uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixos-unstable
# Set up Cachix
- uses: cachix/cachix-action@v16
with:
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
extraPullNames: devenv
name: copier
pushFilter: (-source$|nixpkgs\.tar\.gz$)
# Install devenv
- run: nix-env -iA devenv -f '<nixpkgs>'
# Cache for uv venv when using direnv
- uses: actions/cache@v4
with:
path: |
.cache
.devenv
.direnv
# prettier-ignore
key:
direnv-
${{ runner.os }}-
${{ runner.arch }}-
${{ hashFiles('pyproject.toml', '*.lock', '*.nix') }}
# Check direnv works as expected
- uses: JRMurr/direnv-nix-action@v4.2.0
with:
install-nix: "false"
cache-store: "false"
- run: uv run copier --version
# Run tests
- run: devenv test