-
Notifications
You must be signed in to change notification settings - Fork 16
112 lines (109 loc) · 4.15 KB
/
build.yml
File metadata and controls
112 lines (109 loc) · 4.15 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
name: Build
on:
pull_request:
push:
branches: [main]
release:
types: [published]
jobs:
build-sdist:
name: Build Sdist
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Set up pixi
uses: prefix-dev/setup-pixi@a0af7a228712d6121d37aba47adf55c1332c9c2e # v0.9.4
with:
environments: build
- name: Set version
run: pixi run -e build set-version
- name: Build project
run: pixi run -e build build-sdist
- name: Upload package
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: sdist
path: dist/*
build-wheel:
name: Build Wheel (${{ matrix.target-platform }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target-platform: linux-64
os: ubuntu-latest
- target-platform: linux-aarch64
os: ubuntu-24.04-arm
- target-platform: osx-64
os: macos-15-intel
- target-platform: osx-arm64
os: macos-latest
- target-platform: win-64
os: windows-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Set up pixi
uses: prefix-dev/setup-pixi@a0af7a228712d6121d37aba47adf55c1332c9c2e # v0.9.4
with:
environments: build
- name: Set version
run: pixi run -e build set-version
- name: Install cargo-auditable
shell: bash
if: github.event_name == 'release'
run: |
# cargo-auditable must be invoked as "cargo auditable <cmd>", not as a direct CARGO
# replacement — the latter does not support "cargo rustc --profile". A wrapper delegates
# to the real cargo via PATH (no recursion risk since CARGO is set via env, not PATH).
if [[ "$RUNNER_OS" != "Linux" ]]; then
cargo install cargo-auditable@0.7.4 --locked
fi
if [[ "$RUNNER_OS" == "Windows" ]]; then
printf '@cargo auditable %%*\n' > "C:/cargo-auditable-wrapper.cmd"
echo "CARGO=C:\\cargo-auditable-wrapper.cmd" >> "$GITHUB_ENV"
else
printf '#!/bin/sh\nexec cargo auditable "$@"\n' > /usr/local/bin/cargo-auditable-wrapper
chmod +x /usr/local/bin/cargo-auditable-wrapper
echo "CARGO=/usr/local/bin/cargo-auditable-wrapper" >> "$GITHUB_ENV"
fi
- name: Build wheel
uses: PyO3/maturin-action@04ac600d27cdf7a9a280dadf7147097c42b757ad # v1.50.1
with:
command: build
args: --out dist --release -i python3.10
manylinux: auto
sccache: ${{ github.event_name != 'release' }}
# NOTE: We also need to set up cargo-auditable inside the docker container
# where the linux build is performed.
docker-options: ${{ case(github.event_name == 'release', format('-e CARGO={0}', env.CARGO), '') }}
before-script-linux: |
${{ case(github.event_name == 'release', 'cargo install cargo-auditable@0.7.4 --locked && printf ''#!/bin/sh\nexec cargo auditable "$@"\n'' > /usr/local/bin/cargo-auditable-wrapper && chmod +x /usr/local/bin/cargo-auditable-wrapper', '') }}
- name: Check package
run: pixi run -e build check-wheel
- name: Upload package
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: wheel-${{ matrix.target-platform }}
path: dist/*
release:
name: Publish package
if: github.event_name == 'release'
needs: build-wheel
runs-on: ubuntu-latest
permissions:
id-token: write
environment: pypi
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: dist
merge-multiple: true
- name: Publish package on PyPi
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0