Cypress Tests #353
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: Cypress Tests | |
on: | |
schedule: | |
- cron: "30 22 * * *" | |
pull_request: | |
branches: | |
- develop | |
- master | |
workflow_dispatch: | |
jobs: | |
cypress-run: | |
permissions: write-all | |
if: github.repository == 'coronasafe/care_fe' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 📥 | |
uses: actions/checkout@v3 | |
- name: Checkout care 📥 | |
uses: actions/checkout@v3 | |
with: | |
repository: coronasafe/care | |
path: care | |
- name: Run docker compose up on care 🐳 | |
run: cd care && touch .env && make docker_config_file=docker-compose.pre-built.yaml up && cd .. && sleep 60s | |
# Voluntarily kept 60 seconds delay to wait for migrations to complete. | |
- name: Run Django collectstatic and load dummy data on care 🐍 | |
run: | | |
docker exec care python manage.py load_dummy_data | |
- name: Check care is up ♻ | |
run: curl -o /dev/null -s -w "%{http_code}\n" http://localhost:9000 | |
- name: Change api proxy url 📝 | |
run: 'sed --in-place "s^target: .*,^target: \"http://localhost:9000\",^g" vite.config.ts' | |
- name: Install dependencies 📦 | |
run: npm install | |
- name: Build & Compile rescript files ⚙️ | |
run: "npm run build" | |
- name: Cypress run 🥬 | |
uses: cypress-io/github-action@v5 | |
with: | |
env: SKIP_PREFLIGHT_CHECK=true | |
install: false | |
start: "npx vite preview --host" | |
wait-on: "http://localhost:4000" | |
wait-on-timeout: 300 | |
browser: electron | |
record: true | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_OPTIONS: --max_old_space_size=4096 | |
- name: Remove cypress passed label on failure 🏷️ | |
uses: actions-ecosystem/action-remove-labels@v1 | |
if: failure() | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
labels: cypress passed | |
- name: Add cypress passed label on success 🏷️ | |
uses: actions-ecosystem/action-add-labels@v1 | |
if: success() | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
labels: cypress passed | |
- name: Remove cypress failed label on success 🏷️ | |
uses: actions-ecosystem/action-remove-labels@v1 | |
if: success() | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
labels: cypress failed | |
- name: Add cypress failed label on failure 🏷️ | |
uses: actions-ecosystem/action-add-labels@v1 | |
if: failure() | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
labels: cypress failed | |
- name: Upload cypress screenshots on failure 📸 | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: cypress/screenshots | |
# Test run video was always captured, so this action uses "always()" condition | |
- name: Upload cypress videos 📹 | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: cypress-videos | |
path: cypress/videos |