Skip to content

feat!: add WASIX asset pipeline and protocol recovery #25

feat!: add WASIX asset pipeline and protocol recovery

feat!: add WASIX asset pipeline and protocol recovery #25

Workflow file for this run

name: Assets
on:
pull_request:
paths:
- ".github/workflows/assets.yml"
- "Cargo.lock"
- "Cargo.toml"
- "assets/**"
- "crates/aot/**"
- "crates/assets/**"
- "xtask/**"
push:
branches: [main]
paths:
- ".github/workflows/assets.yml"
- "Cargo.lock"
- "Cargo.toml"
- "assets/**"
- "crates/aot/**"
- "crates/assets/**"
- "xtask/**"
workflow_dispatch:
schedule:
- cron: "17 3 * * 1"
permissions:
contents: read
concurrency:
group: assets-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
ASSET_PROFILE: release-o3
defaults:
run:
shell: bash
jobs:
portable-wasix:
name: Build portable WASIX assets
runs-on: ubuntu-latest
timeout-minutes: 360
permissions:
contents: read
actions: write
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Rust tooling
uses: ./.github/actions/setup-rust-tools
with:
cache: "false"
- name: Fetch pinned asset sources
run: cargo run -p xtask -- assets fetch
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
- name: Build WASIX builder image
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8
with:
context: assets/wasix-build/docker
file: assets/wasix-build/docker/Dockerfile
tags: pglite-oxide-wasix-build:ci
load: true
cache-from: type=gha,scope=wasix-builder
cache-to: type=gha,mode=max,scope=wasix-builder
- name: Validate pinned asset sources
run: cargo run -p xtask -- assets check --strict-local
- name: Build portable WASIX modules and package runtime assets
env:
IMAGE: pglite-oxide-wasix-build:ci
run: |
cargo run -p xtask --features wasix-runner -- assets release-build \
--profile "$ASSET_PROFILE" \
--target-triple x86_64-unknown-linux-gnu \
--skip-aot \
--skip-package-size
- name: Validate generated portable assets
run: cargo run -p xtask -- assets check --strict-generated
- name: Verify source-controlled asset inputs
run: cargo run -p xtask -- assets verify-committed
- name: Upload portable WASIX build outputs
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: pglite-oxide-portable-wasix
path: |
assets/wasix-build/build/**
target/pglite-oxide/assets/**
assets/generated/**
if-no-files-found: error
native-aot:
name: Build native AOT (${{ matrix.target }})
needs: portable-wasix
runs-on: ${{ matrix.os }}
timeout-minutes: 180
permissions:
contents: read
actions: write
strategy:
fail-fast: false
matrix:
include:
- os: macos-15
target: aarch64-apple-darwin
package: pglite-oxide-aot-aarch64-apple-darwin
- os: macos-15-intel
target: x86_64-apple-darwin
package: pglite-oxide-aot-x86_64-apple-darwin
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
package: pglite-oxide-aot-x86_64-unknown-linux-gnu
llvm_url: https://github.com/llvm/llvm-project/releases/download/llvmorg-22.1.0/LLVM-22.1.0-Linux-X64.tar.xz
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
package: pglite-oxide-aot-aarch64-unknown-linux-gnu
llvm_url: https://github.com/llvm/llvm-project/releases/download/llvmorg-22.1.0/LLVM-22.1.0-Linux-ARM64.tar.xz
- os: windows-latest
target: x86_64-pc-windows-msvc
package: pglite-oxide-aot-x86_64-pc-windows-msvc
llvm_url: https://github.com/llvm/llvm-project/releases/download/llvmorg-22.1.0/clang%2Bllvm-22.1.0-x86_64-pc-windows-msvc.tar.xz
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- name: Download portable WASIX build outputs
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
with:
name: pglite-oxide-portable-wasix
path: .
- name: Set up Rust tooling
uses: ./.github/actions/setup-rust-tools
with:
cache-save-if: ${{ github.ref == 'refs/heads/main' }}
tools: cargo-nextest
- name: Install LLVM 22.1 for AOT generation (Linux)
if: runner.os == 'Linux'
uses: KyleMayes/install-llvm-action@ebc0426251bc40c7cd31162802432c68818ab8f0
with:
version: "22.1.0"
force-url: ${{ matrix.llvm_url }}
directory: ${{ runner.temp }}/llvm-22.1
- name: Install LLVM 22.1 for AOT generation (Windows)
if: runner.os == 'Windows'
run: |
archive="$RUNNER_TEMP/llvm-22.1.tar.xz"
extract_root="$RUNNER_TEMP/llvm-22.1"
curl.exe -L --retry 3 --output "$archive" "${{ matrix.llvm_url }}"
mkdir -p "$extract_root"
7z x "$archive" "-o$extract_root" -y
tarball="$(find "$extract_root" -maxdepth 1 -type f -name '*.tar' -print -quit)"
if [ -z "$tarball" ]; then
echo "LLVM tarball was not produced by xz extraction" >&2
exit 1
fi
7z x "$tarball" "-o$extract_root" -y
prefix="$(find "$extract_root" -maxdepth 1 -type d -name 'clang+llvm-*' -print -quit)"
if [ -z "$prefix" ] || [ ! -x "$prefix/bin/llvm-config.exe" ]; then
echo "LLVM extraction did not produce bin/llvm-config.exe" >&2
find "$extract_root" -maxdepth 3 -type f -name 'llvm-config*' -print >&2
exit 1
fi
win_prefix="$(cygpath -w "$prefix")"
echo "LLVM_PATH=$win_prefix" >> "$GITHUB_ENV"
echo "LLVM_SYS_221_PREFIX=$win_prefix" >> "$GITHUB_ENV"
echo "$prefix/bin" >> "$GITHUB_PATH"
version="$("$prefix/bin/llvm-config.exe" --version)"
case "$version" in
22.1.*) ;;
*) echo "expected LLVM 22.1.x, got $version" >&2; exit 1 ;;
esac
- name: Install LLVM 22.1 Windows system libraries
if: runner.os == 'Windows'
run: |
vcpkg_root="$(cygpath -u "${VCPKG_INSTALLATION_ROOT:-C:/vcpkg}")"
"$vcpkg_root/vcpkg.exe" install libxml2:x64-windows-static
vcpkg_lib="$vcpkg_root/installed/x64-windows-static/lib"
shim_dir="$RUNNER_TEMP/llvm-22.1-system-libs"
mkdir -p "$shim_dir"
cp "$vcpkg_lib/libxml2.lib" "$shim_dir/xml2s.lib"
{
printf 'LIB=%s;%s;%s\n' \
"$(cygpath -w "$shim_dir")" \
"$(cygpath -w "$vcpkg_lib")" \
"${LIB:-}"
} >> "$GITHUB_ENV"
- name: Install LLVM 22.1 for AOT generation (macOS)
if: runner.os == 'macOS'
run: |
brew install llvm@22 || brew install llvm
prefix="$(brew --prefix llvm@22 2>/dev/null || brew --prefix llvm)"
echo "LLVM_PATH=$prefix" >> "$GITHUB_ENV"
echo "LLVM_SYS_221_PREFIX=$prefix" >> "$GITHUB_ENV"
echo "$prefix/bin" >> "$GITHUB_PATH"
version="$("$prefix/bin/llvm-config" --version)"
case "$version" in
22.1.*) ;;
*) echo "expected LLVM 22.1.x, got $version" >&2; exit 1 ;;
esac
- name: Export LLVM 22.1 prefix
run: |
echo "LLVM_SYS_221_PREFIX=$LLVM_PATH" >> "$GITHUB_ENV"
if [ "$RUNNER_OS" = "Windows" ]; then
llvm_config="$(cygpath -u "$LLVM_PATH")/bin/llvm-config.exe"
else
llvm_config="$LLVM_PATH/bin/llvm-config"
fi
version="$("$llvm_config" --version)"
case "$version" in
22.1.*) ;;
*) echo "expected LLVM 22.1.x, got $version" >&2; exit 1 ;;
esac
- name: Probe LLVM AOT serializer
run: cargo run -p xtask -- assets aot-probe
- name: Generate and package target AOT artifacts
run: |
cargo run -p xtask -- assets aot --target-triple "${{ matrix.target }}"
cargo run -p xtask -- assets package-aot --target-triple "${{ matrix.target }}"
cargo run -p xtask -- assets check-aot --target-triple "${{ matrix.target }}"
- name: Check target AOT crate
run: cargo check -p "${{ matrix.package }}" --locked
- name: Run asset smoke tests
run: cargo run -p xtask -- assets smoke
- name: Package target AOT crate
run: |
cargo run -p xtask -- release stage
cd target/pglite-oxide/release/workspace
cargo package -p "${{ matrix.package }}" --locked --no-verify
- name: Check package sizes
run: |
cargo run -p xtask -- release stage
cd target/pglite-oxide/release/workspace
cargo run -p xtask -- package-size --enforce
- name: Upload target artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: pglite-oxide-aot-${{ matrix.target }}
path: |
target/pglite-oxide/release/workspace/target/package/*.crate
target/pglite-oxide/aot/${{ matrix.target }}/**
crates/aot/${{ matrix.target }}/src/lib.rs
if-no-files-found: error