Skip to content

Commit

Permalink
ci: install Cypress binary when cache does not exit
Browse files Browse the repository at this point in the history
and correctly cache it
  • Loading branch information
yusufkandemir committed Mar 12, 2024
1 parent 4b8d89b commit b11ff63
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/tests-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,27 @@ jobs:
node-version: 20
cache: 'pnpm'

- name: Install dependencies
run: pnpm i

# We have to cache Cypress binary as well (https://on.cypress.io/not-installed-ci-error)
- name: Get Cypress version
id: cypress-version
working-directory: ui
run: |
# Can't use pnpm why, pnpm list, etc. as we haven't installed the dependencies yet
echo "CYPRESS_VERSION=$(pnpm cat-index cypress | jq -r '.version')" > $GITHUB_OUTPUT
echo "CYPRESS_VERSION=$(pnpm why cypress --depth 0 --json | jq -r '.[0].devDependencies.cypress.version')" > $GITHUB_OUTPUT
- name: Cache Cypress binary
id: cypress-cache
uses: actions/cache@v4
with:
# https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation
path: ~/.cache/Cypress
key: cypress-cache-${{ steps.cypress-version.outputs.CYPRESS_VERSION }}
restore-keys: |
cypress-cache-
- name: Install dependencies
run: pnpm i
- name: Install Cypress
if: steps.cypress-cache.outputs.cache-hit != 'true'
run: pnpm cypress install

- name: Download UI build artifact
uses: actions/download-artifact@v4
Expand Down

0 comments on commit b11ff63

Please sign in to comment.