-
Notifications
You must be signed in to change notification settings - Fork 477
188 lines (171 loc) · 6.82 KB
/
pr-test.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
name: PyTest PyBoy
on:
push:
branches:
- master
pull_request:
release:
types: [published]
jobs:
test_cython:
name: Cython - Build, Test and Deploy
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: [3.8, 3.9, "3.10", 3.11, 3.12]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
pip install --upgrade pip
pip install --upgrade wheel setuptools
pip install --prefer-binary -r requirements.txt
pip install --prefer-binary -r requirements_tests.txt
- name: Doctest
if: ${{ !contains(matrix.os, 'windows') }}
run: |
python -m pytest pyboy/ -n auto
- name: Build PyBoy
run: |
python setup.py build_ext -j $(getconf _NPROCESSORS_ONLN) --inplace
- name: Setup Ubuntu - OpenGL dependencies
if: ${{ contains(matrix.os, 'ubuntu') }}
run: |
sudo apt update
sudo apt install libopengl0 freeglut3-dev
- name: Run PyTest
env:
PYTEST_SECRETS_KEY: ${{ secrets.PYTEST_SECRETS_KEY }}
TEST_CI: 1
TEST_NO_UI: 1
run: |
python -m pytest tests/ -n auto -v
- name: Build wheel
run: |
echo "Building wheel"
pip install wheel twine
python setup.py sdist bdist_wheel
- name: Upload wheel
if: ${{ github.event_name == 'release' && github.event.action == 'published' && !github.event.release.prerelease && !contains(matrix.os, 'ubuntu') }}
run: |
echo "Uploading wheel"
python -m twine upload --non-interactive -u '__token__' -p ${{ secrets.PYPI_API_TOKEN }} dist/*.whl
echo "Uploading source code"
python -m twine upload --non-interactive --skip-existing -u '__token__' -p ${{ secrets.PYPI_API_TOKEN }} dist/*.tar.gz
- name: Upload wheel [TEST]
if: ${{ github.event_name == 'release' && github.event.action == 'published' && github.event.release.prerelease && !contains(matrix.os, 'ubuntu') }}
run: |
echo "Uploading wheel"
python -m twine upload --repository testpypi --non-interactive -u '__token__' -p ${{ secrets.PYPI_TEST_API_TOKEN }} dist/*.whl
echo "Uploading source code"
python -m twine upload --repository testpypi --non-interactive --skip-existing -u '__token__' -p ${{ secrets.PYPI_TEST_API_TOKEN }} dist/*.tar.gz
test_pypy:
name: PyPy - Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ['pypy-3.9'] # TODO: 'pypy-3.10'
steps:
- uses: actions/checkout@v3
- name: Setup macOS
if: ${{ contains(matrix.os, 'macos-latest') }}
run: |
# Fix cryptography build: https://github.com/pyca/cryptography/issues/3489
brew install openssl
echo "CPPFLAGS=-I/usr/local/opt/openssl/include" >> $GITHUB_ENV
echo "LDFLAGS=-L/usr/local/opt/openssl/lib" >> $GITHUB_ENV
- name: Setup Ubuntu - OpenGL dependencies
if: ${{ contains(matrix.os, 'ubuntu') }}
run: |
sudo apt update
sudo apt install libopengl0 freeglut3-dev
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install PyPy dependencies
run: |
pypy3 -m ensurepip
pypy3 -m pip install --upgrade pip
pypy3 -m pip install wheel
pypy3 -m pip install --prefer-binary -r requirements.txt
pypy3 -m pip install --prefer-binary -r requirements_tests.txt
- name: Doctest
if: ${{ !contains(matrix.os, 'windows') }}
run: |
pypy3 -m pytest pyboy/ -n auto
- name: Run PyTest
env:
PYTEST_SECRETS_KEY: ${{ secrets.PYTEST_SECRETS_KEY }}
TEST_CI: 1
TEST_NO_UI: 1
run: |
pypy3 -m pytest tests/ -n auto -v
test_manylinux:
name: ManyLinux - Build, Test and Deploy
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['cp38-cp38', 'cp39-cp39', 'cp310-cp310', 'cp311-cp311', 'cp312-cp312']
manylinux-version: ['manylinux_2_28_x86_64', 'musllinux_1_2_x86_64'] # GHA doesn't support manylinux_2_24_aarch64
steps:
- uses: actions/checkout@v3
- name: Docker Run Action
uses: addnab/docker-run-action@v3
with:
image: quay.io/pypa/${{ matrix.manylinux-version }}:latest
options: -v ${{ github.workspace }}:/work -e GITHUB_REF=${{ github.ref }} --rm
run: |
set -e
echo "Linking Python version ${{ matrix.python-version }}"
ln -s "/opt/python/${{ matrix.python-version }}/bin/python3" /usr/local/bin/python
if [[ "${{ matrix.manylinux-version }}" == "manylinux_2_28_x86_64" ]]; then
dnf install libjpeg-devel -y
else
apk add libjpeg jpeg-dev libffi
python -m ensurepip
fi
cd /work
echo "Starting build"
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
echo "Starting tests"
python -m pip install --prefer-binary -r requirements.txt
python setup.py build_ext -j $(getconf _NPROCESSORS_ONLN) --inplace
python -m pip install --prefer-binary -r requirements_tests.txt
PYTEST_SECRETS_KEY=${{ secrets.PYTEST_SECRETS_KEY }} TEST_CI=1 TEST_NO_UI=1 python -m pytest tests/ -n2 -v
echo "Building wheel"
python -m pip install wheel
python setup.py sdist bdist_wheel
python -m pip install auditwheel
auditwheel repair dist/*.whl
rm -rf dist/*.whl
mv wheelhouse/*.whl dist/
chmod 777 -R . # Fix permissions to help cleaning up outside of Docker
echo "Dists built:"
ls -lah dist/
- name: Set up Python 3.8 (just for PyPi upload)
uses: actions/setup-python@v3
with:
python-version: 3.8
- name: Upload wheel
if: ${{ github.event_name == 'release' && github.event.action == 'published' && !github.event.release.prerelease }}
run: |
echo "Uploading wheel"
pip install twine
python -m twine upload --non-interactive -u '__token__' -p ${{ secrets.PYPI_API_TOKEN }} dist/*.whl
- name: Upload wheel [TEST]
if: ${{ github.event_name == 'release' && github.event.action == 'published' && github.event.release.prerelease }}
run: |
echo "Uploading wheel"
pip install twine
python -m twine upload --repository testpypi --non-interactive -u '__token__' -p ${{ secrets.PYPI_TEST_API_TOKEN }} dist/*.whl