forked from python-rapidjson/python-rapidjson
-
Notifications
You must be signed in to change notification settings - Fork 0
154 lines (127 loc) · 3.95 KB
/
main.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
# -*- coding: utf-8 -*-
# :Project: python-rapidjson -- Github Actions configuration
# :Created: Fri Oct 2 06:52:59 2020 CEST
# :Author: Martin Thoma <[email protected]>
# :License: MIT License
# :Copyright: © 2020 Martin Thoma
# :Copyright: © 2020, 2021, 2022, 2023 Lele Gaifax
#
# For more information see:
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
# and
# https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
name: Build, test and upload to PyPI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
tests:
name: All tests, on current Python
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -r requirements-test.txt
pip install .
- name: Tests
run: |
pytest tests
- name: Doctests
run: |
make -C docs doctest -e PYTHON=$(which python3)
debug-tests:
name: Memory leak tests, on current debug build Python
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: deadsnakes/[email protected]
with:
python-version: ${{ matrix.python-version }}
debug: true
- name: Install dependencies
run: |
pip install -r requirements-test.txt
pip install .
- run: |
pytest tests
build_wheels:
name: Build wheels on ${{matrix.arch}} for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-22.04
- macos-12
- windows-2019
- macos-13-xlarge # Apple silicon mac
arch:
- auto
include:
- os: ubuntu-22.04
arch: aarch64
- os: ubuntu-22.04
arch: ppc64le
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- uses: docker/setup-qemu-action@v3
if: ${{ matrix.arch == 'aarch64' || matrix.arch == 'ppc64le' }}
name: Set up QEMU
- name: Install pipx
if: ${{ matrix.os == 'macos-13-xlarge' }}
run: |
pip install pipx
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS_LINUX: ${{matrix.arch}}
CIBW_ARCHS_MACOS: ${{ matrix.arch == 'arm64' && 'arm64' || 'auto' }}
CIBW_TEST_REQUIRES: "pytest pytest-benchmark pytz"
CIBW_TEST_COMMAND: "pytest {project}/tests"
CIBW_SKIP: "cp2* cp33* cp34* cp35* cp36* cp37* pp*"
CIBW_PRERELEASE_PYTHONS: True
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
upload_wheels:
name: Upload wheels
needs: build_wheels
runs-on: ubuntu-latest
# Upload to PyPI on every tag starting with 'v'
# FIXME: for some reason, the job is skipped, although the configuration is
# almost identical to the one I use on pglast... let's try to temporarily
# remove the condition
#if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}