Skip to content

chore: Migrate to vitest #38

chore: Migrate to vitest

chore: Migrate to vitest #38

name: 🧪 Test and 🚀 Release
on:
push:
branches:
- main
- beta
pull_request: {}
jobs:
test-and-release:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
node-version: [18.x, 22.x]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.node-version }}
cancel-in-progress: true
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@main
- name: ⎔ Setup node ${{ matrix.node-version }}
uses: actions/setup-node@26961cf329f22f6837d5f54c3efd76b480300ace # pin@main
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: 🗄 Cache node_modules
id: cache-node_modules
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # pin@main
with:
path: "**/node_modules"
key: node_modules-${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
- name: 🗄 Cache .eslintcache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # pin@main
with:
path: .eslintcache
key: eslintcache-${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
- name: 📥 Install dependencies
if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: |
npm ci --ignore-scripts
- name: 🧪 Test
run: |
npm run prepare:build
npm test
env:
CI: true
- name: ⬆️ Upload coverage report
uses: coverallsapp/github-action@643bc377ffa44ace6394b2b5d0d3950076de9f63 # pin@main
if: "contains(' refs/heads/main refs/heads/beta ', github.ref) && matrix.node-version == '22.x'"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: 🚀 Release
if: "contains(' refs/heads/main refs/heads/beta ', github.ref) && matrix.node-version == '22.x'"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm run release