diff --git a/.github/workflows/sanity-checks.yml b/.github/workflows/sanity-checks.yml index 588a360..acad404 100644 --- a/.github/workflows/sanity-checks.yml +++ b/.github/workflows/sanity-checks.yml @@ -1,36 +1,55 @@ -# 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: Sanity Checks Workflow +name: Sanity Checks on: push: branches: - main + pull_request: + branches: + - main jobs: - 'sanity-checks': + setup: + name: Setup Dependencies runs-on: ubuntu-latest - + outputs: + cache-key: ${{ steps.cache-node-modules.outputs.cache-hit }} steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '22.11.0' + node-version: '22.x' + + - name: Cache node_modules + id: cache-node-modules + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }} - name: Install dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' run: yarn install --immutable - - name: Typecheck - run: yarn typecheck + sanity-check: + name: Sanity Checks + runs-on: ubuntu-latest + needs: [setup] + steps: + - name: Restore node_modules + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ needs.setup.outputs.cache-key }} - - name: Lint Codebase - run: yarn lint + - name: Run Type Check + run: yarn run typecheck - - name: Tests - run: yarn test + - name: Run Lint + run: yarn run lint - - name: Build - run: yarn build + - name: Run Tests + run: yarn run test