Skip to content

Commit

Permalink
ci: add codeQuality and build jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalexiei committed Feb 23, 2024
1 parent 14598e2 commit f620bee
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 9 deletions.
48 changes: 41 additions & 7 deletions .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint & Test
name: Format, Lint, & Test

on:
push:
Expand All @@ -10,8 +10,46 @@ on:
- '**'

jobs:
codeQuality:
name: Check code quality (lint and format)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install dependencies
run: npm install

- name: Format check
run: npm run format

- name: Format check
run: npm run lint

build:
name: Build
runs-on: ubuntu-latest
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install dependencies
run: npm install

- name: Build
run: npm run build

test:
name: Lint & test on node ${{ matrix.node }} and ${{ matrix.os }}
name: Test on node ${{ matrix.node }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -29,15 +67,11 @@ jobs:
- name: Install dependencies
run: npm install

# lint is included in pretest
# - name: Lint
# run: npm run lint

- name: Test
run: npm test

- name: Run test to generate coverage
run: npm run test:coverage

- name: Coveralls
uses: coverallsapp/github-action@v2
uses: coverallsapp/github-action@v2
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@
},
"scripts": {
"lint": "eslint src typescript test \"./*.{ts,mts}\"",
"pretest": "npm run generate_ts_v4_index && npm run lint",
"format": "prettier \"{,**/}*.{ts,tsx,mts,js,json,md}\" --check",
"format:fix": "prettier \"{,**/}*.{ts,tsx,mts,js,json,md}\" --write",
"pretest": "npm run generate_ts_v4_index",
"test": "vitest --run",
"test:coverage": "vitest --project runtime --project compatibility --coverage --run",
"test:runtime": "vitest --project runtime",
Expand All @@ -113,7 +115,6 @@
"fix_dist_package": "node -e 'console.log(`{\"type\":\"module\",\"version\":\"${process.env.npm_package_version}\"}`)' > dist/esm/package.json",
"preversion": "npm run test && npm run build && git push",
"postversion": "npm run fix_dist_package && git push && git push --tags && npm run release",
"prettier": "prettier --write \"{,**/}*.{ts,tsx,mts,js,json,md}\"",
"prepare": "husky install",
"release": "gh-release"
},
Expand Down

0 comments on commit f620bee

Please sign in to comment.