Skip to content

Commit c2c43e4

Browse files
authored
CI improvements (#362)
1 parent 4e98731 commit c2c43e4

File tree

6 files changed

+216
-191
lines changed

6 files changed

+216
-191
lines changed

.github/workflows/check.yaml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
name: check
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches: ["main"]
6+
tags-ignore: ["**"]
7+
pull_request:
8+
schedule:
9+
- cron: "0 8 * * *"
10+
11+
concurrency:
12+
group: check-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
test:
17+
name: test ${{ matrix.py }} - ${{ matrix.os }}
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
py:
23+
- "pypy3.10" # ahead to start it earlier because takes longer
24+
- "3.13"
25+
- "3.12"
26+
- "3.11"
27+
- "3.10"
28+
- "3.9"
29+
- "3.8"
30+
os:
31+
- ubuntu-latest
32+
- windows-latest
33+
- macos-latest
34+
35+
steps:
36+
- uses: actions/checkout@v4
37+
with:
38+
fetch-depth: 0
39+
- name: Install the latest version of uv
40+
uses: astral-sh/setup-uv@v3
41+
with:
42+
enable-cache: true
43+
cache-dependency-glob: "pyproject.toml"
44+
github-token: ${{ secrets.GITHUB_TOKEN }}
45+
- name: Add .local/bin to Windows PATH
46+
if: runner.os == 'Windows'
47+
shell: bash
48+
run: echo "$USERPROFILE/.local/bin" >> $GITHUB_PATH
49+
- name: Install tox
50+
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv
51+
- name: Install Python
52+
run: uv python install --python-preference only-managed ${{ matrix.py }}
53+
- name: Setup test suite
54+
run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.py }}
55+
- name: Run test suite
56+
if: ${{ !startsWith(matrix.py, 'pypy')}}
57+
run: tox run --skip-pkg-install -e ${{ matrix.py }}
58+
env:
59+
PYTEST_ADDOPTS: "-vv --durations=20"
60+
DIFF_AGAINST: HEAD
61+
- name: Run test suite without coverage
62+
if: ${{ startsWith(matrix.py, 'pypy')}}
63+
run: tox run --skip-pkg-install -e ${{ matrix.py }} --
64+
env:
65+
PYTEST_ADDOPTS: "-vv --durations=20"
66+
- name: Rename coverage report file
67+
if: ${{ !startsWith(matrix.py, 'pypy')}}
68+
run: |
69+
import os; import sys
70+
os.rename(f".tox/.coverage.${{ matrix.py }}", f".tox/.coverage.${{ matrix.py }}-{sys.platform}")
71+
shell: python
72+
- name: Upload coverage data
73+
if: ${{ !startsWith(matrix.py, 'pypy')}}
74+
uses: actions/upload-artifact@v4
75+
with:
76+
include-hidden-files: true
77+
name: .coverage.${{ matrix.os }}.${{ matrix.py }}
78+
path: ".tox/.coverage.*"
79+
retention-days: 3
80+
81+
coverage:
82+
name: Combine coverage
83+
runs-on: ubuntu-latest
84+
needs: test
85+
steps:
86+
- uses: actions/checkout@v4
87+
with:
88+
fetch-depth: 0
89+
- name: Install the latest version of uv
90+
uses: astral-sh/setup-uv@v3
91+
with:
92+
enable-cache: true
93+
cache-dependency-glob: "pyproject.toml"
94+
github-token: ${{ secrets.GITHUB_TOKEN }}
95+
- name: Add .local/bin to Windows PATH
96+
if: runner.os == 'Windows'
97+
shell: bash
98+
run: echo "$USERPROFILE/.local/bin" >> $GITHUB_PATH
99+
- name: Install hatch
100+
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv
101+
- name: Build package to generate version
102+
run: uv build --python 3.13 --python-preference only-managed --wheel . --out-dir dist
103+
- name: Setup coverage tool
104+
run: tox -e coverage --notest
105+
- name: Download coverage data
106+
uses: actions/download-artifact@v4
107+
with:
108+
path: .tox
109+
pattern: .coverage.*
110+
merge-multiple: true
111+
- name: Combine and report coverage
112+
run: tox -e coverage --skip-pkg-install
113+
- name: Upload HTML report
114+
uses: actions/upload-artifact@v4
115+
with:
116+
name: html-report
117+
path: .tox/htmlcov
118+
119+
check:
120+
name: ${{ matrix.tox_env }} - ${{ matrix.os }}
121+
runs-on: ${{ matrix.os }}
122+
strategy:
123+
fail-fast: false
124+
matrix:
125+
os:
126+
- ubuntu-latest
127+
- windows-latest
128+
tox_env:
129+
- dev
130+
- type
131+
- docs
132+
- readme
133+
exclude:
134+
- { os: windows-latest, tox_env: readme }
135+
steps:
136+
- uses: actions/checkout@v4
137+
with:
138+
fetch-depth: 0
139+
- name: Install the latest version of uv
140+
uses: astral-sh/setup-uv@v3
141+
with:
142+
enable-cache: true
143+
cache-dependency-glob: "pyproject.toml"
144+
github-token: ${{ secrets.GITHUB_TOKEN }}
145+
- name: Add .local/bin to Windows PATH
146+
if: runner.os == 'Windows'
147+
shell: bash
148+
run: echo "$USERPROFILE/.local/bin" >> $GITHUB_PATH
149+
- name: Install tox
150+
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv
151+
- name: Setup test suite
152+
run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.tox_env }}
153+
- name: Run test suite
154+
run: tox run --skip-pkg-install -e ${{ matrix.tox_env }}

.github/workflows/check.yml

Lines changed: 0 additions & 154 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release to PyPI
2+
on:
3+
push:
4+
tags: ["*"]
5+
6+
env:
7+
dists-artifact-name: python-package-distributions
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- name: Install the latest version of uv
17+
uses: astral-sh/setup-uv@v3
18+
with:
19+
enable-cache: true
20+
cache-dependency-glob: "pyproject.toml"
21+
github-token: ${{ secrets.GITHUB_TOKEN }}
22+
- name: Build package
23+
run: uv build --python 3.13 --python-preference only-managed --sdist --wheel . --out-dir dist
24+
- name: Store the distribution packages
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: ${{ env.dists-artifact-name }}
28+
path: dist/*
29+
30+
release:
31+
needs:
32+
- build
33+
runs-on: ubuntu-latest
34+
environment:
35+
name: release
36+
url: https://pypi.org/project/filelock/${{ github.ref_name }}
37+
permissions:
38+
id-token: write
39+
steps:
40+
- name: Download all the dists
41+
uses: actions/download-artifact@v4
42+
with:
43+
name: ${{ env.dists-artifact-name }}
44+
path: dist/
45+
- name: Publish to PyPI
46+
uses: pypa/[email protected]
47+
with:
48+
attestations: true

.github/workflows/release.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)