-
-
Notifications
You must be signed in to change notification settings - Fork 18
143 lines (137 loc) · 4.14 KB
/
tests.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
name: Tests
on:
workflow_dispatch:
inputs:
deploy:
description: 'Release this branch'
required: false
type: boolean
release:
types: [ created ]
pull_request:
jobs:
test_alpine:
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
container:
- "python:3.7-alpine"
- "python:3.8-alpine"
- "python:3.9-alpine"
- "python:3.10-alpine"
- "python:3.11-alpine"
steps:
- name: Install packages
# gcc and musl-dev needed for compiling the package
# git needed for checkout
# patchelf needed for auditwheel
run: apk add gcc musl-dev git patchelf
- uses: actions/checkout@v3
with:
submodules: true
- name: Install dependencies
run: pip install tox==4.6.3 tox-gh==1.2.0 auditwheel==5.1.2
- name: Test with tox
run: python -m tox
- name: Audit wheel
run: auditwheel repair .tox/.pkg/dist/*.whl -w audited_wheels
- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: dist
path: audited_wheels/*
test_manylinux:
runs-on: ubuntu-latest
# Need a relatively modern platform (2014) for the actions themselves to work
container: quay.io/pypa/manylinux2014_x86_64
strategy:
fail-fast: false
matrix:
python-version: [cp37-cp37m, cp38-cp38, cp39-cp39, cp310-cp310, cp311-cp311]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python
run: |
echo "/opt/python/${{ matrix.python-version }}/bin" >> $GITHUB_PATH
echo $PATH
- name: Install dependencies
run: pip install tox==4.6.3 tox-gh==1.2.0
- name: Test wheel with tox
run: python -m tox
- name: Audit wheel
run: auditwheel repair .tox/.pkg/dist/*.whl -w audited_wheels
- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: dist
path: audited_wheels/*
test_windows:
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
arch: [x86, x64]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.arch }}
- name: Install dependencies
run: pip install tox==4.6.3 tox-gh==1.2.0
- name: Test with tox
run: python -m tox
- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: dist
path: .tox/.pkg/dist/*
test_mac:
runs-on: macos-13
strategy:
fail-fast: false
matrix:
python-version: [ "3.11" ]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install tox==4.6.3
- name: Test with tox
run: sudo python -m tox -e sdist
- name: Upload dist
uses: actions/upload-artifact@v3
with:
name: dist
path: .tox/.pkg/dist/*
publish:
if: (github.event_name == 'release' && github.event.action == 'created') || inputs.deploy
needs: [test_windows, test_manylinux, test_alpine]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m pip install twine
python -m twine check dist/*
python -m twine upload --skip-existing dist/*