From 4cdadb59928777aef5484fb850fb32c430f1196d Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Fri, 15 Jul 2022 17:27:26 +0100 Subject: [PATCH 1/2] Cache frontend `.next` folder in CI (#810) --- .github/actions/warm-up-repo/action.yml | 2 +- .github/workflows/ci.yml | 16 ++++++++++++---- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/hash-backend-cd.yml | 10 +++++----- .github/workflows/labeler.yml | 2 +- .github/workflows/sync-algolia-index.yml | 4 ++-- 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.github/actions/warm-up-repo/action.yml b/.github/actions/warm-up-repo/action.yml index 22210031c5c..7363bbfc0e9 100644 --- a/.github/actions/warm-up-repo/action.yml +++ b/.github/actions/warm-up-repo/action.yml @@ -4,7 +4,7 @@ description: Prepares Node and Yarn dependencies runs: using: composite steps: - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 with: node-version: 18 cache: yarn diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38e7c1230a5..da2b15e45ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ jobs: name: Linting runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: ./.github/actions/warm-up-repo @@ -125,7 +125,7 @@ jobs: name: Backend integration tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: ./.github/actions/warm-up-repo @@ -180,7 +180,15 @@ jobs: name: Playwright tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + + - uses: actions/cache@v3 + with: + path: packages/hash/frontend/.next/cache + key: ${{ runner.os }}-frontend-next-cache-${{ hashFiles('yarn.lock') }}-${{ hashFiles('packages/hash/frontend/**') }} + restore-keys: | + ${{ runner.os }}-frontend-next-cache-${{ hashFiles('yarn.lock') }}- + ${{ runner.os }}-frontend-next-cache - uses: ./.github/actions/warm-up-repo @@ -257,7 +265,7 @@ jobs: name: Unit tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: ./.github/actions/warm-up-repo diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 64c058c0298..d7e9f44e176 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -30,7 +30,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/hash-backend-cd.yml b/.github/workflows/hash-backend-cd.yml index a45aa0d4584..75727912bb9 100644 --- a/.github/workflows/hash-backend-cd.yml +++ b/.github/workflows/hash-backend-cd.yml @@ -33,7 +33,7 @@ jobs: name: Build and push HASH api image runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Docker image build through docker-build-push uses: ./.github/actions/docker-build-push @@ -52,7 +52,7 @@ jobs: name: Build and push HASH realtime image runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Docker image build through docker-build-push uses: ./.github/actions/docker-build-push @@ -71,7 +71,7 @@ jobs: name: Build and push HASH searchloader image runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Docker image build through docker-build-push uses: ./.github/actions/docker-build-push @@ -94,7 +94,7 @@ jobs: - build-realtime - build-searchloader steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: ./.github/actions/docker-ecr-login with: @@ -103,7 +103,7 @@ jobs: AWS_REGION: ${{ env.AWS_REGION }} # Node is used for migrating the DB - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 with: node-version: 16 cache: yarn diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 27719aa1602..c401d32ee4b 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -6,6 +6,6 @@ jobs: triage: runs-on: ubuntu-latest steps: - - uses: actions/labeler@v3 + - uses: actions/labeler@v4 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/sync-algolia-index.yml b/.github/workflows/sync-algolia-index.yml index 97bf01991fb..a0b000305d6 100644 --- a/.github/workflows/sync-algolia-index.yml +++ b/.github/workflows/sync-algolia-index.yml @@ -14,8 +14,8 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: node-version: 18 cache: yarn From e248d06d0b783a7d93875a7323d13e4ddd319fc9 Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Fri, 15 Jul 2022 18:07:34 +0100 Subject: [PATCH 2/2] Skip Playwright downloads by default to speed up CI (#813) --- .github/actions/warm-up-repo/action.yml | 12 ++++++++++++ .github/workflows/ci.yml | 5 ++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/actions/warm-up-repo/action.yml b/.github/actions/warm-up-repo/action.yml index 7363bbfc0e9..e9a3267b49e 100644 --- a/.github/actions/warm-up-repo/action.yml +++ b/.github/actions/warm-up-repo/action.yml @@ -1,6 +1,12 @@ name: Warm-up repo description: Prepares Node and Yarn dependencies +inputs: + playwright-deps: + default: "" + description: "List of browsers separated by space, e.g. 'chrome firefox'" + required: false + runs: using: composite steps: @@ -11,3 +17,9 @@ runs: - run: yarn install shell: bash + env: + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: ${{ inputs.playwright-deps == '' }} + + - run: yarn playwright install-deps ${{ inputs.playwright-deps }} + if: ${{ inputs.playwright-deps != '' }} + shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da2b15e45ea..0cf4e95edf2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -191,6 +191,8 @@ jobs: ${{ runner.os }}-frontend-next-cache - uses: ./.github/actions/warm-up-repo + with: + playwright-deps: chrome firefox - name: Create temp files and folders run: | @@ -221,9 +223,6 @@ jobs: yarn workspace @hashintel/hash-frontend start 2>&1 | tee var/logs/frontend.log & ## ampersand enables background mode yarn wait-on --timeout 30000 http://0.0.0.0:3000 - - run: yarn playwright install-deps chrome firefox - if: ${{ success() || failure() }} - - name: Run Playwright tests if: ${{ success() || failure() }} run: |