diff --git a/.github/workflows/npm.yml b/.github/workflows/npm.yml new file mode 100644 index 000000000..2efb1952a --- /dev/null +++ b/.github/workflows/npm.yml @@ -0,0 +1,72 @@ +name: npm smoke test + +on: + - release +permissions: {} + +jobs: + release-smoke-test: + name: ${{ github.ref }} ${{ matrix.name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - name: linux-x64-node-deno-bun + os: ubuntu-22.04 + - name: darwin-x64-node-deno-bun + os: macos-11 + - name: win32-x64-node-deno + os: windows-2019 + steps: + - name: Create package.json + uses: DamianReeves/write-file-action@v1 + with: + path: package.json + contents: | + { + "dependencies": { + "sharp": "${{ github.ref }}" + } + } + - name: Create release.mjs + uses: DamianReeves/write-file-action@v1 + with: + path: release.mjs + contents: | + import { createRequire } from 'node:module'; + import { deepStrictEqual } from 'node:assert'; + const require = createRequire(import.meta.url); + const sharp = require('sharp'); + deepStrictEqual(['.jpg', '.jpeg', '.jpe'], sharp.format.jpeg.input.fileSuffix); + + - name: Install Node.js + if: ${{ contains(matrix.name, 'node') }} + uses: actions/setup-node@v3 + with: + node-version: 20 + - name: Run with Node.js + if: ${{ contains(matrix.name, 'node') }} + run: | + npm install + node release.mjs + + - name: Install Deno + if: ${{ contains(matrix.name, 'deno') }} + uses: denoland/setup-deno@v1 + with: + deno-version: v1.x + - name: Run with Deno + if: ${{ contains(matrix.name, 'deno') }} + run: deno run --allow-read --allow-ffi release.mjs + + - name: Install Bun + if: ${{ contains(matrix.name, 'bun') }} + uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + - name: Run with Bun + if: ${{ contains(matrix.name, 'bun') }} + run: | + bun install + bun release.mjs