@@ -113,21 +113,46 @@ jobs:
113113path :outfile.cjs
114114key :${{ 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'
117117run :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, '--')) }}
122148name :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, '--')) }}
126153name :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
133158working-directory :../sample-project
@@ -142,6 +167,11 @@ jobs:
142167working-directory :../sample-project
143168run :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') }}
146176name :Install Playwright dependencies
147177working-directory :../sample-project