-
Notifications
You must be signed in to change notification settings - Fork 14
159 lines (141 loc) · 4.26 KB
/
build-upload.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
155
156
157
158
159
name: Build and upload to PyPI
on:
push:
tags:
- '**'
branches-ignore:
- "dependabot/**"
- "pre-commit-ci-update-config"
pull_request:
concurrency:
group: build-upload-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: pre-commit/[email protected]
build_wheels:
name: Build ${{ matrix.archs }} ${{ matrix.build }} wheels on ${{ matrix.os }}
needs: [lint]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
archs: ["x86_64, i686", "aarch64", "ppc64le", "s390x"]
build: ["manylinux", "musllinux"]
include:
- os: windows-2019
archs: "AMD64"
- os: windows-2019
archs: "x86"
- os: windows-2019
archs: "ARM64"
- os: macos-13
archs: "x86_64"
- os: macos-14
archs: "arm64"
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up QEMU
uses: docker/[email protected]
if: runner.os == 'Linux'
# see https://cibuildwheel.pypa.io/en/stable/faq/#macos-building-cpython-38-wheels-on-arm64
- name: "Install python 3.8 universal2 on macOS arm64"
if: runner.os == 'macOS' && runner.arch == 'ARM64'
uses: actions/setup-python@v5
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
with:
python-version: 3.8
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS: "${{ matrix.archs }}"
CIBW_BUILD: "${{ matrix.build && '*-' || ''}}${{ matrix.build }}*"
CIBW_PRERELEASE_PYTHONS: "${{ !startsWith(github.ref, 'refs/tags/v') }}"
- uses: actions/upload-artifact@v4
with:
name: "cibw-wheels ${{ matrix.build || matrix.os }} ${{ matrix.archs }}"
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
needs: [lint]
runs-on: ubuntu-22.04
env:
CIBUILDWHEEL: 1 # make C extension mandatory
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Build sdist
run: pipx run build --sdist
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.11"
- name: Install
run: python -m pip install ${{ github.workspace }}/dist/pybase64*.tar.gz
working-directory: "${{ runner.temp }}"
- name: Test
run: |
python -m pip install -r requirements-test.txt
pytest
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
upload_test_pypi:
name: Upload to Test PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-22.04
if: github.event_name == 'push' && github.repository == 'mayeut/pybase64'
environment:
name: test-pypi
url: https://test.pypi.org/p/pybase64
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- name: Upload to Test PyPI
uses: pypa/[email protected]
with:
skip-existing: true
repository-url: https://test.pypi.org/legacy/
upload_pypi:
name: Upload to PyPI
needs: [upload_test_pypi]
runs-on: ubuntu-22.04
if: github.event_name == 'push' && github.repository == 'mayeut/pybase64' && startsWith(github.ref, 'refs/tags/v')
environment:
name: pypi
url: https://pypi.org/p/pybase64
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- name: Upload to PyPI
uses: pypa/[email protected]
with:
skip-existing: true