fix webview implementation in linux #45
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| # 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 | |
| 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 | |
| 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 }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - 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: | | |
| 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 ARM) | |
| if: runner.os == 'Linux' && matrix.settings.cross_arch | |
| 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 | |
| # build-freebsd: | |
| # runs-on: ubuntu-latest | |
| # name: Build FreeBSD | |
| # timeout-minutes: 90 | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - name: Build | |
| # id: build | |
| # uses: cross-platform-actions/action@v0.25.0 | |
| # env: | |
| # DEBUG: napi:* | |
| # RUSTUP_IO_THREADS: 1 | |
| # with: | |
| # operating_system: freebsd | |
| # version: '14.0' | |
| # memory: 8G | |
| # cpu_count: 3 | |
| # environment_variables: 'DEBUG RUSTUP_IO_THREADS' | |
| # shell: bash | |
| # run: | | |
| # sudo pkg install -y -f curl node libnghttp2 npm pkg-config | |
| # sudo npm install -g bun --ignore-scripts | |
| # curl https://sh.rustup.rs -sSf --output rustup.sh | |
| # sh rustup.sh -y --profile minimal --default-toolchain beta | |
| # source "$HOME/.cargo/env" | |
| # echo "~~~~ rustc --version ~~~~" | |
| # rustc --version | |
| # echo "~~~~ node -v ~~~~" | |
| # node -v | |
| # echo "~~~~ bun --version ~~~~" | |
| # bun --version | |
| # pwd | |
| # ls -lah | |
| # whoami | |
| # env | |
| # freebsd-version | |
| # bun install | |
| # bun run build | |
| # rm -rf node_modules | |
| # rm -rf target | |
| # rm -rf .bun/cache | |
| # - name: Upload artifact | |
| # uses: actions/upload-artifact@v4 | |
| # with: | |
| # name: bindings-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: latest | |
| - 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: | |
| 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" |