feat: cache the cypress binary separate from node modules #184
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
pack: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.head_ref }} | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 7 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16 | |
registry-url: https://npm.pkg.github.com/ | |
cache: "pnpm" | |
- run: pnpm i --frozen-lockfile | |
- run: pnpm build | |
- run: pnpm pub:dry-run | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
browser: [chrome, webkit, edge, electron, firefox] | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 6 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 7 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "16" | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Cache cypress | |
id: cache-cypress | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-cypress-binary | |
with: | |
path: ~/.cache | |
key: ${{ runner.os }}-cypress-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-cypress-${{ env.cache-name }}- | |
${{ runner.os }}-cypress- | |
${{ runner.os }}- | |
- name: Build packages | |
run: pnpm build | |
- name: Lint packages | |
run: pnpm lint | |
- name: Install playwright with webkit | |
uses: cypress-io/github-action@v4 | |
if: ${{ matrix.browser == 'webkit' }} | |
with: | |
build: pnpx playwright@1.28.0 install-deps webkit | |
runTests: false | |
- name: Run Component tests 🧪 | |
uses: cypress-io/github-action@v4 | |
with: | |
component: true | |
browser: ${{ matrix.browser }} | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: cypress/screenshots | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: cypress-videos | |
path: cypress/videos |