Skip to content

Md 2277

Md 2277 #1366

Workflow file for this run

name: (M) Cypress Tests
on:
pull_request:
workflow_dispatch:
inputs:
database:
description: 'Recent database dump to use (leave blank to use artifact)'
sites:
description: 'Specify which sites to test or leave the default to run all tests.'
default: 'asp'
required: true
prnum:
description: 'Pull request number — adds a comment to a pull request (nomally empty)'
permissions:
contents: write
actions: read
pull-requests: write
jobs:
asp:
name: Run cypress tests in 'accessmatch' directory
uses: necyberteam/reusable_actions/.github/workflows/cypress.yml@v3
if: contains(github.event.inputs.sites, 'asp') || github.event_name == 'pull_request'
secrets:
slack_token: ${{ secrets.SLACK_TOKEN }}
site: "accessmatch"
database: ${{ github.event.inputs.database }}
prnum: ${{ github.event.inputs.prnum }}
gh_token: ${{ secrets.GH_TOKEN_REPO }}
LANDO_ENV: ${{ secrets.LANDO_ENV }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
REPO: "${{ github.server_url }}/${{ github.repository }}"
ccmnet:
name: Run cypress tests in 'ccmnet' directory
uses: necyberteam/reusable_actions/.github/workflows/cypress.yml@v3
if: contains(github.event.inputs.sites, 'ccmnet') || github.event_name == 'pull_request'
secrets:
slack_token: ${{ secrets.SLACK_TOKEN }}
site: "ccmnet"
database: ${{ github.event.inputs.database }}
prnum: ${{ github.event.inputs.prnum }}
gh_token: ${{ secrets.GH_TOKEN_REPO }}
LANDO_ENV: ${{ secrets.LANDO_ENV }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
REPO: "${{ github.server_url }}/${{ github.repository }}"
# success:
# name: Actions to run on success
# needs: [asp]
# if: ${{ success() || ( always() && ! cancelled() && ! failure() ) }}
# runs-on: ubuntu-latest
# steps:
# - name: Comment on pull request
# if: "${{ env.prnum != '' }}"
# run: |
# gh pr comment $prnum -R $REPO --body "🤖 -=-=-=- Cypress Test was Successful -=-=-=- 🤖"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# prnum: ${{ github.event.inputs.prnum }}
# REPO: "${{ github.server_url }}/${{ github.repository }}"
# - name: Slack Notification Success
# uses: rtCamp/action-slack-notify@v2
# env:
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
# SLACK_MESSAGE: '🤖 -=-=-=- Cypress Test Succeeded -=-=-=- 🤖'
# SLACK_TITLE: "Cypress tests passed"
# SLACK_CHANNEL: cypress-git-notifications
fail:
name: Actions to run on fail
needs: [asp, ccmnet]
if: ${{ failure() }}
runs-on: ubuntu-latest
steps:
- name: Comment on pull request
if: "${{ env.prnum != '' }}"
run: |
gh pr comment $prnum -R $REPO --body "🤖 -=-=-=- Cypress Test has failed 😩 -=-=-=- 🤖"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
prnum: ${{ github.event.inputs.prnum }}
REPO: "${{ github.server_url }}/${{ github.repository }}"
- name: Slack Notification Success
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_MESSAGE: '🤖 -=-=-=- Cypress Test Failed -=-=-=- 🤖'
SLACK_TITLE: "Cypress tests failed"
SLACK_CHANNEL: cypress-git-notifications