Tighten constructor text property validation #4071 #1237
This file contains 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 | |
on: | |
- push | |
- pull_request | |
permissions: {} | |
jobs: | |
github-runner: | |
permissions: | |
contents: write | |
name: ${{ matrix.platform }} - Node.js ${{ matrix.nodejs_version_major }} ${{ matrix.prebuild && '- prebuild' }} | |
runs-on: ${{ matrix.os }} | |
container: ${{ matrix.container }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-22.04 | |
container: rockylinux:8 | |
nodejs_arch: x64 | |
nodejs_version: "^18.17.0" | |
nodejs_version_major: 18 | |
platform: linux-x64 | |
prebuild: true | |
- os: ubuntu-22.04 | |
container: rockylinux:8 | |
nodejs_arch: x64 | |
nodejs_version: "^20.3.0" | |
nodejs_version_major: 20 | |
platform: linux-x64 | |
- os: ubuntu-22.04 | |
container: node:18-alpine3.17 | |
nodejs_version_major: 18 | |
platform: linuxmusl-x64 | |
prebuild: true | |
- os: ubuntu-22.04 | |
container: node:20-alpine3.18 | |
nodejs_version_major: 20 | |
platform: linuxmusl-x64 | |
- os: macos-11 | |
nodejs_arch: x64 | |
nodejs_version: "^18.17.0" | |
nodejs_version_major: 18 | |
platform: darwin-x64 | |
prebuild: true | |
- os: macos-11 | |
nodejs_arch: x64 | |
nodejs_version: "^20.3.0" | |
nodejs_version_major: 20 | |
platform: darwin-x64 | |
- os: macos-14 | |
nodejs_arch: arm64 | |
nodejs_version: "^18.17.0" | |
nodejs_version_major: 18 | |
platform: darwin-arm64 | |
prebuild: true | |
- os: macos-14 | |
nodejs_arch: arm64 | |
nodejs_version: "^20.3.0" | |
nodejs_version_major: 20 | |
platform: darwin-arm64 | |
- os: windows-2019 | |
nodejs_arch: x86 | |
nodejs_version: "18.18.2" # pinned to avoid 18.19.0 and npm 10 | |
nodejs_version_major: 18 | |
platform: win32-ia32 | |
prebuild: true | |
- os: windows-2019 | |
nodejs_arch: x86 | |
nodejs_version: "^20.3.0" | |
nodejs_version_major: 20 | |
platform: win32-ia32 | |
- os: windows-2019 | |
nodejs_arch: x64 | |
nodejs_version: "^18.17.0" | |
nodejs_version_major: 18 | |
platform: win32-x64 | |
prebuild: true | |
- os: windows-2019 | |
nodejs_arch: x64 | |
nodejs_version: "^20.3.0" | |
nodejs_version_major: 20 | |
platform: win32-x64 | |
steps: | |
- name: Dependencies (Rocky Linux glibc) | |
if: contains(matrix.container, 'rockylinux') | |
run: | | |
dnf install -y gcc-toolset-11-gcc-c++ make git python3 fontconfig google-noto-sans-fonts | |
echo "/opt/rh/gcc-toolset-11/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 }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install | |
run: npm install --build-from-source | |
- name: Test | |
run: npm test | |
- name: Test packaging | |
run: | | |
npm run package-from-local-build | |
npm pkg set "optionalDependencies.@img/sharp-${{ matrix.platform }}=file:./npm/${{ matrix.platform }}" | |
npm run clean | |
npm install --ignore-scripts | |
npm test | |
- name: Prebuild | |
if: matrix.prebuild && startsWith(github.ref, 'refs/tags/') | |
env: | |
prebuild_upload: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
node -e "require('fs').cpSync('package.json', 'src/package.json')" | |
cd src | |
npx prebuild | |
github-runner-qemu: | |
permissions: | |
contents: write | |
name: ${{ matrix.platform }} - Node.js ${{ matrix.nodejs_version_major }} - prebuild | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: linux-arm | |
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 | |
run_on_arch: s390x | |
nodejs_arch: s390x | |
nodejs_hostname: nodejs.org | |
nodejs_version: "18.17.0" | |
nodejs_version_major: 18 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: uraimo/run-on-arch-action@v2 | |
with: | |
arch: ${{ matrix.run_on_arch }} | |
distro: buster | |
env: | | |
prebuild_upload: "${{ startsWith(github.ref, 'refs/tags/') && secrets.GITHUB_TOKEN || '' }}" | |
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 | |
npm pkg set "optionalDependencies.@img/sharp-${{ matrix.platform }}=file:./npm/${{ matrix.platform }}" | |
npm run clean | |
npm install --ignore-scripts | |
npx mocha --no-config --spec=test/unit/io.js --timeout=30000 | |
[[ -n $prebuild_upload ]] && cd src && ln -s ../package.json && npx prebuild || true | |
github-runner-emscripten: | |
permissions: | |
contents: write | |
name: wasm32 - prebuild | |
runs-on: ubuntu-22.04 | |
container: "emscripten/emsdk:3.1.56" | |
steps: | |
- name: Checkout | |
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: Test packaging | |
run: | | |
emmake npm run package-from-local-build | |
npm pkg set "optionalDependencies.@img/sharp-wasm32=file:./npm/wasm32" | |
npm run clean | |
rm -rf node_modules/@img/sharp-linux-x64 | |
npm install --cpu=wasm32 | |
npm test | |
- name: Prebuild | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
npm_config_nodedir: emscripten | |
prebuild_upload: ${{ secrets.GITHUB_TOKEN }} | |
run: cd src && ln -s ../package.json && emmake npx prebuild --platform=emscripten --arch=wasm32 --strip=0 |