-
Notifications
You must be signed in to change notification settings - Fork 0
219 lines (195 loc) · 6.92 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
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
name: CI
on:
push:
paths:
- '**'
- '!.github/**'
- '.github/workflows/ci.yml'
pull_request:
paths:
- '**'
- '!.github/**'
- '.github/workflows/ci.yml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
ci:
strategy:
# Allows for matrix sub-jobs to fail without canceling the rest
fail-fast: false
# MATRIX:
# =======
# Required parameters:
# os the os to run on
# python-version the python version to use
# backend the backend to use
# env any additional env variables. Set to '{}' for none
# Optional parameters:
# allowed_failure whether the job is allowed to fail
# extra_hash extra hash str to differentiate from other caches with similar name (must always start with '-')
matrix:
# Tests [amd64]
#
os: [ubuntu-latest, macos-latest, windows-2019]
python-version:
- "2.7"
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10" # quotes to avoid being interpreted as the number 3.1
- "3.11"
- "3.12-dev"
env: [{ STATIC_DEPS: true }, { STATIC_DEPS: false }]
include:
#- os: windows-2016
# python-version: 2.7
# env: { STATIC_DEPS: true } # always static
- python-version: "3.12-dev"
allowed_failure: true
- os: ubuntu-latest
python-version: "3.9"
env: {STATIC_DEPS: true, WITH_REFNANNY: true}
extra_hash: "-refnanny"
allowed_failure: true
- os: ubuntu-latest
python-version: "3.11"
env: {STATIC_DEPS: true, WITH_REFNANNY: true}
extra_hash: "-refnanny"
allowed_failure: true
# Coverage setup
- os: ubuntu-latest
python-version: "3.9"
env: { COVERAGE: true }
extra_hash: "-coverage"
allowed_failure: true # shouldn't fail but currently does...
- os: ubuntu-latest
python-version: "3.9"
env: { STATIC_DEPS: false, EXTRA_DEPS: "docutils pygments sphinx sphinx-rtd-theme" }
extra_hash: "-docs"
allowed_failure: true # shouldn't fail but currently does...
# Old library setup with minimum version requirements
- os: ubuntu-latest
python-version: "3.9"
env: {
STATIC_DEPS: true,
LIBXML2_VERSION: 2.9.2,
LIBXSLT_VERSION: 1.1.27,
}
extra_hash: "-oldlibs"
allowed_failure: true # shouldn't fail but currently does...
# Ubuntu sub-jobs:
# ================
# Pypy
- os: ubuntu-latest
python-version: pypy-2.7
env: { STATIC_DEPS: false }
allowed_failure: true
- os: ubuntu-latest
python-version: pypy-3.7
env: { STATIC_DEPS: false }
allowed_failure: true
- os: ubuntu-latest
python-version: pypy-3.8
env: { STATIC_DEPS: false }
allowed_failure: true
# MacOS sub-jobs
# ==============
#- os: macos-latest
# allowed_failure: true # Unicode parsing fails in Py3
exclude:
- os: ubuntu-latest
python-version: "3.6"
# Windows sub-jobs
# ==============
- os: windows-2019
python-version: 2.7 # needs older image
- os: windows-2019
env: { STATIC_DEPS: false } # always static
# This defaults to 360 minutes (6h) which is way too long and if a test gets stuck, it can block other pipelines.
# From testing, the runs tend to take 3-8 minutes, so a limit of 30 minutes should be enough.
timeout-minutes: 30
runs-on: ${{ matrix.os }}
env:
OS_NAME: ${{ matrix.os }}
PYTHON_VERSION: ${{ matrix.python-version }}
MACOSX_DEPLOYMENT_TARGET: 11.0
LIBXML2_VERSION: 2.10.4
LIBXSLT_VERSION: 1.1.38
COVERAGE: false
GCC_VERSION: 9
USE_CCACHE: 1
CCACHE_SLOPPINESS: "pch_defines,time_macros"
CCACHE_COMPRESS: 1
CCACHE_MAXSIZE: "100M"
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Setup Python
uses: actions/setup-python@v4
if: startsWith(matrix.python-version, '3.')
with:
python-version: ${{ matrix.python-version }}
- name: Setup Python2 (Linux)
if: matrix.python-version == '2.7' && startsWith(matrix.os, 'ubuntu')
run: |
sudo ln -fs python2 /usr/bin/python
sudo apt-get update
sudo apt-get install python-setuptools python2-dev
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
sudo python2 get-pip.py
ls -l /usr/bin/pip* /usr/local/bin/pip*
which pip
- name: Install MacOS dependencies
if: startsWith(runner.os, 'mac')
run: |
brew install automake libtool ccache
ln -s /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
- name: Cache [ccache]
uses: pat-s/[email protected]
if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'mac')
with:
path: ~/.ccache
key: ${{ runner.os }}-ccache${{ matrix.extra_hash }}-${{ matrix.python-version }}-${{ hashFiles('.github/workflows/ci.yml', 'tools/ci-run.sh') }}
- name: Cache [libs]
uses: actions/cache@v3
if: matrix.env.STATIC_DEPS
with:
path: |
libs/*.xz
libs/*.gz
libs/*.zip
key: libs-${{ runner.os }}-${{ env.LIBXML2_VERSION }}-${{ env.LIBXSLT_VERSION }}${{ matrix.extra_hash }}
- name: Run CI
continue-on-error: ${{ matrix.allowed_failure || false }}
env: ${{ matrix.env }}
run: bash -c 'GITHUB_API_TOKEN="${{ secrets.GITHUB_TOKEN }}" bash ./tools/ci-run.sh'
- name: Build docs
if: contains( matrix.env.EXTRA_DEPS, 'sphinx')
run: make html
- name: Upload docs
uses: actions/upload-artifact@v3
if: matrix.extra_hash == '-docs'
with:
name: website_html
path: doc/html
if-no-files-found: ignore
- name: Upload Coverage Report
uses: actions/upload-artifact@v3
with:
name: pycoverage_html
path: coverage*
if-no-files-found: ignore
- name: Upload Wheel
uses: actions/upload-artifact@v3
if: matrix.env.STATIC_DEPS
with:
name: wheels-${{ runner.os }}
path: dist/*.whl
if-no-files-found: ignore