Skip to content

Commit

Permalink
Integrate Cypress Tests into CI Workflow with GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
YuxinZhang214 committed Dec 16, 2023
1 parent 3e6490a commit c4c9e4d
Showing 1 changed file with 35 additions and 16 deletions.
51 changes: 35 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,43 @@
name: Build test
name: Cypress Tests with Dependency and Artifact Caching

on:
workflow_dispatch: # can be triggered manually
pull_request: # and for PRs
on: push

jobs:
deploy:
runs-on: ubuntu-latest
install:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Cypress install
uses: cypress-io/github-action@v6
with:
# Disable running of tests within install job
runTests: false
build: npm run build

- name: Save out folder
uses: actions/upload-artifact@v3
with:
name: out
if-no-files-found: error
path: out

cypress-run:
runs-on: ubuntu-22.04
needs: install
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-node@v4
- name: Download the out folder
uses: actions/download-artifact@v3
with:
node-version: 21
cache: npm
name: out
path: out

- name: Build
run: |
npm ci
npm run build
# creates a .nojekyll file in the out directory to tell GitHub Pages not to treat the site as a Jekyll project.
touch out/.nojekyll
- name: Cypress run
uses: cypress-io/github-action@v6
with:
start: npm run dev
browser: chrome

0 comments on commit c4c9e4d

Please sign in to comment.