65 lines (57 loc) · 1.86 KB
/
deploy-wheels-native.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
name: Deploy Windows/macOS/native Linux wheels
on:
push:
branches:
- main
pull_request:
paths:
- ".github/workflows/deploy-wheels-native.yml"
release:
types:
- published
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macOS-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow
- uses: actions/setup-python@v2
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.3.0
- name: Build wheels
run: python -m cibuildwheel --output-dir dist
# Options are supplied via environment variables:
env:
# Build separate wheels for macOS's different architectures.
CIBW_ARCHS_MACOS: "x86_64 arm64"
# Build only on Linux architectures that don't need qemu emulation.
CIBW_ARCHS_LINUX: "x86_64 i686"
# Don't build with prerelease Python versions.
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.6,<3.11"
# Run the test suite after each build.
CIBW_TEST_REQUIRES: "pytest"
CIBW_TEST_COMMAND: pytest {package}/tests
- name: Upload as build artifacts
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist/*.whl
- name: Publish package to PyPI
if: github.event.action == 'published'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: twine upload --skip-existing dist/*.whl
- name: Publish package to TestPyPI
if: |
github.repository == 'ultrajson/ultrajson' &&
github.ref == 'refs/heads/main'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.test_pypi_password }}
run: |
twine upload --repository-url https://test.pypi.org/legacy/ --skip-existing dist/*.whl