-
Notifications
You must be signed in to change notification settings - Fork 2
183 lines (167 loc) · 6.96 KB
/
Copy path_build.yml
File metadata and controls
183 lines (167 loc) · 6.96 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
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
172
173
174
175
176
177
178
179
180
181
182
183
name: Build
on:
workflow_call:
inputs:
source-sha:
required: false
type: string
default: ""
runs-on:
required: true
type: string
rust-target:
required: false
type: string
default: ""
wheel-smoke:
required: false
type: boolean
default: false
jobs:
build:
runs-on: ${{ inputs.runs-on }}
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.source-sha || github.sha }}
- name: Verify checkout SHA
env:
EXPECTED_SHA: ${{ inputs.source-sha || github.sha }}
run: |
[[ "$EXPECTED_SHA" =~ ^[0-9a-f]{40}$ ]]
if [[ "$GITHUB_EVENT_NAME" == workflow_dispatch ]]; then
test "$EXPECTED_SHA" = "$GITHUB_SHA"
fi
test "$(git rev-parse HEAD)" = "$EXPECTED_SHA"
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: "3.11.9"
- name: Install Python
run: uv python install "$UV_PYTHON"
- name: Configure Rust target
run: |
cp rust-toolchain.toml rust-toolchain.ci.toml
if [ -n "${{ inputs.rust-target }}" ]; then
printf '\ntargets = ["%s"]\n' "${{ inputs.rust-target }}" >> rust-toolchain.ci.toml
fi
cat rust-toolchain.ci.toml
# Must run before setup-soldr: its soldr-cook step builds glib-sys /
# gobject-sys, which resolve GTK/WebKit through pkg-config. Cooking first
# fails with exit 101 and every run then compiles those deps cold (#262).
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev
- uses: zackees/setup-soldr@v0.9.62
env:
GITHUB_TOKEN: ${{ github.token }}
with:
# No soldr version pin: v0.7.53 (zccache v1.11.20) breaks the
# aarch64-pc-windows-msvc cross-compile with silent rustc failures
# (see #158); the action default v0.7.51 is green here.
# cache-preset: foundation expands to build-cache: true +
# target-cache: false + cargo-registry-cache: false +
# prebuild-deps: soldr-cook (setup-soldr v0.9.17+, #251).
cache-preset: foundation
# Include the rust target: the same runner label hosts multiple
# cross-compile targets (e.g. windows-2025 builds both x86_64 and
# aarch64-pc-windows-msvc), which would otherwise thrash one key.
# "-native" lines up with the lint/test workflows' suffix so jobs
# on the same platform share one cache namespace.
cache-key-suffix: ${{ inputs.runs-on }}-${{ inputs.rust-target || 'native' }}
linker: platform-default
toolchain-file: rust-toolchain.ci.toml
- name: Build fastled CLI binary (for wheel bundling)
run: |
if [ -n "${{ inputs.rust-target }}" ]; then
soldr cargo build --release --bin fastled --target "${{ inputs.rust-target }}"
case "${{ inputs.rust-target }}" in
*windows*) EXE_NAME="fastled.exe" ;;
*) EXE_NAME="fastled" ;;
esac
BIN_SRC="target/${{ inputs.rust-target }}/release/${EXE_NAME}"
else
soldr cargo build --release --bin fastled
case "$(uname -s)" in
MINGW*|MSYS*|CYGWIN*) EXE_NAME="fastled.exe" ;;
*) EXE_NAME="fastled" ;;
esac
if [ -n "${CARGO_BUILD_TARGET:-}" ] || [ "$EXE_NAME" = "fastled.exe" ]; then
ARCH="$(uname -m)"
if [ "$ARCH" = "x86_64" ]; then TRIPLE="x86_64-pc-windows-msvc"; else TRIPLE="aarch64-pc-windows-msvc"; fi
if [ -f "target/${TRIPLE}/release/${EXE_NAME}" ]; then
BIN_SRC="target/${TRIPLE}/release/${EXE_NAME}"
else
BIN_SRC="target/release/${EXE_NAME}"
fi
else
BIN_SRC="target/release/${EXE_NAME}"
fi
fi
mkdir -p src/fastled/bin
cp -f "$BIN_SRC" "src/fastled/bin/${EXE_NAME}"
ls -lh src/fastled/bin/
- name: Build wheel
env:
# setup.py rebuilds the bundled binary; keep that rebuild on the
# requested target, especially Windows ARM on an x64 runner.
FASTLED_RUST_TARGET: ${{ inputs.rust-target }}
run: |
PLAT_NAME=""
case "${{ inputs.rust-target }}" in
aarch64-pc-windows-msvc) PLAT_NAME="win_arm64" ;;
x86_64-pc-windows-msvc) PLAT_NAME="win_amd64" ;;
aarch64-apple-darwin) PLAT_NAME="macosx_11_0_arm64" ;;
x86_64-apple-darwin) PLAT_NAME="macosx_10_12_x86_64" ;;
aarch64-unknown-linux-gnu) PLAT_NAME="manylinux_2_28_aarch64" ;;
x86_64-unknown-linux-gnu) PLAT_NAME="manylinux_2_28_x86_64" ;;
esac
if [ -n "$PLAT_NAME" ]; then
uv run --with "setuptools>=69" --with "wheel>=0.43" python setup.py bdist_wheel --plat-name "$PLAT_NAME"
else
uv run --with "setuptools>=69" --with "wheel>=0.43" python setup.py bdist_wheel
fi
# Installs the wheel into a fresh venv and runs the packaged console
# script outside this checkout, in the shipped viewer.
- name: Smoke test installed wheel in shipped viewer
if: inputs.wheel-smoke
run: bash ci/smoke_installed_wheel.sh
- name: Upload installed wheel viewer screenshot
if: always() && inputs.wheel-smoke
uses: actions/upload-artifact@v4
with:
name: smoke-wheel-screenshot-${{ inputs.runs-on }}-${{ inputs.rust-target || 'native' }}
path: ${{ runner.temp }}/fastled-wheel-smoke/artifacts/*.png
if-no-files-found: error
- name: Upload installed wheel viewer log
if: always() && inputs.wheel-smoke
uses: actions/upload-artifact@v4
with:
name: smoke-wheel-log-${{ inputs.runs-on }}-${{ inputs.rust-target || 'native' }}
path: ${{ runner.temp }}/fastled-wheel-smoke/artifacts/*.log
if-no-files-found: warn
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheel-${{ inputs.runs-on }}-${{ inputs.rust-target || 'native' }}
path: dist/*.whl
if-no-files-found: error
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: binary-${{ inputs.runs-on }}-${{ inputs.rust-target || 'native' }}
path: src/fastled/bin/fastled*
if-no-files-found: error
- name: Upload failure logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: failure-logs-build-${{ inputs.runs-on }}
path: logs/*
if-no-files-found: warn