Skip to content

Commit

Permalink
build: Upgrade build setup
Browse files Browse the repository at this point in the history
- use rollup
- use vitest
- build on node v20
- package test
  • Loading branch information
vio committed Aug 27, 2023
1 parent 6c2a7ed commit c879d78
Show file tree
Hide file tree
Showing 16 changed files with 1,532 additions and 5,642 deletions.
132 changes: 132 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: ci
on: [push]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Resolve caching
id: cache
if: ${{ github.ref_name != 'update-dependencies' && !startsWith(github.ref_name, 'dependabot/') }}
run: echo "npm_cache=npm" >> $GITHUB_STATE

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: ${{ env.npm_cache }}

- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

test-unit:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Resolve caching
id: cache
if: ${{ github.ref_name != 'update-dependencies' && !startsWith(github.ref_name, 'dependabot/') }}
run: echo "npm_cache=npm" >> $GITHUB_STATE

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: ${{ env.npm_cache }}

- name: Install dependencies
run: npm ci

- name: Test
run: npm run test:unit

build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Resolve caching
id: cache
if: ${{ github.ref_name != 'update-dependencies' && !startsWith(github.ref_name, 'dependabot/') }}
run: echo "npm_cache=npm" >> $GITHUB_STATE

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: ${{ env.npm_cache }}

- name: Install dependencies
run: npm ci

- name: Build
run: yarn run build

- name: Upload build files
uses: actions/upload-artifact@v3
with:
name: build-artifacts
retention-days: 1
path:
dist*/

test-package:
name: Test package on node ${{ matrix.node }} / ${{ matrix.os }}
needs:
- build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ['20', '18', '16', '14']
os: [ubuntu-latest, windows-latest]
exclude:
- os: windows-latest
node: 20
- os: windows-latest
node: 18
- os: windows-latest
node: 16
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Install vitest
run: npm install vitest

- name: Download build files
uses: actions/download-artifact@v3
with:
name: build-artifacts

- name: Setup local npm registry
run: ./scripts/setup-registry.sh

- name: Install test package dependencies
run: npm install
working-directory: test/package

- name: Test package
run: npm run test:package

tests:
needs:
- lint
- test-unit
- test-package
runs-on: ubuntu-latest
steps:
- run: exit 0
37 changes: 0 additions & 37 deletions .github/workflows/main.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
rollup.config.mjs
verdaccio.yml
tsconfig.json
scripts/**/*
test/**/*
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v14
v20
Loading

0 comments on commit c879d78

Please sign in to comment.