name: CI on: - push - pull_request permissions: {} jobs: build-native: permissions: contents: read name: "build-${{ matrix.platform }} [Node.js ${{ matrix.nodejs_version_major }}] ${{ matrix.package && '[package]' }}" runs-on: ${{ matrix.os }} container: ${{ matrix.container }} strategy: fail-fast: false matrix: include: - os: ubuntu-24.04 container: rockylinux:8 nodejs_arch: x64 nodejs_version: "^18.17.0" nodejs_version_major: 18 platform: linux-x64 package: true - os: ubuntu-24.04 container: rockylinux:8 nodejs_arch: x64 nodejs_version: "^20.3.0" nodejs_version_major: 20 platform: linux-x64 - os: ubuntu-24.04 container: rockylinux:8 nodejs_arch: x64 nodejs_version: "^22.9.0" nodejs_version_major: 22 platform: linux-x64 - os: ubuntu-24.04 container: node:18-alpine3.17 nodejs_version_major: 18 platform: linuxmusl-x64 package: true - os: ubuntu-24.04 container: node:20-alpine3.18 nodejs_version_major: 20 platform: linuxmusl-x64 - os: ubuntu-24.04 container: node:22-alpine3.20 nodejs_version_major: 22 platform: linuxmusl-x64 - os: ubuntu-24.04-arm container: arm64v8/rockylinux:8 nodejs_arch: arm64 nodejs_version: "^18.17.0" nodejs_version_major: 18 platform: linux-arm64 package: true - os: ubuntu-24.04-arm container: arm64v8/rockylinux:8 nodejs_arch: arm64 nodejs_version: "^20.3.0" nodejs_version_major: 20 platform: linux-arm64 - os: macos-13 nodejs_arch: x64 nodejs_version: "^18.17.0" nodejs_version_major: 18 platform: darwin-x64 package: true - os: macos-13 nodejs_arch: x64 nodejs_version: "^20.3.0" nodejs_version_major: 20 platform: darwin-x64 - os: macos-13 nodejs_arch: x64 nodejs_version: "^22.9.0" nodejs_version_major: 22 platform: darwin-x64 - os: macos-14 nodejs_arch: arm64 nodejs_version: "^18.17.0" nodejs_version_major: 18 platform: darwin-arm64 package: true - os: macos-14 nodejs_arch: arm64 nodejs_version: "^20.3.0" nodejs_version_major: 20 platform: darwin-arm64 - os: macos-14 nodejs_arch: arm64 nodejs_version: "^22.9.0" nodejs_version_major: 22 platform: darwin-arm64 - os: windows-2022 nodejs_arch: x86 nodejs_version: "18.18.2" # pinned to avoid 18.19.0 and npm 10 nodejs_version_major: 18 platform: win32-ia32 package: true - os: windows-2022 nodejs_arch: x86 nodejs_version: "^20.3.0" nodejs_version_major: 20 platform: win32-ia32 - os: windows-2022 nodejs_arch: x86 nodejs_version: "^22.9.0" nodejs_version_major: 22 platform: win32-ia32 - os: windows-2022 nodejs_arch: x64 nodejs_version: "^18.17.0" nodejs_version_major: 18 platform: win32-x64 package: true - os: windows-2022 nodejs_arch: x64 nodejs_version: "^20.3.0" nodejs_version_major: 20 platform: win32-x64 - os: windows-2022 nodejs_arch: x64 nodejs_version: "^22.9.0" nodejs_version_major: 22 platform: win32-x64 - os: windows-11-arm nodejs_arch: arm64 nodejs_version: "^20.3.0" nodejs_version_major: 20 platform: win32-arm64 package: true - os: windows-11-arm nodejs_arch: arm64 nodejs_version: "^22.9.0" nodejs_version_major: 22 platform: win32-arm64 steps: - name: Dependencies (Rocky Linux glibc) if: contains(matrix.container, 'rockylinux') run: | dnf install -y gcc-toolset-14-gcc-c++ make git python3.12 fontconfig google-noto-sans-fonts echo "/opt/rh/gcc-toolset-14/root/usr/bin" >> $GITHUB_PATH - name: Dependencies (Linux musl) if: contains(matrix.container, 'alpine') run: apk add build-base git python3 font-noto --update-cache - name: Dependencies (Python 3.11 - macOS, Windows) if: contains(matrix.os, 'macos') || contains(matrix.os, 'windows') uses: actions/setup-python@v5 with: python-version: "3.12" - name: Dependencies (Node.js) if: "!contains(matrix.platform, 'linuxmusl')" uses: actions/setup-node@v4 with: node-version: ${{ matrix.nodejs_version }} architecture: ${{ matrix.nodejs_arch }} - uses: actions/checkout@v4 - name: Install run: npm install --build-from-source - name: Test run: npm test - name: Populate npm package if: matrix.package run: npm run package-from-local-build - uses: actions/upload-artifact@v4 if: matrix.package with: name: ${{ matrix.platform }} path: npm/${{ matrix.platform }} retention-days: 1 if-no-files-found: error build-linuxmusl-arm-64: permissions: contents: read name: "build-linuxmusl-arm64 [Node.js ${{ matrix.nodejs_version_major }}] ${{ matrix.package && '[package]' }}" runs-on: ubuntu-24.04-arm container: image: ${{ matrix.container }} volumes: - /:/host strategy: fail-fast: false matrix: include: - container: node:18-alpine3.17 nodejs_version_major: 18 package: true - container: node:20-alpine3.18 nodejs_version_major: 20 steps: - name: Allow Linux musl containers on ARM64 runners # https://github.com/actions/runner/issues/801#issuecomment-2394425757 shell: sh run: | apk add nodejs sed -i "s:ID=alpine:ID=NotpineForGHA:" /etc/os-release cd /host/home/runner/runners/*/externals/ rm -rf node20/* mkdir node20/bin ln -s /usr/bin/node node20/bin/node - name: Dependencies run: apk add build-base git python3 font-noto --update-cache - uses: actions/checkout@v4 - name: Install run: npm install --build-from-source - name: Test run: npm test - name: Populate npm package if: matrix.package run: npm run package-from-local-build - uses: actions/upload-artifact@v4 if: matrix.package with: name: linuxmusl-arm64 path: npm/linuxmusl-arm64 retention-days: 1 if-no-files-found: error build-qemu: permissions: contents: read name: "build-${{ matrix.platform }} [Node.js ${{ matrix.nodejs_version_major }}] [package]" runs-on: ubuntu-24.04 strategy: fail-fast: false matrix: include: - platform: linux-arm distro: bullseye run_on_arch: armv6 nodejs_arch: armv6l nodejs_hostname: unofficial-builds.nodejs.org nodejs_version: "18.17.0" nodejs_version_major: 18 - platform: linux-s390x distro: bullseye run_on_arch: s390x nodejs_arch: s390x nodejs_hostname: nodejs.org nodejs_version: "18.17.0" nodejs_version_major: 18 - platform: linux-ppc64 distro: bullseye run_on_arch: ppc64le nodejs_arch: ppc64le nodejs_hostname: nodejs.org nodejs_version: "18.17.0" nodejs_version_major: 18 steps: - uses: actions/checkout@v4 - uses: uraimo/run-on-arch-action@v3 with: arch: ${{ matrix.run_on_arch }} distro: ${{ matrix.distro }} run: | apt-get update apt-get install -y curl g++ git libatomic1 make python3 xz-utils mkdir /opt/nodejs curl --silent https://${{ matrix.nodejs_hostname }}/download/release/v${{ matrix.nodejs_version}}/node-v${{ matrix.nodejs_version}}-linux-${{ matrix.nodejs_arch }}.tar.xz | tar xJC /opt/nodejs --strip-components=1 export PATH=$PATH:/opt/nodejs/bin npm install --build-from-source npx mocha --no-config --spec=test/unit/io.js --timeout=30000 npm run package-from-local-build - uses: actions/upload-artifact@v4 with: name: ${{ matrix.platform }} path: npm/${{ matrix.platform }} retention-days: 1 if-no-files-found: error build-emscripten: permissions: contents: read name: "build-wasm32 [package]" runs-on: ubuntu-24.04 container: "emscripten/emsdk:4.0.10" steps: - uses: actions/checkout@v4 - name: Dependencies run: apt-get update && apt-get install -y pkg-config - name: Dependencies (Node.js) uses: actions/setup-node@v4 with: node-version: "20" - name: Install run: emmake npm install --build-from-source - name: Verify emscripten versions match run: | EMSCRIPTEN_VERSION_LIBVIPS=$(node -p "require('@img/sharp-libvips-dev-wasm32/versions').emscripten") EMSCRIPTEN_VERSION_SHARP=$(emcc -dumpversion) echo "libvips built with emscripten $EMSCRIPTEN_VERSION_LIBVIPS" echo "sharp built with emscripten $EMSCRIPTEN_VERSION_SHARP" test "$EMSCRIPTEN_VERSION_LIBVIPS" = "$EMSCRIPTEN_VERSION_SHARP" - name: Test run: emmake npm test - name: Populate npm package run: emmake npm run package-from-local-build - uses: actions/upload-artifact@v4 with: name: wasm32 path: npm/wasm32 retention-days: 1 if-no-files-found: error release: permissions: contents: write runs-on: ubuntu-24.04 needs: - build-native - build-linuxmusl-arm-64 - build-qemu - build-emscripten steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: path: npm - name: Create npm workspace tarball run: tar -vcaf npm-workspace.tar.xz --directory npm --exclude=from-local-build.js . - name: Create GitHub release for tag if: startsWith(github.ref, 'refs/tags/v') uses: ncipollo/release-action@v1 with: artifacts: npm-workspace.tar.xz artifactContentType: application/x-xz prerelease: ${{ contains(github.ref, '-rc') }} makeLatest: ${{ !contains(github.ref, '-rc') }}