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