Skip to content

Commit

Permalink
ci: optimize workflows and test commands
Browse files Browse the repository at this point in the history
  • Loading branch information
domhhv committed Nov 2, 2024
1 parent 3ea86b9 commit 96537f1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 60 deletions.
92 changes: 34 additions & 58 deletions .github/workflows/code-health.yml
Original file line number Diff line number Diff line change
@@ -1,86 +1,62 @@
# .github/workflows/code-health.yml
name: Code health checks

name: Code health checks # name of the action (displayed in the github interface)

on: # event list
pull_request: # on a pull request to each of these branches
on:
pull_request:
branches:
- main

env: # environment variables (available in any part of the action)
NODE_VERSION: 20
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }}
env:
NODE_VERSION: 22

jobs: # list of things to do
typecheck:
name: Type Check # job name (unique id)
runs-on: ubuntu-latest # on which machine to run
steps: # list of steps
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Install NodeJS
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Cache Yarn Dependencies
uses: actions/cache@v3
with:
path: |
~/.yarn-cache
node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Code Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install Dependencies
run: yarn install

typecheck:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Type Checking
run: yarn typecheck

linting:
name: Linting # job name (unique id)
runs-on: ubuntu-latest # on which machine to run
steps: # list of steps
- name: Install NodeJS
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}

- name: Code Checkout
uses: actions/checkout@v2

- name: Install Dependencies
run: yarn install

needs: setup
runs-on: ubuntu-latest
steps:
- name: Code Linting
run: yarn eslint:check

formatting:
name: Formatting # job name (unique id)
runs-on: ubuntu-latest # on which machine to run
steps: # list of steps
- name: Install NodeJS
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}

- name: Code Checkout
uses: actions/checkout@v2

- name: Install Dependencies
run: yarn install

needs: setup
runs-on: ubuntu-latest
steps:
- name: Code Formatting
run: yarn prettier:check

testing:
name: Testing # job name (unique id)
runs-on: ubuntu-latest # on which machine to run
steps: # list of steps
- name: Install NodeJS
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}

- name: Code Checkout
uses: actions/checkout@v2

- name: Install Dependencies
run: yarn install

needs: setup
runs-on: ubuntu-latest
steps:
- name: Unit Tests
run: yarn test
2 changes: 1 addition & 1 deletion .github/workflows/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
SUPABASE_PROJECT_ID: ${{ secrets.SUPABASE_PROJECT_ID }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: supabase/setup-cli@v1
with:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"react",
"typescript",
"vite",
"zustand",
"eslint",
"prettier",
"react-aria",
Expand All @@ -34,7 +35,7 @@
"eslint:fix": "eslint --fix .",
"prettier:check": "prettier --check .",
"prettier:write": "prettier --write .",
"test": "DEBUG_PRINT_LIMIT=30000 jest --runInBand --config tests/jest.config.js --no-cache",
"test": "DEBUG_PRINT_LIMIT=30000 jest --config tests/jest.config.js",
"test:watch": "yarn test --watch",
"test:coverage": "yarn test --coverage",
"test:clear-cache": "jest --clearCache",
Expand Down

0 comments on commit 96537f1

Please sign in to comment.