Test npm package #52
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: Test npm package | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Package version to test" | |
required: true | |
im_version: | |
description: "ImageMagick commit-ish to checkout" | |
required: false | |
default: 'main' | |
jobs: | |
test_npm_binaries: | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- ubuntu-20.04 | |
- ubuntu-22.04 | |
- windows-2019 | |
- windows-2022 | |
- macos-11 | |
- macos-12 | |
node-version: [16.x, 18.x, 20.x] | |
steps: | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Create package.json | |
run: npm init --yes | |
- name: Install fonts on Ubuntu | |
run: | | |
[[ '${{ matrix.platform }}' =~ 'ubuntu' ]] && sudo apt-get install -y fonts-ubuntu || true | |
shell: bash | |
- name: Set up the unit tests | |
run: | | |
curl https://codeload.github.com/mmomtchev/magickwand.js/zip/refs/tags/v${{ github.event.inputs.version }} --output repo.zip | |
unzip repo.zip | |
mv magickwand.js-${{ github.event.inputs.version }}/test . | |
- name: Install dependencies | |
run: | | |
npm i chai chai-spies chai-as-promised mocha typescript ts-node tsconfig-paths \ | |
@types/chai @types/chai-as-promised @types/mocha @types/node \ | |
karma karma-chrome-launcher karma-mocha webpack webpack-cli ts-loader | |
shell: bash | |
- name: Install magickwand.js from npm | |
run: | | |
npm install --force magickwand.js@${{ github.event.inputs.version }} | |
mkdir -p deps/ImageMagick/config | |
cp node_modules/magickwand.js/deps/ImageMagick/config/policy-websafe.xml deps/ImageMagick/config | |
shell: bash | |
- name: Run the unit tests headless | |
uses: GabrielBB/xvfb-action@v1 | |
with: | |
run: npx mocha --require ts-node/register --types mocha --reporter=tap --v8-expose-gc --timeout 5000 test/*.test.ts | |
env: | |
TS_NODE_PROJECT: ${{ github.workspace }}/test/tsconfig.standalone.json | |
MOCHA_INTEGRATION: node,browser | |
MOCHA_MAGICK_INSTALL: npm install --force magickwand.js@${{ github.event.inputs.version }} | |
test_npm_rebuild: | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- ubuntu-20.04 | |
- ubuntu-22.04 | |
- windows-2022 | |
- macos-11 | |
- macos-12 | |
node-version: [18.x, 20.x] | |
steps: | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Create package.json | |
run: npm init --yes | |
- name: Install fonts on Ubuntu | |
run: | | |
[[ '${{ matrix.platform }}' =~ 'ubuntu' ]] && sudo apt-get install -y fonts-ubuntu || true | |
shell: bash | |
- name: Set up the unit tests | |
run: | | |
curl https://codeload.github.com/mmomtchev/magickwand.js/zip/refs/tags/v${{ github.event.inputs.version }} --output repo.zip | |
unzip repo.zip | |
mv magickwand.js-${{ github.event.inputs.version }}/test . | |
- name: Install dependencies | |
run: | | |
npm i chai chai-spies chai-as-promised mocha typescript ts-node tsconfig-paths \ | |
@types/chai @types/chai-as-promised @types/mocha @types/node \ | |
karma karma-chrome-launcher karma-mocha webpack webpack-cli ts-loader | |
shell: bash | |
- name: Install magickwand.js from npm | |
run: | | |
[[ '${{ matrix.platform }}' =~ 'windows' ]] && subst M: `pwd` && cd M:/ | |
npm install --verbose magickwand.js@${{ github.event.inputs.version }} --build-from-source | |
mkdir -p deps/ImageMagick/config | |
cp node_modules/magickwand.js/deps/ImageMagick/config/policy-websafe.xml deps/ImageMagick/config | |
shell: bash | |
- name: Run the unit tests headless | |
uses: GabrielBB/xvfb-action@v1 | |
with: | |
run: npx mocha --require ts-node/register --types mocha --reporter=tap --v8-expose-gc --timeout 5000 test/*.test.ts | |
env: | |
TS_NODE_PROJECT: ${{ github.workspace }}/test/tsconfig.standalone.json | |
MOCHA_INTEGRATION: node,browser | |
MOCHA_MAGICK_INSTALL: npm install --force magickwand.js@${{ github.event.inputs.version }} | |
test_npm_rebuild_light: | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- ubuntu-22.04 | |
node-version: [18.x] | |
steps: | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Create package.json | |
run: npm init --yes | |
- name: Install fonts on Ubuntu | |
run: | | |
[[ '${{ matrix.platform }}' =~ 'ubuntu' ]] && sudo apt-get install -y fonts-ubuntu || true | |
shell: bash | |
- name: Set up the unit tests | |
run: | | |
curl https://codeload.github.com/mmomtchev/magickwand.js/zip/refs/tags/v${{ github.event.inputs.version }} --output repo.zip | |
unzip repo.zip | |
mv magickwand.js-${{ github.event.inputs.version }}/test . | |
- name: Install dependencies | |
run: | | |
npm i chai chai-spies chai-as-promised mocha typescript ts-node tsconfig-paths \ | |
@types/chai @types/chai-as-promised @types/mocha @types/node \ | |
karma karma-chrome-launcher karma-mocha webpack webpack-cli ts-loader | |
shell: bash | |
- name: Install magickwand.js from npm | |
run: | | |
[[ '${{ matrix.platform }}' =~ 'windows' ]] && subst M: `pwd` && cd M:/ | |
npm install --force magickwand.js@${{ github.event.inputs.version }} \ | |
--build-from-source \ | |
--fonts=false --jpeg=true --png=false --tiff=false \ | |
--webp=false --jpeg2000=false --raw=false --openmedia=false \ | |
--brotli=false --h265=false --exr=false --fftw=false --heif=false \ | |
--jbig=true --cms=false --xml=false --gzip=false --zip=false \ | |
--bzip2=true --zstd=false --xz=false --lzma=false --simd=false \ | |
--openmp=true --display=false | |
shell: bash | |
test_npm_rebuild_shared: | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ubuntu-20.04] | |
node-version: [18.x] | |
steps: | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- uses: actions/checkout@v4 | |
with: | |
repository: 'imagemagick/ImageMagick' | |
path: 'ImageMagick' | |
ref: ${{ github.event.inputs.im_version }} | |
- name: Build and install ImageMagick-7 | |
run: | | |
cd ImageMagick | |
sh configure --prefix /usr | |
make -j4 | |
sudo make install | |
- name: Create package.json | |
run: npm init --yes | |
- name: Install fonts on Ubuntu | |
run: | | |
[[ '${{ matrix.platform }}' =~ 'ubuntu' ]] && sudo apt-get install -y fonts-ubuntu || true | |
shell: bash | |
- name: Set up the unit tests | |
run: | | |
curl https://codeload.github.com/mmomtchev/magickwand.js/zip/refs/tags/v${{ github.event.inputs.version }} --output repo.zip | |
unzip repo.zip | |
mv magickwand.js-${{ github.event.inputs.version }}/test . | |
- name: Install dependencies | |
run: | | |
npm i chai chai-spies chai-as-promised mocha typescript ts-node tsconfig-paths \ | |
@types/chai @types/chai-as-promised @types/mocha @types/node \ | |
karma karma-chrome-launcher karma-mocha webpack webpack-cli ts-loader | |
shell: bash | |
- name: Install magickwand.js from npm | |
run: | | |
[[ '${{ matrix.platform }}' =~ 'windows' ]] && subst M: `pwd` && cd M:/ | |
npm install --force magickwand.js@${{ github.event.inputs.version }} --build-from-source --shared_imagemagick --magicklibs="-lMagick++-7.Q16HDRI -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI" | |
mkdir -p deps/ImageMagick/config | |
cp node_modules/magickwand.js/deps/ImageMagick/config/policy-websafe.xml deps/ImageMagick/config | |
env: | |
CFLAGS: -I/usr/include/ImageMagick-7 | |
CXXFLAGS: -I/usr/include/ImageMagick-7 | |
shell: bash | |
- name: Run the unit tests headless | |
uses: GabrielBB/xvfb-action@v1 | |
with: | |
run: npx mocha --require ts-node/register --types mocha --reporter=tap --v8-expose-gc --timeout 5000 test/*.test.ts | |
env: | |
TS_NODE_PROJECT: ${{ github.workspace }}/test/tsconfig.standalone.json | |
MOCHA_INTEGRATION: node,browser | |
MOCHA_MAGICK_INSTALL: npm install --force magickwand.js@${{ github.event.inputs.version }} |