forked from conjure-cp/task-allocation-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate Cypress Tests into CI Workflow with GitHub Actions
- Loading branch information
1 parent
3e6490a
commit c4c9e4d
Showing
1 changed file
with
35 additions
and
16 deletions.
There are no files selected for viewing
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
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 |