ci: optimize workflows and test commands #170
Workflow file for this run
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
name: Code health checks | |
on: | |
pull_request: | |
branches: | |
- main | |
env: | |
NODE_VERSION: 22 | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
cache-key: ${{ steps.cache.outputs.cache-key }} | |
steps: | |
- name: Install NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Code Checkout | |
uses: actions/checkout@v4 | |
- name: Cache Yarn Dependencies | |
id: yarn-cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.yarn-cache | |
node_modules | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install Dependencies | |
run: yarn install | |
typecheck: | |
needs: setup | |
runs-on: ubuntu-latest | |
steps: | |
- name: Code Checkout | |
uses: actions/checkout@v4 | |
- name: Restore Yarn Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.yarn-cache | |
node_modules | |
key: ${{ needs.setup.outputs.cache-key }} | |
- name: Type Checking | |
run: yarn typecheck | |
linting: | |
needs: setup | |
runs-on: ubuntu-latest | |
steps: | |
- name: Code Checkout | |
uses: actions/checkout@v4 | |
- name: Restore Yarn Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.yarn-cache | |
node_modules | |
key: ${{ needs.setup.outputs.cache-key }} | |
- name: Code Linting | |
run: yarn eslint:check | |
formatting: | |
needs: setup | |
runs-on: ubuntu-latest | |
steps: | |
- name: Code Checkout | |
uses: actions/checkout@v4 | |
- name: Restore Yarn Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.yarn-cache | |
node_modules | |
key: ${{ needs.setup.outputs.cache-key }} | |
- name: Code Formatting | |
run: yarn prettier:check | |
testing: | |
needs: setup | |
runs-on: ubuntu-latest | |
steps: | |
- name: Code Checkout | |
uses: actions/checkout@v4 | |
- name: Restore Yarn Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.yarn-cache | |
node_modules | |
key: ${{ needs.setup.outputs.cache-key }} | |
- name: Unit Tests | |
run: yarn test |