From: Haoqun Jiang Date: Tue, 28 Feb 2023 11:28:20 +0000 (+0800) Subject: ci: add cypress & playwright binary caches X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa2c5967f8a99201ff3c8d3fc829e62df38c72ea;p=thirdparty%2Fvuejs%2Fcreate-vue.git ci: add cypress & playwright binary caches --- 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