-
Notifications
You must be signed in to change notification settings - Fork 19
142 lines (121 loc) · 3.75 KB
/
ci-wheels.yml
File metadata and controls
142 lines (121 loc) · 3.75 KB
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
# Reference:
# - https://github.com/actions/checkout
# - https://github.com/actions/download-artifact
# - https://github.com/actions/upload-artifact
# - https://github.com/pypa/cibuildwheel
# - https://github.com/pypa/build
# - https://github.com/pypa/gh-action-pypi-publish
# - https://test.pypi.org/help/#apitoken
name: ci-wheels
on:
pull_request:
push:
branches:
- "main"
- "v*x"
- "!auto-update-lockfiles"
- "!pre-commit-ci-update-config"
- "!dependabot/*"
tags:
- "v*"
jobs:
build_bdist:
name: "build ${{ matrix.os }} (${{ matrix.arch }}) wheels"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
arch: ["x86_64", "arm64"]
exclude:
- os: "ubuntu-latest"
arch: "arm64"
- os: "windows-latest"
arch: "x86_64"
- os: "windows-latest"
arch: "arm64"
include:
- os: "windows-latest"
arch: "AMD64"
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: "build ${{ matrix.os }} (${{ matrix.arch }}) wheels"
uses: pypa/cibuildwheel@v3.4.1
env:
CIBW_SKIP: "cp39-* cp310-* cp311-* pp* *-musllinux*"
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BUILD_FRONTEND: "build"
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014"
CIBW_TEST_SKIP: "*-macosx_arm64"
CIBW_TEST_REQUIRES: "pytest"
CIBW_TEST_COMMAND: >
python -m pytest --pyargs stratify
- uses: actions/upload-artifact@v7
with:
name: pypi-${{ matrix.os }}-${{ matrix.arch }}-artifact
path: ${{ github.workspace }}/wheelhouse/*.whl
build_sdist:
name: "Build sdist"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: "Building sdist"
shell: bash
run: |
pipx run build --sdist
- uses: actions/upload-artifact@v7
with:
name: pypi-sdist
path: ${{ github.workspace }}/dist/*.tar.gz
show-artifacts:
needs: [build_bdist, build_sdist]
name: "Show artifacts"
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v8
with:
merge-multiple: true
path: ${{ github.workspace }}/dist
- shell: bash
run: |
ls -l ${{ github.workspace }}/dist
publish-artifacts-test-pypi:
needs: [build_bdist, build_sdist]
name: "Publish to Test PyPI"
runs-on: ubuntu-latest
permissions:
id-token: write # Mandatory for PyPI Trusted Publishing OpenID Connect (OIDC)
environment: test-pypi
# upload to Test PyPI for every commit on main branch
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main'
steps:
- uses: actions/download-artifact@v8
with:
merge-multiple: true
path: ${{ github.workspace }}/dist
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
with:
repository_url: https://test.pypi.org/legacy/
skip_existing: true
print_hash: true
publish-artifacts-pypi:
needs: [build_bdist, build_sdist]
name: "Publish to PyPI"
runs-on: ubuntu-latest
permissions:
id-token: write # Mandatory for PyPI Trusted Publishing OpenID Connect (OIDC)
environment: pypi
# upload to PyPI for every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v8
with:
merge-multiple: true
path: ${{ github.workspace }}/dist
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
with:
print_hash: true