-
-
Notifications
You must be signed in to change notification settings - Fork 44
124 lines (101 loc) · 3.25 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
name: Build, test and upload to PyPI
# Build on every branch push, tag push, and pull request change:
on: [push, pull_request]
jobs:
doctest:
name: All tests, on current Python
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11']
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Build the libpg_query library
run: |
make -C libpg_query build
- name: Build the extension module
run: |
python setup.py build_ext --inplace
- name: Install the module itself in development mode
run: |
python -m pip install -e .
- name: Execute the test suite
run: |
python -m pytest --cov-report=xml tests/
make -C docs doctest
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
build_wheels:
name: Build wheels on ${{ matrix.arch }} for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-12]
arch: [auto]
include:
- os: ubuntu-22.04
arch: aarch64
- os: windows-2022
arch: x86
- os: windows-2022
arch: AMD64
- os: macos-14
arch: arm64
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true
- name: Set up QEMU
if: ${{ matrix.arch == 'aarch64' }}
uses: docker/setup-qemu-action@v3
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Set up MSVC CLI tools
if: ${{ matrix.os == 'windows-2022' }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_TEST_REQUIRES: "coverage pytest pytest-cov"
CIBW_TEST_COMMAND: "py.test {project}/tests"
CIBW_SKIP: "cp36* cp37* cp38* pp*"
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_PRERELEASE_PYTHONS: True
# Skip tests on emulated hardware, take too long or not supported
CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le} *-macosx_*:arm64"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-for-${{ matrix.os }}-${{ matrix.arch }}
path: ./wheelhouse/*.whl
upload_pypi:
name: Upload wheels to PyPI
needs: build_wheels
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: wheels-for-*
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}