From fa2c5967f8a99201ff3c8d3fc829e62df38c72ea Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Tue, 28 Feb 2023 19:28:20 +0800 Subject: [PATCH 1/5] ci: add cypress & playwright binary caches --- .github/workflows/ci.yml | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 915d37ff..55ae3469 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -113,11 +113,39 @@ jobs: path: outfile.cjs key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Build the package on cache miss - if: steps.cache.outputs.cache-hit != 'true' + if: steps.cache-restore.outputs.cache-hit != 'true' run: pnpm install && pnpm build env: + # The main project doesn't need Cypress binaries CYPRESS_INSTALL_BINARY: 0 + # https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62 + # Install playwright's binary under custom directory to cache + - name: Set Playwright & Cypress path + if: runner.os != 'Windows' + run: | + echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV + echo "CYPRESS_CACHE_FOLDER=$HOME/.cache/cypress-bin" >> $GITHUB_ENV + - name: Set Playwright & Cypress path (windows) + if: runner.os == 'Windows' + run: | + echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV + echo "CYPRESS_CACHE_FOLDER=$HOME\.cache\cypress-bin" >> $env:GITHUB_ENV + + - name: Cache Cypress binaries + uses: actions/cache@v3 + with: + key: ${{ runner.os }}-cypress-bin + path: ${{ env.CYPRESS_CACHE_FOLDER }} + + - name: Cache Playwright's binary + uses: actions/cache@v3 + with: + # Playwright removes unused browsers automatically + # So does not need to add playwright version to key + key: ${{ runner.os }}-playwright-bin-v1 + path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} + - if: ${{ (contains(env.FEATURE_FLAGS, '--')) }} name: Create the sample project with feature flags run: node ./outfile.cjs sample-project ${{ env.FEATURE_FLAGS }} @@ -142,6 +170,7 @@ jobs: working-directory: ../sample-project run: pnpm build + - if: ${{ contains(matrix.flag-for-e2e, '--playwright') }} name: Install Playwright dependencies working-directory: ../sample-project From 90529295ceb0802ebc3cbc0343b846cab97cda64 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Tue, 28 Feb 2023 19:32:57 +0800 Subject: [PATCH 2/5] ci: remove the CYPRESS_INSTALL_BINARY env variable --- .github/workflows/ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55ae3469..05cf4360 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,9 +115,6 @@ jobs: - name: Build the package on cache miss if: steps.cache-restore.outputs.cache-hit != 'true' run: pnpm install && pnpm build - env: - # The main project doesn't need Cypress binaries - CYPRESS_INSTALL_BINARY: 0 # https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62 # Install playwright's binary under custom directory to cache From cf736a0e6dd97239f590441076cf7d27a88783a6 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Tue, 28 Feb 2023 19:39:22 +0800 Subject: [PATCH 3/5] ci: use no-frozen-lockfile --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05cf4360..1598b2f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -156,7 +156,7 @@ jobs: - name: Install dependencies in the sample project working-directory: ../sample-project - run: pnpm install + run: pnpm install --no-frozen-lockfile - if: ${{ contains(matrix.flag-for-vitest, '--') }} name: Run unit test script From 52a1b63ff2748bb02a7580623aa2dc271fae2329 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Tue, 28 Feb 2023 19:53:21 +0800 Subject: [PATCH 4/5] fix: force install cypress binary on cache miss --- .github/workflows/ci.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1598b2f4..0558ffea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -130,6 +130,7 @@ jobs: echo "CYPRESS_CACHE_FOLDER=$HOME\.cache\cypress-bin" >> $env:GITHUB_ENV - name: Cache Cypress binaries + id: cache-cypress uses: actions/cache@v3 with: key: ${{ runner.os }}-cypress-bin @@ -145,18 +146,17 @@ jobs: - if: ${{ (contains(env.FEATURE_FLAGS, '--')) }} name: Create the sample project with feature flags - run: node ./outfile.cjs sample-project ${{ env.FEATURE_FLAGS }} + working-directory: ../ + run: node ./create-vue/outfile.cjs sample-project ${{ env.FEATURE_FLAGS }} - if: ${{ !(contains(env.FEATURE_FLAGS, '--')) }} name: Create the sample project with default options - run: node ./outfile.cjs sample-project --default - - - name: Move the sample project to the upper-level directory - run: mv sample-project ../sample-project + working-directory: ../ + run: node ./create-vue/outfile.cjs sample-project --default - name: Install dependencies in the sample project working-directory: ../sample-project - run: pnpm install --no-frozen-lockfile + run: pnpm install - if: ${{ contains(matrix.flag-for-vitest, '--') }} name: Run unit test script @@ -167,6 +167,10 @@ jobs: working-directory: ../sample-project run: pnpm build + - name: Force download Cypress on cache miss + if: steps.cache-cypress.outputs.cache-hit != 'true' + working-directory: ../sample-project + run: pnpm exec cypress install --force - if: ${{ contains(matrix.flag-for-e2e, '--playwright') }} name: Install Playwright dependencies From 9e16cad54979d9451eb360bfa06f1d5d2e5ebd86 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Tue, 28 Feb 2023 20:03:07 +0800 Subject: [PATCH 5/5] fix: only install cypress on cypress tests --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0558ffea..a839431e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -168,7 +168,7 @@ jobs: run: pnpm build - name: Force download Cypress on cache miss - if: steps.cache-cypress.outputs.cache-hit != 'true' + if: ${{ contains(matrix.flag-for-e2e, '--cypress') && steps.cache-cypress.outputs.cache-hit != 'true'}} working-directory: ../sample-project run: pnpm exec cypress install --force pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy