| Staging | Regression Pack | #770
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: "| Staging | Regression Pack |" | |
on: | |
schedule: | |
- cron: "00 00 * * *" | |
workflow_dispatch: | |
jobs: | |
cypress-run: | |
environment: trade-tariff | |
env: | |
CYPRESS_BASE_URL: "https://staging.trade-tariff.service.gov.uk" | |
CYPRESS_ADMIN_OTP_SECRET: ${{ secrets.ADMIN_OTP_SECRET }} | |
CYPRESS_ADMIN_PASSWORD: ${{ secrets.CYPRESS_ADMIN_PASSWORD }} | |
CYPRESS_ADMIN_USERNAME: ${{ secrets.CYPRESS_ADMIN_USERNAME }} | |
CYPRESS_STAGING_ADMIN_SUFFIX: "staging" | |
CYPRESS_SPACE: "STAGING" | |
CYPRESS_STAGING_BASIC_AUTH: ${{ secrets.CYPRESS_STAGING_BASIC_AUTH }} | |
CYPRESS_STAGING_BASIC_PASSWORD: ${{ secrets.CYPRESS_STAGING_BASIC_PASSWORD }} | |
CYPRESS_STAGING_BASIC_USERNAME: ${{ secrets.CYPRESS_STAGING_BASIC_USERNAME }} | |
CYPRESS_grepTags: "-devOnly+-smokeTest+-notStaging" | |
name: "RegressionTests - Staging" | |
runs-on: ubuntu-22.04 | |
steps: | |
- run: date | |
- uses: actions/checkout@v2 | |
- uses: cypress-io/github-action@v4 | |
name: cypress | |
id: cypress | |
continue-on-error: true | |
with: | |
spec: "cypress/e2e/**/*.cy.js" | |
quiet: true | |
browser: chrome | |
headless: true | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: report | |
path: ./cypress/reports/mochawesome/ | |
- name: Checkout reports repo | |
uses: actions/checkout@v2 | |
with: | |
ref: reports | |
path: reports_repo | |
- name: Copy report into reports repo | |
run: | | |
cd reports_repo | |
DATE=$(date +%d-%m-%Y) | |
[ -e docs/staging/$DATE ] && rm -rf docs/staging/$DATE | |
cp -a ../cypress/reports/mochawesome docs/staging/$DATE | |
pushd docs/staging/$DATE | |
rm -rf assets | |
rm -rf screenshots | |
ln -s ../../assets/ | |
popd | |
git add docs . | |
- name: Commit todays report to reports branch | |
run: | | |
cd reports_repo | |
git config --local user.email "tradetarrif+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git commit -m "Staging report for $(date +%d-%m-%Y)" -a | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: reports | |
directory: reports_repo | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%d-%m-%Y')" | |
- name: Slack Notification | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_CHANNEL: "tariffs-regression" | |
SLACK_USERNAME: "Staging Regression" | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_ICON_EMOJI: ":alphabet-yellow-s:" | |
SLACK_COLOR: ${{ steps.cypress.outcome }} | |
SLACK_TITLE: Cypress finished with - ${{ steps.cypress.outcome }} | |
SLACK_MESSAGE: https://trade-tariff.github.io/trade-tariff-testing/staging/${{ steps.date.outputs.date }}/ | |
- name: Set build status based on Cypress outcome | |
if: steps.cypress.outcome != 'success' | |
run: exit 1 |