Skip to content

Commit

Permalink
Add GitHub CI workflow config.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrause committed Nov 19, 2024
1 parent a2fb249 commit 5c31a2a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: CI

on:
push:
branches: [ "**" ]
pull_request:
branches: [ "**" ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm run ci-project
#- run: npm run build --if-present
- run: npm test
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"scripts": {
"gen-package": "node package.json.js",
"install-project": "npm run gen-package && npm install --force",
"ci-project": "npm ci --force",
"node": "node --import=tsx",
"repl": "tsx",
"plop": "NODE_OPTIONS=\"--import tsx\" plop",
Expand All @@ -41,11 +42,11 @@
"build": "vite --config=./vite.config.ts --emptyOutDir build",
"storybook:serve": "storybook dev -p 6006",
"storybook:build": "storybook build --docs",
"check-types": "tsc --noEmit",
"check:types": "tsc --noEmit",
"lint:style": "stylelint 'src/**/*.scss'",
"lint:script": "biome",
"lint": "npm run list:style && npm run lint:script",
"test": "vitest run --root=.",
"test": "npm run check:types",
"test-ui": "vitest --ui",
"coverage": "vitest run --coverage",
"start": "npm run storybook:serve",
Expand Down
7 changes: 5 additions & 2 deletions package.json.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ const packageConfig = {
scripts: {
// Utilities
'gen-package': 'node package.json.js', // Update `package.json`
// Use --force currently since we're using React v19 rc. Once peer deps are updated remove this.
'install-project': 'npm run gen-package && npm install --force',
'ci-project': 'npm ci --force',

// CLI
'node': 'node --import=tsx',
Expand All @@ -59,14 +61,15 @@ const packageConfig = {
'storybook:build': 'storybook build --docs',

// Static analysis
'check-types': 'tsc --noEmit',
'check:types': 'tsc --noEmit',
'lint:style': `stylelint 'src/**/*.scss'`,
'lint:script': 'biome',
'lint': 'npm run list:style && npm run lint:script',

// Test
// Note: use `vitest run --root=. src/...` to run a single test file
'test': 'vitest run --root=.', // Need to specify `--root=.` since the vite root is set to `./app`
//'test': 'vitest run --root=.', // Need to specify `--root=.` since the vite root is set to `./app`
'test': 'npm run check:types',
'test-ui': 'vitest --ui',
'coverage': 'vitest run --coverage',

Expand Down

0 comments on commit 5c31a2a

Please sign in to comment.