Skip to content

Commit ca59ce9

Browse files
committed
ci: fix the build cache and binary caches
1 parent a2cb3e9 commit ca59ce9

File tree

1 file changed

+38
-8
lines changed

1 file changed

+38
-8
lines changed

.github/workflows/ci.yml

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,21 +113,46 @@ jobs:
113113
path: outfile.cjs
114114
key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
115115
- name: Build the package on cache miss
116-
if: steps.cache.outputs.cache-hit != 'true'
116+
if: steps.cache-restore.outputs.cache-hit != 'true'
117117
run: pnpm install && pnpm build
118-
env:
119-
CYPRESS_INSTALL_BINARY: 0
118+
119+
# https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62
120+
# Install playwright's binary under custom directory to cache
121+
- name: Set Playwright & Cypress path
122+
if: runner.os != 'Windows'
123+
run: |
124+
echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV
125+
echo "CYPRESS_CACHE_FOLDER=$HOME/.cache/cypress-bin" >> $GITHUB_ENV
126+
- name: Set Playwright & Cypress path (windows)
127+
if: runner.os == 'Windows'
128+
run: |
129+
echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV
130+
echo "CYPRESS_CACHE_FOLDER=$HOME\.cache\cypress-bin" >> $env:GITHUB_ENV
131+
132+
- name: Cache Cypress binaries
133+
id: cache-cypress
134+
uses: actions/cache@v3
135+
with:
136+
key: ${{ runner.os }}-cypress-bin
137+
path: ${{ env.CYPRESS_CACHE_FOLDER }}
138+
139+
- name: Cache Playwright's binary
140+
uses: actions/cache@v3
141+
with:
142+
# Playwright removes unused browsers automatically
143+
# So does not need to add playwright version to key
144+
key: ${{ runner.os }}-playwright-bin-v1
145+
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
120146

121147
- if: ${{ (contains(env.FEATURE_FLAGS, '--')) }}
122148
name: Create the sample project with feature flags
123-
run: node ./outfile.cjs sample-project ${{ env.FEATURE_FLAGS }}
149+
working-directory: ../
150+
run: node ./create-vue/outfile.cjs sample-project ${{ env.FEATURE_FLAGS }}
124151

125152
- if: ${{ !(contains(env.FEATURE_FLAGS, '--')) }}
126153
name: Create the sample project with default options
127-
run: node ./outfile.cjs sample-project --default
128-
129-
- name: Move the sample project to the upper-level directory
130-
run: mv sample-project ../sample-project
154+
working-directory: ../
155+
run: node ./create-vue/outfile.cjs sample-project --default
131156

132157
- name: Install dependencies in the sample project
133158
working-directory: ../sample-project
@@ -142,6 +167,11 @@ jobs:
142167
working-directory: ../sample-project
143168
run: pnpm build
144169

170+
- name: Force download Cypress on cache miss
171+
if: ${{ contains(matrix.flag-for-e2e, '--cypress') && steps.cache-cypress.outputs.cache-hit != 'true'}}
172+
working-directory: ../sample-project
173+
run: pnpm exec cypress install --force
174+
145175
- if: ${{ contains(matrix.flag-for-e2e, '--playwright') }}
146176
name: Install Playwright dependencies
147177
working-directory: ../sample-project

0 commit comments

Comments
 (0)
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