Skip to content

Commit

Permalink
ci: add publishing yml and vitest coverage ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Zakrok09 committed Apr 22, 2024
1 parent daea95e commit 969f05a
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Node.js Package

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm ci
- run: npm test

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
27 changes: 27 additions & 0 deletions .github/workflows/vitest-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Vitest Unit Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest

permissions:
contents: read
pull-requests: write

steps:
- uses: actions/checkout@v4
- name: 'Install Node'
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: 'Install Deps'
run: npm install
- name: 'Test'
run: npx vitest --coverage.enabled true
- name: 'Report Coverage'
if: always()
uses: davelosert/vitest-coverage-report-action@v2
4 changes: 3 additions & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
coverage: {
provider: 'v8'
provider: 'v8',
reporter: ['text', "json-summary", "json"],
reportOnFailure: true
},
},
})

0 comments on commit 969f05a

Please sign in to comment.