-
Notifications
You must be signed in to change notification settings - Fork 164
94 lines (85 loc) · 3.17 KB
/
wheel-builder.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
# This is based on pyca/cryptography but we use cibuildwheel
# https://github.com/pyca/cryptography/blob/50ae9623df9181e5d08bbca0791ae69af4d3d446/.github/workflows/wheel-builder.yml
name: Wheel Builder
permissions:
contents: read
on:
workflow_dispatch:
inputs:
version:
description: The Git ref to build
# Do not add any non-tag push events without updating pypi-publish.yml. If
# you do, it'll upload wheels to PyPI.
push:
tags:
- "*"
pull_request:
paths:
- .github/workflows/wheel-builder.yml
- setup.py
- pyproject.toml
jobs:
sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
# The tag to build or the tag received by the tag event
ref: ${{ github.event.inputs.version || github.ref }}
persist-credentials: false
- run: python -m venv .venv
- name: Install Python dependencies
run: .venv/bin/pip install -U pip build
- name: Make sdist
run: .venv/bin/python -m build --sdist
- name: Set SOURCE_DATE_EPOCH to last commit for reproducible build
run: |
echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)"
echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
- name: Repackage using SOURCE_DATE_EPOCH
run: |
set -xe
cd dist
targzname=$(find . -type f -name '*.tar.gz' -print0 | xargs -0 realpath)
tarname="${targzname%.gz}"
mkdir scratch
tar xf "$targzname" -C scratch
# cd into scratch so we can glob all files with `*`. Other approaches
# like `-C scratch .` adds a leading `./` to the archive names.
pushd scratch
tar --sort=name --mtime="@$SOURCE_DATE_EPOCH" \
--owner=0 --group=0 --numeric-owner \
-cf "$tarname" -- *
popd
gzip --no-name "$tarname"
rm -rf scratch
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: sdist
path: dist/*.tar.gz
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019, macos-11]
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
# The tag to build or the tag received by the tag event
ref: ${{ github.event.inputs.version || github.ref }}
persist-credentials: false
- name: Set SOURCE_DATE_EPOCH to last commit for reproducible build
run: |
echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)"
echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
- name: Build wheels
uses: pypa/cibuildwheel@39a63b5912f086dd459cf6fcb13dcdd3fe3bc24d # v2.15.0
env:
CIBW_BUILD: cp311-macosx_arm64 cp311-win_amd64 cp311-manylinux_x86_64
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: wheels
path: ./wheelhouse/*.whl