Skip to content

ci(linux): remove ia32 publish check #127

ci(linux): remove ia32 publish check

ci(linux): remove ia32 publish check #127

Workflow file for this run

name: CI
env:
DEBUG: napi:*
APP_NAME: webview
MACOSX_DEPLOYMENT_TARGET: '10.13'
CARGO_INCREMENTAL: '1'
CARGO_TERM_COLOR: always
permissions:
contents: write
id-token: write
on:
push:
branches:
- main
tags-ignore:
- '**'
paths-ignore:
- '**/*.md'
- LICENSE
- '**/*.gitignore'
- .editorconfig
- docs/**
pull_request:
branches:
- main
paths-ignore:
- '**/*.md'
- LICENSE
- '**/*.gitignore'
- .editorconfig
- docs/**
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: ${{ matrix.settings.os }} - ${{ matrix.settings.target }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
settings:
# macOS
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
build_script: |
export PKG_CONFIG_ALLOW_CROSS=1
bun run build --target aarch64-apple-darwin
# Windows
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: windows-latest
target: i686-pc-windows-msvc
- os: windows-latest
target: aarch64-pc-windows-msvc
# Linux x86_64
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
sys_deps: pkg-config libwebkit2gtk-4.1-dev libsoup-3.0-dev libglib2.0-dev libcairo2-dev libpango1.0-dev libatk1.0-dev libgdk-pixbuf2.0-dev libgtk-3-dev libxdo-dev
# Linux ia32
- os: ubuntu-latest
target: i686-unknown-linux-gnu
# Debian Trixie split the GLib/GObject build tools from the target
# libraries and made them cross-compilation aware. Bookworm's
# multiarch resolver incorrectly selects gobject-introspection:i386
# and then fails on its unavailable i386 Python toolchain.
container: node:24-trixie
cross_arch: i386
cross_sys_deps: libglib2.0-dev:i386 libwebkit2gtk-4.1-dev:i386 libsoup-3.0-dev:i386 libcairo2-dev:i386 libpango1.0-dev:i386 libatk1.0-dev:i386 libgdk-pixbuf-2.0-dev:i386 libgtk-3-dev:i386 libxdo-dev:i386
cross_gcc: gcc-i686-linux-gnu
cross_gpp: g++-i686-linux-gnu
cross_triplet: i686-linux-gnu
build_script: |
set -e
rustup target add i686-unknown-linux-gnu
export PKG_CONFIG_ALLOW_CROSS=1
export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
export PKG_CONFIG_SYSROOT_DIR=/
export PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu/pkgconfig:/usr/share/pkgconfig
export PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig:/usr/share/pkgconfig
export PKG_CONFIG_i686_unknown_linux_gnu=pkg-config
export PKG_CONFIG_SYSROOT_DIR_i686_unknown_linux_gnu=/
export PKG_CONFIG_LIBDIR_i686_unknown_linux_gnu=/usr/lib/i386-linux-gnu/pkgconfig:/usr/share/pkgconfig
export PKG_CONFIG_PATH_i686_unknown_linux_gnu=/usr/lib/i386-linux-gnu/pkgconfig:/usr/share/pkgconfig
export CC=i686-linux-gnu-gcc
export CXX=i686-linux-gnu-g++
export AR=i686-linux-gnu-ar
export RANLIB=i686-linux-gnu-ranlib
export CC_i686_unknown_linux_gnu=i686-linux-gnu-gcc
export CXX_i686_unknown_linux_gnu=i686-linux-gnu-g++
export AR_i686_unknown_linux_gnu=i686-linux-gnu-ar
export RANLIB_i686_unknown_linux_gnu=i686-linux-gnu-ranlib
export CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER=i686-linux-gnu-gcc
bun run build --target i686-unknown-linux-gnu
# Linux ARM64
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
cross_arch: arm64
cross_sys_deps: libglib2.0-dev:arm64 libwebkit2gtk-4.1-dev:arm64 libsoup-3.0-dev:arm64 libcairo2-dev:arm64 libpango1.0-dev:arm64 libatk1.0-dev:arm64 libgdk-pixbuf2.0-dev:arm64 libgtk-3-dev:arm64 libxdo-dev:arm64
cross_gcc: gcc-aarch64-linux-gnu
cross_gpp: g++-aarch64-linux-gnu
cross_triplet: aarch64-linux-gnu
build_script: |
set -e
rustup target add aarch64-unknown-linux-gnu
export PKG_CONFIG_ALLOW_CROSS=1
export PKG_CONFIG_SYSROOT_DIR=/usr/aarch64-linux-gnu
export PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig
export CC=aarch64-linux-gnu-gcc
export CXX=aarch64-linux-gnu-g++
export AR=aarch64-linux-gnu-ar
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
bun run build --target aarch64-unknown-linux-gnu
# Linux ARMv7
- os: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
cross_arch: armhf
cross_sys_deps: libglib2.0-dev:armhf libwebkit2gtk-4.1-dev:armhf libsoup-3.0-dev:armhf libcairo2-dev:armhf libpango1.0-dev:armhf libatk1.0-dev:armhf libgdk-pixbuf2.0-dev:armhf libgtk-3-dev:armhf libxdo-dev:armhf
cross_gcc: gcc-arm-linux-gnueabihf
cross_gpp: g++-arm-linux-gnueabihf
cross_triplet: arm-linux-gnueabihf
build_script: |
set -e
rustup target add armv7-unknown-linux-gnueabihf
export PKG_CONFIG_ALLOW_CROSS=1
export PKG_CONFIG_SYSROOT_DIR=/usr/arm-linux-gnueabihf
export PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig:/usr/share/pkgconfig
export CC=arm-linux-gnueabihf-gcc
export CXX=arm-linux-gnueabihf-g++
export AR=arm-linux-gnueabihf-ar
export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc
bun run build --target armv7-unknown-linux-gnueabihf
# Android
- os: ubuntu-latest
target: aarch64-linux-android
- os: ubuntu-latest
target: armv7-linux-androideabi
runs-on: ${{ matrix.settings.os }}
container: ${{ matrix.settings.container || null }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.settings.target || matrix.settings.rust_target }}
- name: Setup Zig for cross-compilation
if: matrix.settings.use_zig
uses: goto-bus-stop/setup-zig@v2
with:
version: 0.13.0
- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb', '**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ matrix.settings.target }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.settings.target }}-cargo-registry-
- name: Cache Cargo build
uses: actions/cache@v4
with:
path: target/
key: ${{ matrix.settings.target }}-cargo-build-${{ github.sha }}
restore-keys: |
${{ matrix.settings.target }}-cargo-build-
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
if command -v sudo >/dev/null 2>&1; then
SUDO=sudo
else
SUDO=
fi
$SUDO apt-get update
$SUDO apt-get install -y pkg-config
- name: Install system dependencies (Linux x86_64)
if: runner.os == 'Linux' && matrix.settings.sys_deps
run: |
sudo apt-get install -y ${{ matrix.settings.sys_deps }}
- name: Install cross-compilation dependencies (Linux i386)
if: runner.os == 'Linux' && matrix.settings.cross_arch == 'i386'
run: |
set -e
if command -v sudo >/dev/null 2>&1; then
SUDO=sudo
else
SUDO=
fi
$SUDO dpkg --add-architecture i386
if [ -f /etc/os-release ] && grep -q 'Ubuntu' /etc/os-release; then
# Some Ubuntu runner images restrict DEB822 sources to amd64. Keep
# Ubuntu sources multiarch-aware without enabling i386 on third-party repos.
$SUDO find /etc/apt/sources.list.d/ -type f -name "*.sources" -exec sh -c '
if grep -qE "^URIs:.*ubuntu" "$1"; then
if grep -q "^Architectures:" "$1"; then
sed -i -E "s/^Architectures:.*/Architectures: amd64 i386/" "$1"
else
sed -i "/^Types: deb/a Architectures: amd64 i386" "$1"
fi
fi
' _ {} \;
$SUDO find /etc/apt/sources.list.d/ -type f -name "*.list" -exec sed -i -E '/ubuntu/ s/\[arch=amd64\]/[arch=amd64,i386]/' {} +
if [ -f /etc/apt/sources.list ]; then
$SUDO sed -i -E '/ubuntu/ s/\[arch=amd64\]/[arch=amd64,i386]/' /etc/apt/sources.list
fi
$SUDO rm -f /etc/apt/sources.list.d/microsoft-prod.list
fi
$SUDO apt-get update
# Debian provides the i386 libxdo development package that Ubuntu
# does not publish for this architecture.
$SUDO apt-get install --no-install-recommends -y libclang-dev \
${{ matrix.settings.cross_gcc }} \
${{ matrix.settings.cross_gpp }} \
${{ matrix.settings.cross_sys_deps }}
for package in \
libglib2.0-dev \
libwebkit2gtk-4.1-dev \
libsoup-3.0-dev \
libcairo2-dev \
libpango1.0-dev \
libatk1.0-dev \
libgdk-pixbuf-2.0-dev \
libgtk-3-dev \
libxdo-dev; do
architecture="$(dpkg-query -W -f='${Architecture}' "$package:i386")"
echo "$package:i386 -> $architecture"
test "$architecture" = i386
done
export PKG_CONFIG_ALLOW_CROSS=1
export PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu/pkgconfig:/usr/share/pkgconfig
for pc_file in \
glib-2.0 \
webkit2gtk-4.1 \
libsoup-3.0 \
cairo \
pango \
atk \
gdk-pixbuf-2.0 \
gtk+-3.0; do
echo "Checking $pc_file through i386 pkg-config"
pkg-config --exists "$pc_file"
pcfiledir="$(pkg-config --variable=pcfiledir "$pc_file")"
echo "$pc_file -> $pcfiledir"
test "$pcfiledir" = /usr/lib/i386-linux-gnu/pkgconfig
done
# libxdo-dev does not ship pkg-config metadata. Its i386 package
# architecture is validated in the package loop above.
- name: Install cross-compilation dependencies (Linux ARM)
if: runner.os == 'Linux' && matrix.settings.cross_arch && matrix.settings.cross_arch != 'i386'
run: |
sudo dpkg --add-architecture ${{ matrix.settings.cross_arch }}
# Update existing sources to be amd64-only to avoid 404s on foreign arches
# Handle traditional .list files
# We use a more careful sed to avoid doubling up [arch=...] tags and causing URI parse errors
sudo find /etc/apt/sources.list.d/ -type f -name "*.list" -exec sed -i -E 's/^(deb(-src)? )([^[])/\1[arch=amd64] \3/' {} +
if [ -f /etc/apt/sources.list ]; then
sudo sed -i -E 's/^(deb(-src)? )([^[])/\1[arch=amd64] \3/' /etc/apt/sources.list
fi
# Handle Ubuntu 24.04+ .sources files (DEB822 format)
sudo find /etc/apt/sources.list.d/ /etc/apt/ -type f -name "*.sources" -exec sh -c 'grep -q "Architectures:" "$1" || sed -i "/^Types: deb/a Architectures: amd64" "$1"' _ {} \;
# Remove problematic microsoft-prod repo if it exists, as it often breaks multi-arch on Noble images
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
# Add ports for the cross-architecture
echo "deb [arch=${{ matrix.settings.cross_arch }}] http://ports.ubuntu.com/ubuntu-ports $(lsb_release -sc) main restricted universe multiverse" | sudo tee /etc/apt/sources.list.d/ports.list
echo "deb [arch=${{ matrix.settings.cross_arch }}] http://ports.ubuntu.com/ubuntu-ports $(lsb_release -sc)-updates main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/ports.list
echo "deb [arch=${{ matrix.settings.cross_arch }}] http://ports.ubuntu.com/ubuntu-ports $(lsb_release -sc)-security main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/ports.list
sudo apt-get update
sudo apt-get install -y \
${{ matrix.settings.cross_gcc }} \
${{ matrix.settings.cross_gpp }} \
${{ matrix.settings.cross_sys_deps }}
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build
run: ${{ matrix.settings.build_script || format('bun run build --target {0}', matrix.settings.target) }}
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.settings.target }}
path: ${{ env.APP_NAME }}.*.node
if-no-files-found: error
retention-days: 7
# FreeBSD x64 — stub-only build. The addon throws at runtime; it exists only
# to satisfy package managers that resolve the freebsd-x64 optional package.
# The full wry/wry GUI stack is NOT compiled (see Cargo.toml cfg guards).
build-freebsd:
runs-on: ubuntu-latest
name: FreeBSD x64 (stub)
timeout-minutes: 90
defaults:
run:
shell: cpa.sh {0}
steps:
- uses: actions/checkout@v4
- name: Start FreeBSD VM
uses: cross-platform-actions/action@v1.3.0
with:
operating_system: freebsd
version: '15.1'
memory: 8G
cpu_count: 3
- name: Install dependencies
run: |
sudo pkg install -y -f curl node npm
sudo npm install -g bun
curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --profile minimal --default-toolchain stable
- name: Build
env:
DEBUG: napi:*
RUSTUP_IO_THREADS: 1
run: |
. "$HOME/.cargo/env"
rustc --version
node -v
bun --version
bun install --frozen-lockfile
bun run build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-x86_64-unknown-freebsd
path: ${{ env.APP_NAME }}.*.node
if-no-files-found: error
retention-days: 7
publish:
name: Publish to npm
runs-on: ubuntu-latest
timeout-minutes: 30
needs:
- build
- build-freebsd
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Move artifacts
run: bun run artifacts
- name: List packages
run: ls -R ./npm
shell: bash
- name: Extract version from commit message
id: version
run: |
COMMIT_MSG=$(git log -1 --pretty=%B)
if echo "$COMMIT_MSG" | grep -qE "^[0-9]+\.[0-9]+\.[0-9]+$"; then
echo "is_release=true" >> $GITHUB_OUTPUT
echo "tag=latest" >> $GITHUB_OUTPUT
elif echo "$COMMIT_MSG" | grep -qE "^[0-9]+\.[0-9]+\.[0-9]"; then
echo "is_release=true" >> $GITHUB_OUTPUT
echo "tag=next" >> $GITHUB_OUTPUT
else
echo "is_release=false" >> $GITHUB_OUTPUT
fi
- name: Publish to npm
if: steps.version.outputs.is_release == 'true'
run: |
npm config set provenance true
npm publish --access public --tag ${{ steps.version.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Skip publish (not a release)
if: steps.version.outputs.is_release == 'false'
run: |
echo "Not a release commit, skipping publish"