-
Notifications
You must be signed in to change notification settings - Fork 91
133 lines (112 loc) · 3.51 KB
/
build_library.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
name: Library Release Build
on:
push:
branches:
- release-library/**
env:
CARGO_TERM_COLOR: always
RELAY_CARGO_ARGS: "--locked"
jobs:
linux:
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
build-arch:
- x86_64
- aarch64
name: Python Linux ${{ matrix.build-arch }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- if: matrix.build-arch == 'aarch64'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Build in Docker
run: scripts/docker-manylinux.sh
env:
TARGET: ${{ matrix.build-arch }}
- uses: actions/upload-artifact@v4
with:
name: artifact-linux-${{ matrix.build-arch }}
path: py/dist/*
if-no-files-found: 'error'
# since this artifact will be merged, compression is not necessary
compression-level: '0'
macos:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-apple-darwin
py-platform: macosx-13_0_x86_64
- target: aarch64-apple-darwin
py-platform: macosx-14_0_arm64
name: Python macOS ${{ matrix.py-platform }}
runs-on: macos-14
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust Toolchain
run: |
rustup set profile minimal
rustup toolchain install stable
rustup override set stable
rustup target add --toolchain stable ${{ matrix.target }}
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Build Wheel
run: |
pip install wheel
python setup.py bdist_wheel -p ${{ matrix.py-platform }}
working-directory: py
env:
# consumed by cargo and setup.py to obtain the target dir
CARGO_BUILD_TARGET: ${{ matrix.target }}
- uses: actions/upload-artifact@v4
with:
name: artifact-macos-${{ matrix.py-platform }}
path: py/dist/*
if-no-files-found: 'error'
# since this artifact will be merged, compression is not necessary
compression-level: '0'
sdist:
name: Python sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Build sdist
run: python setup.py sdist --format=zip
working-directory: py
- uses: actions/upload-artifact@v4
with:
name: artifact-sdist
path: py/dist/*
if-no-files-found: 'error'
# since this artifact will be merged, compression is not necessary
compression-level: '0'
merge:
name: Create Release Artifact
runs-on: ubuntu-latest
needs: [linux, macos, sdist]
steps:
# Note: due to the immutability of artifacts in upload-artifact v4,
# there cannot be mutliple upload-artifacts with the same name, in a sha's workflow runs.
# However in this case it is fine because this only runs on release-library/** branches,
# and the other runs on release/** branches.
- uses: actions/upload-artifact/merge@v4
with:
# Craft expects release assets to be a single artifact named after the sha.
name: ${{ github.sha }}
pattern: artifact-*
delete-merged: true