Improve vitest config and add GitHub action for lint + testing #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests. | |
# For now we only run against node 22.x, but can easily add more node versions should we decide to support them. | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
name: Node.js CI | |
on: | |
push: | |
branches: ['main'] | |
pull_request: | |
branches: ['main'] | |
jobs: | |
frontend: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
node-version: [22.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Install frontend dependencies | |
run: npm ci | |
- name: Lint frontend | |
run: npm run lint | |
- name: Check code format (also checks backend code) | |
run: npm run check:format | |
- name: Check that the frontend can successfully build (runs type checking) | |
run: npm run build | |
backend: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
node-version: [22.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Install server dependencies | |
working-directory: ./server | |
run: npm ci | |
- name: Lint backend | |
working-directory: ./server | |
run: npm run check | |
- name: Run backend tests | |
working-directory: ./server | |
run: npm run test |