-
Notifications
You must be signed in to change notification settings - Fork 1
127 lines (119 loc) · 3.8 KB
/
python.yaml
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
on:
push:
branches: [ main ]
tags: [ v* ]
pull_request:
branches: [ main ]
name: Build, Test and Publish Python Bindings
jobs:
test:
strategy:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Python tooling
run: |
python -m pip install hatch
- name: Run Python tests
run: |
hatch run test
build-sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pypa/build
run: |
python -m pip install build
- name: Build source distribution
run: |
python -m build --sdist
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: python-artifacts
path: dist
build-wheels:
strategy:
fail-fast: false
matrix:
config:
- { os: ubuntu-latest, target: 'x86_64' }
- { os: ubuntu-latest, target: 'x86' }
- { os: ubuntu-latest, target: 'aarch64' }
- { os: windows-latest, target: 'x64' }
- { os: windows-latest, target: 'x86' }
- { os: macos-latest, target: 'x86_64' }
- { os: macos-latest, target: 'aarch64' }
runs-on: ${{ matrix.config.os }}
name: Build wheels for ${{ matrix.config.os }} (${{ matrix.config.target }})
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
if: matrix.config.os == 'windows-latest'
with:
python-version: "3.x"
architecture: ${{ matrix.config.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.config.target }}
args: --release --out dist --features openssl-vendored
manylinux: manylinux2014
before-script-linux: |
# If we're running on RHEL centos, install needed packages.
if command -v yum &> /dev/null; then
yum update -y && yum install -y perl-core libatomic
# If we're running on i686 we need to symlink libatomic
# in order to build openssl with -latomic flag.
if [[ ! -d "/usr/lib64" ]]; then
ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so
fi
fi
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: python-artifacts
path: dist
# This assumes a PyPI Trusted Publisher has been configure for the `outpack_query_parser` package.
# See https://docs.pypi.org/trusted-publishers/ for more details.
publish-to-pypi:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
name: Publish Python distribution to PyPI
needs:
- build-sdist
- build-wheels
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/outpack_query_parser
permissions:
# This permission is needed for the workflow to authenticate against PyPI
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-artifacts
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1