Skip to content

Commit

Permalink
WIP: CI: Add smoke test for npm-published package
Browse files Browse the repository at this point in the history
  • Loading branch information
lovell committed Sep 28, 2023
1 parent 59327bd commit 1e62c12
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1e62c12

Please sign in to comment.