From fd8b559a135820567f40dbb47a4b4dfc2ef44755 Mon Sep 17 00:00:00 2001 From: zomars Date: Tue, 28 Feb 2023 13:00:49 -0700 Subject: [PATCH] One more time --- .github/actions/cache-build/action.yml | 4 +++- .github/actions/yarn-install/action.yml | 12 +++++++++++- .github/workflows/pr.yml | 10 +++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/actions/cache-build/action.yml b/.github/actions/cache-build/action.yml index 93f9ef528c..7d6605058d 100644 --- a/.github/actions/cache-build/action.yml +++ b/.github/actions/cache-build/action.yml @@ -15,12 +15,14 @@ runs: key-1: ${{ inputs.node_version }}-${{ hashFiles('yarn.lock') }} key-2: ${{ hashFiles('apps/**/**.[jt]s', 'apps/**/**.[jt]sx', 'packages/**/**.[jt]s', 'packages/**/**.[jt]sx', '!**/node_modules') }} key-3: ${{ github.event.pull_request.number || github.ref }} + # Ensures production-build.yml will always be fresh + key-4: ${{ github.sha }} with: path: | ${{ github.workspace }}/apps/web/.next **/.turbo/** **/dist/** - key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-${{ env.key-3 }} + key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-${{ env.key-3 }}-${{ env.key-4 }} - run: yarn build if: steps.cache-build.outputs.cache-hit != 'true' shell: bash diff --git a/.github/actions/yarn-install/action.yml b/.github/actions/yarn-install/action.yml index d6ae98b4bd..d9e30bbcf9 100644 --- a/.github/actions/yarn-install/action.yml +++ b/.github/actions/yarn-install/action.yml @@ -11,7 +11,17 @@ runs: uses: actions/setup-node@v3 with: node-version: ${{ inputs.node_version }} - cache: "yarn" + - name: node_modules cache + id: node-modules-cache + uses: actions/cache@v3 + env: + cache-name: node-modules-yarn + cache-key: ${{ inputs.node_version }}-${{ hashFiles('yarn.lock', 'packages/prisma/schema.prisma') }} + with: + path: | + **/node_modules/** + packages/prisma/zod + key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-key }} - name: Yarn install shell: bash run: | diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index c7c3159bf4..e306a557eb 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -37,24 +37,32 @@ jobs: uses: ./.github/workflows/env-create-file.yml secrets: inherit + setup: + name: Yarn install & cache + uses: ./.github/workflows/yarn-install.yml + secrets: inherit + type-check: name: Type check + needs: setup uses: ./.github/workflows/check-types.yml secrets: inherit test: name: Unit tests + needs: setup uses: ./.github/workflows/test.yml secrets: inherit lint: name: Linters + needs: setup uses: ./.github/workflows/lint.yml secrets: inherit build: name: Production build - needs: env + needs: [setup, env] uses: ./.github/workflows/production-build.yml secrets: inherit