WIP: CI: fix npm package smoke tests #4
Workflow file for this run
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: npm smoke test" | |
on: push | |
# push: | |
# tags: | |
# - "v**" | |
permissions: {} | |
jobs: | |
release-smoke-test: | |
name: "${{ github.ref_name }} ${{ matrix.name }}" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: linux-x64 | |
os: ubuntu-22.04 | |
- name: darwin-x64 | |
os: macos-11 | |
- name: win32-x64 | |
os: windows-2019 | |
steps: | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Install Deno | |
uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
- name: Install Bun | |
if: ${{ !contains(matrix.os, 'windows') }} | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: Version | |
id: version | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
core.setOutput('semver', context.ref.replace('refs/tags/v','')) | |
core.setOutput('semver','0.33.0-alpha.8') | |
- name: Create package.json | |
uses: DamianReeves/[email protected] | |
with: | |
path: package.json | |
contents: | | |
{ | |
"dependencies": { | |
"sharp": "${{ steps.version.outputs.semver }}" | |
} | |
} | |
- name: Create release.mjs | |
uses: DamianReeves/[email protected] | |
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: Run with Node.js + npm | |
run: | | |
npm install --ignore-scripts | |
node release.mjs | |
rm -r node_modules/ | |
rm package-lock.json | |
ls | |
- name: Run with Node.js + pnpm | |
run: | | |
pnpm install --ignore-scripts | |
node release.mjs | |
rm -r node_modules/ | |
rm pnpm-lock.yaml | |
ls | |
- name: Run with Node.js + yarn | |
run: | | |
corepack enable | |
yarn set version stable | |
yarn config set enableImmutableInstalls false | |
yarn config set enableScripts false | |
yarn config set nodeLinker node-modules | |
yarn install | |
node release.mjs | |
rm -r node_modules/ | |
rm -r .yarn/ | |
rm yarn.lock | |
rm .yarnrc.yml | |
corepack disable | |
ls | |
- name: Run with Deno | |
run: | | |
deno run --allow-read --allow-ffi release.mjs | |
ls | |
- name: Run with Bun | |
if: ${{ !contains(matrix.os, 'windows') }} | |
run: | | |
bun install --ignore-scripts | |
bun release.mjs | |
ls |