-
Notifications
You must be signed in to change notification settings - Fork 18
116 lines (95 loc) · 2.88 KB
/
python.yml
File metadata and controls
116 lines (95 loc) · 2.88 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: ttx-diff CI/CD
on:
push:
branches:
- main
paths:
- 'ttx_diff/**'
- '.github/workflows/python.yml'
tags:
- 'ttx-diff-v*'
pull_request:
paths:
- 'ttx_diff/**'
- '.github/workflows/python.yml'
workflow_dispatch:
jobs:
test:
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.10', '3.13']
# TODO: Re-enable 3.14 once gftools updates pygit2 pin from 1.16.0
# https://github.com/googlefonts/gftools/blob/d4c06f5d88e0a849fabf7089d80835a96dc42f30/pyproject.toml#L47-L49
steps:
- uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install package with test dependencies
working-directory: ttx_diff
run: pip install -e ".[test]"
- name: Run tests
working-directory: ttx_diff
run: pytest -v
lint:
name: Lint and format check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Check package builds
working-directory: ttx_diff
run: pipx run build
- name: Install package with dev dependencies
working-directory: ttx_diff
run: pip install --find-links=dist 'ttx-diff[dev]'
- name: Check formatting with ruff
working-directory: ttx_diff
run: ruff format --check src/ tests/
- name: Lint with ruff
working-directory: ttx_diff
run: ruff check src/ tests/
build:
name: Build distribution
runs-on: ubuntu-latest
needs: [test, lint]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/ttx-diff-v')
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.x"
- name: Build package
working-directory: ttx_diff
run: pipx run build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: python-packages
path: ttx_diff/dist/
publish-pypi:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/ttx-diff-v')
permissions:
id-token: write # Required for trusted publishing
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: python-packages
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/