Skip to content

feat: add programmatic API export (#24) #53

feat: add programmatic API export (#24)

feat: add programmatic API export (#24) #53

Workflow file for this run

name: Build & Test
on:
push:
branches: [main, 'release/**']
pull_request:
concurrency:
group: ${{ github.ref_name || github.sha }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version-file: package.json
cache: npm
- name: Setup NPM dependencies
run: npm install
- name: Build
run: npm run build
- name: Store dist
uses: actions/upload-artifact@v7
with:
name: dist
if-no-files-found: error
path: dist/**
test:
name: Smoke Test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
needs: build
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version-file: package.json
cache: npm
- name: Setup NPM dependencies
run: npm install
- name: Download dist
uses: actions/download-artifact@v7
with:
name: dist
path: dist
merge-multiple: true
- name: Smoke test
run: |
node dist/bin/cli.js
- name: Test with asset
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
cd test
node ../dist/bin/cli.js -a asset.txt --no-bundle sample.cjs
expected=$(cat asset.txt)
actual=$(./dist-bin/sample-linux-x64)
[ "$actual" = "$expected" ]
artifacts:
name: Artifacts
if: startsWith(github.ref, 'refs/heads/release/')
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: package.json
cache: npm
- run: npm ci
- uses: actions/download-artifact@v7
with:
name: dist
path: dist
- name: Pack tarball
run: npm pack
- uses: actions/upload-artifact@v7
with:
name: npm-tarball
path: '*.tgz'