-
Notifications
You must be signed in to change notification settings - Fork 40
183 lines (156 loc) · 5.12 KB
/
build.yaml
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: build
on:
push:
pull_request:
jobs:
run-tox-env:
strategy:
matrix:
toxenv: [mypy, twine-check]
py: ["3.x"]
include:
- toxenv: py-mindeps
py: "3.8"
runs-on: ubuntu-latest
name: "Run '${{ matrix.toxenv }}' on python ${{ matrix.py }}"
steps:
- uses: actions/checkout@v4
- name: get date for caching
run: /bin/date -u "+%U" > cachedate.txt
shell: bash
- uses: actions/setup-python@v5
with:
python-version: "${{ matrix.py }}"
cache: "pip"
cache-dependency-path: |
.github/workflows/build.yaml
pyproject.toml
tox.ini
cachedate.txt
- run: python -m pip install tox
- run: python -m tox run -e "${{ matrix.toxenv }}"
# run tests after building an sdist and unpacking it
test-sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: install requirements
run: python -m pip install build tox
- name: build and unpack sdist
run: |
python -m build --sdist
version="$(grep '^version' pyproject.toml | head -n1 | cut -d'"' -f2)"
cd dist
tar -xzf "check_jsonschema-${version}.tar.gz"
- name: test
run: |
version="$(grep '^version' pyproject.toml | head -n1 | cut -d'"' -f2)"
cd "dist/check_jsonschema-${version}"
python -m tox run -m ci
ci-test-matrix:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
py: ['3.8', '3.9', '3.10', '3.11', '3.12']
name: "Run tests on ${{ matrix.os }}, py${{ matrix.py }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: get date for caching
run: /bin/date -u "+%U" > cachedate.txt
shell: bash
- uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ matrix.py }}
cache: "pip"
cache-dependency-path: |
.github/workflows/build.yaml
pyproject.toml
tox.ini
cachedate.txt
- run: python -m pip install tox
- name: cache tox virtualenvs
uses: actions/cache@v4
with:
path: .tox
key: >
tox
os=${{ runner.os }}
python=${{ steps.setup-python.outputs.python-version }}
hash=${{ hashFiles('.github/workflows/build.yaml', 'pyproject.toml', 'tox.ini', 'cachedate.txt') }}
- name: test
run: |
python -m tox run -m ci -- --junitxml pytest.{envname}.xml
python -m tox run -e cov
- uses: actions/upload-artifact@v4
with:
name: pytest-report-py${{ matrix.py }}-${{ matrix.os }}
path: pytest.*.xml
collate-tests:
needs: [ci-test-matrix]
runs-on: ubuntu-latest
name: "Collate results to check for skipped tests"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
# download everything
- uses: actions/download-artifact@v4
with:
path: artifacts/
# collate and report
- run: python ./scripts/aggregate-pytest-reports.py artifacts/*/pytest.*.xml
# this job ensures that any changes to the hook config are reflected properly
# in hook config generation
# if it fails, please see the CONTRIBUTING.md for the repo and read the section titled
# "Adding new hooks"
ensure-catalog-matches-hook-config:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: get date for caching
run: /bin/date -u "+%U" > cachedate.txt
shell: bash
- uses: actions/setup-python@v5
id: setup-python
with:
python-version: "3.x"
cache: "pip"
cache-dependency-path: |
.github/workflows/build.yaml
pyproject.toml
tox.ini
cachedate.txt
- run: python -m pip install tox
- name: regenerate hook config
run: tox run -e generate-hooks-config
- name: fail if .pre-commit-hooks.yaml changed
run: git diff --exit-code -- .pre-commit-hooks.yaml
self-check:
name: "Self-Check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: get date for caching
run: /bin/date -u "+%U" > cachedate.txt
shell: bash
- uses: actions/setup-python@v5
with:
python-version: "3.x"
cache: "pip"
cache-dependency-path: |
.github/workflows/build.yaml
pyproject.toml
tox.ini
cachedate.txt
- name: install from source
run: python -m pip install .
- name: run on own workflows via HTTPS schema
run: check-jsonschema --schemafile "https://json.schemastore.org/github-workflow" .github/workflows/*.yaml
- name: run on own workflows via vendored schema
run: check-jsonschema --builtin-schema vendor.github-workflows .github/workflows/*.yaml