From 7aafa78f1463f5a22576f814fa70db73db1ff89e Mon Sep 17 00:00:00 2001 From: zomars Date: Sat, 18 Feb 2023 12:09:58 -0700 Subject: [PATCH] test --- .github/workflows/pr.yml | 47 ++++++++++++++++---------- .github/workflows/production-build.yml | 3 +- .github/workflows/yarn-install.yml | 11 +----- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index eef628757f..281fe50e56 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -26,10 +26,8 @@ jobs: runs-on: ubuntu-latest needs: setup steps: - - name: Checkout - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - uses: actions/setup-node@v3 - name: Set nodeJs version with: node-version: ${{ env.node_version }} - name: Restore node_modules from cache @@ -40,8 +38,7 @@ jobs: with: path: node_modules key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-fingerprint }} - - name: lint the code - run: yarn lint + - run: yarn lint build: name: Production build needs: setup @@ -51,22 +48,14 @@ jobs: e2e-test: name: E2E tests - runs-on: ubuntu-latest - needs: [lint, build] - timeout-minutes: 10 - steps: - - name: Checkout - uses: actions/checkout@v3 - + - uses: actions/checkout@v3 - uses: actions/setup-node@v3 - name: Set nodeJs version with: node-version: ${{ env.node_version }} - - name: Restore node_modules from cache uses: actions/cache@v3 env: @@ -75,10 +64,7 @@ jobs: with: path: node_modules key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-fingerprint }} - - # figure the better way supporting all the packages - - name: Fake yarn postinstall - run: yarn playwright install + - run: yarn playwright install - name: Run tests run: yarn e2e analyze: @@ -89,6 +75,31 @@ jobs: # change this if your nextjs app does not live at the root of the repo working-directory: ./apps/web/ steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: ${{ env.node_version }} + - name: Restore node_modules from cache + uses: actions/cache@v3 + env: + cache-name: node-modules-yarn + cache-fingerprint: ${{ env.node_version }}-${{ hashFiles('yarn.lock') }} + with: + path: node_modules + key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-fingerprint }} + - name: Restore production build from cache + uses: actions/cache@v3 + env: + cache-name: prod-build + key-1: ${{ secrets.NODE_VERSION }}-${{ hashFiles('yarn.lock') }} + key-2: ${{ hashFiles('apps/web/next.config.js') }} + with: + path: | + apps/web/.next + key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-${{ github.sha }} + restore-keys: |- + ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}- + ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}- # Here's the first place where next-bundle-analysis' own script is used # This step pulls the raw bundle stats for the current bundle - name: Analyze bundle diff --git a/.github/workflows/production-build.yml b/.github/workflows/production-build.yml index 00d51cf54f..cc9d3e68b8 100644 --- a/.github/workflows/production-build.yml +++ b/.github/workflows/production-build.yml @@ -79,8 +79,7 @@ jobs: key-2: ${{ hashFiles('apps/web/next.config.js') }} with: path: | - public - .cache + apps/web/.next key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-${{ github.sha }} restore-keys: |- ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}- diff --git a/.github/workflows/yarn-install.yml b/.github/workflows/yarn-install.yml index 467bb1cce2..f01ca72297 100644 --- a/.github/workflows/yarn-install.yml +++ b/.github/workflows/yarn-install.yml @@ -9,23 +9,15 @@ on: jobs: setup: name: Yarn install & cache - runs-on: ubuntu-latest - concurrency: group: yarn-install-${{ github.sha }} - timeout-minutes: 10 - steps: - - name: Checkout - uses: actions/checkout@v3 - + - uses: actions/checkout@v3 - uses: actions/setup-node@v3 - name: Set nodeJs version with: node-version: ${{ secrets.NODE_VERSION }} - # node_module cache helps to avoid 1 minute copying from yarn cache on every job run - name: node_modules cache id: node-modules-cache @@ -37,7 +29,6 @@ jobs: path: node_modules key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-key }} restore-keys: ${{ runner.os }}-${{ env.cache-name }}- - - name: Yarn install if: steps.node-modules-cache.outputs.cache-hit != 'true' run: yarn install --prefer-offline --frozen-lockfile