Cypress #184
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
# This is a basic workflow to help you get started with Actions | |
name: Cypress | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
cache: 'pip' | |
- name: Cypress install | |
uses: cypress-io/github-action@v4 | |
with: | |
runTests: false | |
- name: Install dependencies | |
run: | | |
make clean | |
make requirements | |
pip install -U -r sandbox/requirements.txt | |
- name: Prepare database | |
run: | | |
sandbox/manage.py migrate | |
sandbox/manage.py loaddata sandbox/exampledata/users.json | |
sandbox/manage.py loaddata sandbox/exampledata/cms.json | |
sandbox/manage.py loaddata sandbox/exampledata/default_tags.json | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: database | |
path: db.sqlite3 | |
run: | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
browser: | |
- chrome | |
- firefox | |
spec: | |
- cypress/e2e/admin.js | |
- cypress/e2e/cookie_bar.js | |
- cypress/e2e/cookie_consent.js | |
- cypress/e2e/home_page.js | |
- cypress/e2e/manage_page.js | |
- cypress/e2e/sandbox.js | |
- cypress/e2e/tags.js | |
- cypress/e2e/triggers.js | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
make clean | |
make requirements | |
pip install -U -r sandbox/requirements.txt | |
- uses: actions/download-artifact@v3 | |
with: | |
name: database | |
- name: Cypress run | |
uses: cypress-io/github-action@v4 | |
with: | |
install: false | |
start: make run_test_sandbox | |
wait-on: "http://localhost:8000" | |
record: false | |
browser: ${{ matrix.browser }} | |
spec: ${{ matrix.spec }} | |
env: | |
ENVIRONMENT: test | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
# Kills the sandbox | |
- name: Kill sandbox | |
run: kill $(jobs -p) || true | |
- uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: cypress/screenshots | |
- uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: cypress-videos | |
path: cypress/videos |