@@ -113,11 +113,39 @@ jobs:
113
113
path :outfile.cjs
114
114
key :${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
115
115
-name :Build the package on cache miss
116
- if :steps.cache.outputs.cache-hit != 'true'
116
+ if :steps.cache-restore .outputs.cache-hit != 'true'
117
117
run :pnpm install && pnpm build
118
118
env :
119
+ # The main project doesn't need Cypress binaries
119
120
CYPRESS_INSTALL_BINARY :0
120
121
122
+ # https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62
123
+ # Install playwright's binary under custom directory to cache
124
+ -name :Set Playwright & Cypress path
125
+ if :runner.os != 'Windows'
126
+ run :|
127
+ echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV
128
+ echo "CYPRESS_CACHE_FOLDER=$HOME/.cache/cypress-bin" >> $GITHUB_ENV
129
+ -name :Set Playwright & Cypress path (windows)
130
+ if :runner.os == 'Windows'
131
+ run :|
132
+ echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV
133
+ echo "CYPRESS_CACHE_FOLDER=$HOME\.cache\cypress-bin" >> $env:GITHUB_ENV
134
+
135
+ -name :Cache Cypress binaries
136
+ uses :actions/cache@v3
137
+ with :
138
+ key :${{ runner.os }}-cypress-bin
139
+ path :${{ env.CYPRESS_CACHE_FOLDER }}
140
+
141
+ -name :Cache Playwright's binary
142
+ uses :actions/cache@v3
143
+ with :
144
+ # Playwright removes unused browsers automatically
145
+ # So does not need to add playwright version to key
146
+ key :${{ runner.os }}-playwright-bin-v1
147
+ path :${{ env.PLAYWRIGHT_BROWSERS_PATH }}
148
+
121
149
-if :${{ (contains(env.FEATURE_FLAGS, '--')) }}
122
150
name :Create the sample project with feature flags
123
151
run :node ./outfile.cjs sample-project ${{ env.FEATURE_FLAGS }}
@@ -142,6 +170,7 @@ jobs:
142
170
working-directory :../sample-project
143
171
run :pnpm build
144
172
173
+
145
174
-if :${{ contains(matrix.flag-for-e2e, '--playwright') }}
146
175
name :Install Playwright dependencies
147
176
working-directory :../sample-project