-
Notifications
You must be signed in to change notification settings - Fork 7
171 lines (143 loc) · 5.46 KB
/
build-wheels.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
160
161
162
163
164
165
166
167
168
169
170
171
name: Build wheels
on:
workflow_dispatch:
push:
branches:
- release-*
- "*wheel*" # must quote since "*" is a YAML reserved character; we want a string
tags:
- "*"
pull_request:
branches:
- "*wheel*" # must quote since "*" is a YAML reserved character; we want a string
jobs:
generate_backwards_compatibility_data:
name: Generate Backwards Compatibility Data
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
# Based on https://github.com/TileDB-Inc/conda-forge-nightly-controller/blob/51519a0f8340b32cf737fcb59b76c6a91c42dc47/.github/workflows/activity.yml#L19C10-L19C10
- name: Setup git
run: |
git config user.name "GitHub Actions"
git config user.email "runneradmin@users.noreply.github.com"
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Print Python version
run: |
which python
which pip
python --version
- name: Build Indexes
run: |
# Get the release tag.
release_tag=$(git describe --tags --abbrev=0)
echo $release_tag
# Install dependencies.
pip install .
# Generate data.
result=$(python backwards-compatibility-data/generate_data.py $release_tag)
echo "Should we upload these generated indexes? $result"
# Fetch.
echo "git fetch"
git fetch
# Create a new branch for the changes.
branch_name="update-backwards-compatibility-data-${release_tag}"
echo "git checkout -b $branch_name"
git checkout -b "$branch_name"
# Stage all changes within backwards-compatibility-data/data/.
echo "git add backwards-compatibility-data/data/"
git add backwards-compatibility-data/data/
# Commit the staged changes.
echo "git commit -m '[automated] Update backwards-compatibility-data for release $release_tag'"
git commit -m "[automated] Update backwards-compatibility-data for release $release_tag"
# Reset other changes to match main branch - we do this in case the release branch had commits that were not in main.
echo "git reset --hard origin/main"
git reset --hard origin/main
# Re-apply the commit with the backwards-compatibility-data changes.
echo "git cherry-pick HEAD@{1}"
git cherry-pick HEAD@{1}
# Push to the branch.
echo "git push origin $branch_name"
git push origin "$branch_name"
# Create a PR from this new branch to main.
echo "gh pr create"
gh pr create --base main --head "$branch_name" --title "[automated] Update backwards-compatibility-data for release $release_tag" --body "This PR contains backwards compatibility indexes generated for release $release_tag."
env:
GH_TOKEN: ${{ github.token }}
build_wheels:
name: Wheel ${{ matrix.buildplat[0] }}-${{ matrix.buildplat[1] }}-${{ matrix.python }}
runs-on: ${{ matrix.buildplat[0] }}
strategy:
matrix:
buildplat:
- [ubuntu-22.04, manylinux_x86_64]
- [macos-13, macosx_x86_64]
- [macos-13, macosx_arm64]
- [windows-2022, win_amd64]
python: ["cp39", "cp310", "cp311", "cp312", "pp39"]
exclude:
- buildplat: [macos-13, macosx_arm64]
python: "pp39"
steps:
- uses: actions/checkout@v3
- name: "Brew setup on macOS" # x-ref c8e49ba8f8b9ce
if: ${{ startsWith(matrix.os, 'macos-') == true }}
run: |
set -e pipefail
brew update
brew install automake pkg-config ninja llvm
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.5
env:
CIBW_BUILD_VERBOSITY: 3
CIBW_ENVIRONMENT_MACOS: >
CC=clang
CXX=clang++
MACOSX_DEPLOYMENT_TARGET: "12.0"
CIBW_ARCHS: all
CIBW_PRERELEASE_PYTHONS: True
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
with:
output-dir: wheelhouse
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: "./wheelhouse/*.whl"
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist, generate_backwards_compatibility_data]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
outputs:
package_version: ${{ steps.get_package_version.outputs.package_version }}
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- id: get_package_version
run: |
echo "package_version=$(ls dist/ | head -n 1 | cut -d - -f 2)" >> "$GITHUB_OUTPUT"
- name: Upload to test-pypi
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: Upload to pypi
if: ${{ github.event_name != 'workflow_dispatch' }}
uses: pypa/gh-action-pypi-publish@release/v1