Add WSL Woodpecker cross-build test and prefer bundled headers

This commit is contained in:
geruipu committed 2026-10-05 16:14:08 +08:00
1 parent 2694645d0d
commit e5cc03dfe3
3 files changed
+71 -1

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
when:
- event: [push, manual]
branch: skia3
labels:
platform: linux/amd64
backend: local
clone:
skip: true
steps:
- name: checkout
image: bash
commands:
- git init source
- git -C source remote add origin https://git.oeo.one/greepar/StaticLink.Avalonia.git
- git -C source fetch --depth=1 origin "$CI_COMMIT_SHA"
- git -C source checkout --detach FETCH_HEAD
- name: environment-and-linux-x64
image: bash
commands:
- bash source/scripts/woodpecker-cross-test.sh
+1 -1
View File
@@ -69,7 +69,7 @@ def compiler(config, tool, incoming):
if config.get('linux_abi_headers'):
args += ['-I' + config['linux_abi_headers']]
if config.get('linux_headers'):
args += ['-I' + config['linux_headers'], '-I' + config['linux_headers'] + '/freetype2']
args += ['-idirafter', config['linux_headers'], '-idirafter', config['linux_headers'] + '/freetype2']
if config.get('linux_sysroot') and '-c' not in incoming and '-o' in incoming:
root = Path(config['linux_sysroot'])
cpu = 'x86_64' if target.startswith('x86_64') else 'aarch64'
+47
View File
@@ -0,0 +1,47 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$SCRIPT_ROOT"
TOOLCHAIN_IMAGE="ghcr.io/greepar/staticlink.avalonia-zig@sha256:a88b5ea9f76f659978cda36dda06233d7fdc9121046eedf945044fc908d24b85"
export CROSS_RID=linux-x64
RESULTS="${HOME}/staticlink-ci-artifacts/${CI_REPO_NAME:-StaticLink.Avalonia}/${CI_COMMIT_BRANCH:?}/${CI_PIPELINE_NUMBER:?}"
mkdir -p "$RESULTS/environment"
df -h .
free -h
docker version
if [ "$(docker info --format '{{.OSType}}/{{.Architecture}}')" != "linux/x86_64" ]; then
echo "Requires a Linux x86_64 Docker daemon on the WSL agent" >&2
exit 1
fi
AVAILABLE_KB="$(df -Pk . | awk 'NR == 2 {print $4}')"
if [ "$AVAILABLE_KB" -lt 41943040 ]; then
echo "Need at least 40 GiB free before pulling the toolchain and compiling; more is recommended" >&2
exit 1
fi
echo "Persistent test results: $RESULTS"
exec > >(tee "$RESULTS/build.log") 2>&1
trap 'result=$?; trap - EXIT; mkdir -p "$RESULTS/native"; if [ -d External/NativeStatic/linux-x64/native ]; then cp -a External/NativeStatic/linux-x64/native/. "$RESULTS/native/"; fi; printf "%s\n" "$result" > "$RESULTS/exit-code"; echo "Results retained at $RESULTS"; exit "$result"' EXIT
docker pull "$TOOLCHAIN_IMAGE"
docker run --rm --user "$(id -u):$(id -g)" \
-e HOME=/tmp -e DOTNET_CLI_HOME=/tmp -e ZIG_GLOBAL_CACHE_DIR=/tmp/zig-cache \
-v "$RESULTS/environment:/validation" --entrypoint python3 \
"$TOOLCHAIN_IMAGE" /opt/staticlink/validate-toolchain.py \
--output /validation --rids '["linux-x64"]'
mkdir -p External/NativeStatic/.work/home
docker run --rm --user "$(id -u):$(id -g)" \
-e HOME=/src/External/NativeStatic/.work/home -e CROSS_RID \
-e CCACHE_DIR=/src/External/NativeStatic/.work/ccache -e CCACHE_MAXSIZE=1G \
-e ZIG_GLOBAL_CACHE_DIR=/src/External/NativeStatic/.work/zig-global \
-v "$PWD:/src" -w /src --entrypoint bash "$TOOLCHAIN_IMAGE" -c '
set -euo pipefail
export SOURCE_LOCK=/src/build/linux-toolchain/sources.lock.json
source scripts/prepare-cross-sources.sh
python3 build/linux-toolchain/build-cross.py \
--target "$CROSS_RID" --sources-manifest "$WORK_DIR/cross-sources.json" \
--work /src/External/NativeStatic/.work/toolchains \
--output "/src/External/NativeStatic/zig-cross/$SKIASHARP_VERSION/$CROSS_RID" --jobs 4
python3 build/linux-toolchain/package-zig.py \
--rid "$CROSS_RID" \
--input "/src/External/NativeStatic/zig-cross/$SKIASHARP_VERSION/$CROSS_RID" \
--output "/src/External/NativeStatic/$CROSS_RID/native"
'