This repository has been archived by the owner on Sep 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 185
97 lines (86 loc) · 4.45 KB
/
smoketests-eu.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Smoke Tests EU
permissions:
actions: write
checks: write
contents: write
deployments: write
pull-requests: write
statuses: write
on:
workflow_run:
workflows: ['Generate EU preview link']
types:
- completed
jobs:
cypress-run:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3, 4, 5]
steps:
- name: Download artifact
id: download-artifact
uses: actions/download-artifact@7a1cd3216ca9260cd8022db641d960b1db4d1be4
with:
run-id: ${{ github.event.workflow_run.id }}
name: 'pr-${{ github.event.workflow_run.id }}'
path: pr
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Retrieve pull request
id: pr_information
run: |
echo "issue_number=$(cat ./pr/NR)" >> $GITHUB_OUTPUT
echo "preview_url=$(cat ./pr/PREVIEW_URL)" >> $GITHUB_OUTPUT
echo "branch_name=$(cat ./pr/BRANCHNAME)" >> $GITHUB_OUTPUT
echo "user_name=$(cat ./pr/USERNAME)" >> $GITHUB_OUTPUT
echo "draft=$(cat ./pr/DRAFT)" >> $GITHUB_OUTPUT
- name: pr_info_debug 🔍
run: |
echo "PR Draft value ={{ $steps.pr_information.outputs.draft }}--"
- name: Checkout external repository with Cypress tests
uses: actions/checkout@v4
with:
repository: deriv-com/e2e-deriv-com
- name: Cypress run
# Uses the official Cypress GitHub action https://github.com/cypress-io/github-action
if: "contains(steps.pr_information.outputs.draft, 'false')"
uses: cypress-io/github-action@97d526c9027e1b1eedde4f37196aebe8834005ef
with:
# Records to Cypress Cloud
# https://docs.cypress.io/guides/cloud/projects#Set-up-a-project-to-record
record: true
parallel: true # Runs test in parallel using settings above
spec: cypress/e2e/smoke/*.js
group: 'Smoke Tests'
env:
# For recording and parallelization to work you must set your CYPRESS_RECORD_KEY
# in GitHub repo → Settings → Secrets → Actions
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# Creating a token https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
# Set Base Url from client_payload.
CYPRESS_BASE_URL: ${{ steps.pr_information.outputs.preview_url }}
# Send PR details to Cypress test run
COMMIT_INFO_MESSAGE: PR "${{ steps.pr_information.outputs.issue_number }}" Changed By "${{ steps.pr_information.outputs.user_name }}" in Branch "${{ steps.pr_information.outputs.branch_name }}"
GREP_TAGS: '@eu-tests'
BASE_URL: ${{ steps.pr_information.outputs.preview_url }}
- name: Set comments message
id: set_msg
if: always() && contains(steps.pr_information.outputs.draft, 'false')
run: |
# Using shell script to conditionally set the message
if [[ "${{ job.status }}" == "success" ]]; then
echo "msg=:rocket: Smoke test run EU (${{ matrix.containers }}) passed successfully!" >> $GITHUB_OUTPUT
else
echo "msg=:x: Smoke test run EU (${{ matrix.containers }}) failed. See logs for details: [Visit Action](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}})" >> $GITHUB_OUTPUT
fi
- name: Leave comment
if: always() && contains(steps.pr_information.outputs.draft, 'false')
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31
with:
header: Smoke tests status update
number: ${{ steps.pr_information.outputs.issue_number }}
message: '${{ steps.set_msg.outputs.msg }}'
recreate: true