pull/7267/head
zomars 2023-02-18 12:09:58 -07:00
parent 81287f963b
commit 7aafa78f14
3 changed files with 31 additions and 30 deletions

View File

@ -26,10 +26,8 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: setup needs: setup
steps: steps:
- name: Checkout - uses: actions/checkout@v3
uses: actions/checkout@v3
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
name: Set nodeJs version
with: with:
node-version: ${{ env.node_version }} node-version: ${{ env.node_version }}
- name: Restore node_modules from cache - name: Restore node_modules from cache
@ -40,8 +38,7 @@ jobs:
with: with:
path: node_modules path: node_modules
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-fingerprint }} key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-fingerprint }}
- name: lint the code - run: yarn lint
run: yarn lint
build: build:
name: Production build name: Production build
needs: setup needs: setup
@ -51,22 +48,14 @@ jobs:
e2e-test: e2e-test:
name: E2E tests name: E2E tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [lint, build] needs: [lint, build]
timeout-minutes: 10 timeout-minutes: 10
steps: steps:
- name: Checkout - uses: actions/checkout@v3
uses: actions/checkout@v3
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
name: Set nodeJs version
with: with:
node-version: ${{ env.node_version }} node-version: ${{ env.node_version }}
- name: Restore node_modules from cache - name: Restore node_modules from cache
uses: actions/cache@v3 uses: actions/cache@v3
env: env:
@ -75,10 +64,7 @@ jobs:
with: with:
path: node_modules path: node_modules
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-fingerprint }} key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-fingerprint }}
- run: yarn playwright install
# figure the better way supporting all the packages
- name: Fake yarn postinstall
run: yarn playwright install
- name: Run tests - name: Run tests
run: yarn e2e run: yarn e2e
analyze: analyze:
@ -89,6 +75,31 @@ jobs:
# change this if your nextjs app does not live at the root of the repo # change this if your nextjs app does not live at the root of the repo
working-directory: ./apps/web/ working-directory: ./apps/web/
steps: 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 # Here's the first place where next-bundle-analysis' own script is used
# This step pulls the raw bundle stats for the current bundle # This step pulls the raw bundle stats for the current bundle
- name: Analyze bundle - name: Analyze bundle

View File

@ -79,8 +79,7 @@ jobs:
key-2: ${{ hashFiles('apps/web/next.config.js') }} key-2: ${{ hashFiles('apps/web/next.config.js') }}
with: with:
path: | path: |
public apps/web/.next
.cache
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-${{ github.sha }} key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-${{ github.sha }}
restore-keys: |- restore-keys: |-
${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}- ${{ runner.os }}-${{ env.cache-name }}-${{ env.key-1 }}-${{ env.key-2 }}-

View File

@ -9,23 +9,15 @@ on:
jobs: jobs:
setup: setup:
name: Yarn install & cache name: Yarn install & cache
runs-on: ubuntu-latest runs-on: ubuntu-latest
concurrency: concurrency:
group: yarn-install-${{ github.sha }} group: yarn-install-${{ github.sha }}
timeout-minutes: 10 timeout-minutes: 10
steps: steps:
- name: Checkout - uses: actions/checkout@v3
uses: actions/checkout@v3
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
name: Set nodeJs version
with: with:
node-version: ${{ secrets.NODE_VERSION }} node-version: ${{ secrets.NODE_VERSION }}
# node_module cache helps to avoid 1 minute copying from yarn cache on every job run # node_module cache helps to avoid 1 minute copying from yarn cache on every job run
- name: node_modules cache - name: node_modules cache
id: node-modules-cache id: node-modules-cache
@ -37,7 +29,6 @@ jobs:
path: node_modules path: node_modules
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-key }} key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-key }}
restore-keys: ${{ runner.os }}-${{ env.cache-name }}- restore-keys: ${{ runner.os }}-${{ env.cache-name }}-
- name: Yarn install - name: Yarn install
if: steps.node-modules-cache.outputs.cache-hit != 'true' if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: yarn install --prefer-offline --frozen-lockfile run: yarn install --prefer-offline --frozen-lockfile