-
Notifications
You must be signed in to change notification settings - Fork 153
149 lines (142 loc) · 4.3 KB
/
ci.yml
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: CI
on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]
workflow_dispatch:
schedule:
# cron is kinda random, assumes 22:00 UTC is a low ebb, eastern
# countries are very early morning, and US are mid-day to
# mid-afternoon
- cron: '0 22 * * 2'
jobs:
checks:
runs-on: ubuntu-latest
steps:
- name: Checkout working copy
uses: actions/checkout@v4
- name: ruff check
uses: chartboost/ruff-action@v1
- name: ruff format
if: always()
uses: chartboost/ruff-action@v1
with:
args: format --diff
- name: Set up Python
id: setup_python
if: always()
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install mypy
id: install_mypy
if: ${{ always() && steps.setup_python.conclusion == 'success' }}
run: |
python -mpip install --upgrade pip
python -mpip install mypy types-PyYaml
- name: mypy
if: ${{ always() && steps.install_mypy.conclusion == 'success' }}
run: mypy
# REPLACE BY: job which python -mbuild, and uploads the sdist and wheel to artifacts
# build is not binary so can just build the one using whatever python version
compile:
runs-on: ubuntu-latest
steps:
- name: Checkout working copy
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependency
run: |
python -mpip install --upgrade pip
python -mpip install build
- name: Build sdist and wheel
run: |
python -mbuild
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
retention-days: 1
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheel
path: dist/*.whl
retention-days: 1
test:
runs-on: ubuntu-latest
needs: compile
continue-on-error: ${{ matrix.python-version == '3.13' || matrix.python-version == 'pypy-3.11' }}
strategy:
fail-fast: false
matrix:
source:
- wheel
- sdist
- source
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "pypy-3.8"
- "pypy-3.9"
- "pypy-3.10"
# - "pypy-3.11"
# don't enable graal because it's slower than even pypy and
# fails because oracle/graalpython#385
# - "graalpy-23"
include:
- source: sdist
artifact: dist/*.tar.gz
- source: wheel
artifact: dist/*.whl
steps:
- name: Checkout working copy
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install test dependencies
run: |
python -mpip install --upgrade pip
# cyaml is outright broken on pypy
if ! ${{ startsWith(matrix.python-version, 'pypy-') }}; then
# if binary wheels are not available for the current
# package install libyaml-dev so we can install pyyaml
# from source
if ! pip download --only-binary pyyaml -rrequirements_dev.txt > /dev/null 2>&1; then
sudo apt install libyaml-dev
fi
fi
python -mpip install pytest pyyaml
# re2 is basically impossible to install from source so don't
# bother, and suppress installation failure so the test does
# not fail (re2 tests will just be skipped for versions /
# implementations for which google does not provide a binary
# wheel)
python -mpip install --only-binary :all: google-re2 || true
- name: download ${{ matrix.source }} artifact
if: matrix.artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.source }}
path: dist/
- name: install package in environment
run: |
pip install ${{ matrix.artifact || '.' }}
- name: run tests
run: pytest -v -Werror -Wignore::ImportWarning --doctest-glob="*.rst" -ra