-
Notifications
You must be signed in to change notification settings - Fork 919
163 lines (153 loc) · 6.09 KB
/
integration_tests.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Workflows that run integration tests on live sites
name: Integration tests
run-name: Integration tests for ${{ inputs.branch }}
env:
SLACK_CHANNEL_ID: CBX0KH5GA # #www-notify in MoCo Slack
SLACK_BOT_TOKEN: ${{secrets.SLACK_BOT_TOKEN_FOR_MEAO_NOTIFICATIONS_APP}}
on:
workflow_dispatch:
inputs:
branch:
description: The branch of mozilla/bedrock we're testing against - main|stage|prod|run-integration-tests
required: true
git_sha:
description: The git SHA just deployed to the service we want to test
required: true
mozorg_service_hostname:
description: The root URL of the Mozorg service to run tests against
required: true
jobs:
notify-of-test-run-start:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Notify via Slack that tests are starting
uses: ./.github/actions/slack
with:
env_name: test
label: "Integration tests [${{ inputs.git_sha }}]"
status: info
channel_id: ${{ env.SLACK_CHANNEL_ID }}
slack_bot_token: ${{ env.SLACK_BOT_TOKEN }}
ref: ${{ inputs.branch }}
message: "Integration tests started"
integration-tests:
runs-on: ubuntu-latest
needs: notify-of-test-run-start
strategy:
matrix:
include:
- LABEL: test-ie-saucelabs
BROWSER_NAME: internet explorer
DRIVER: SauceLabs
MARK_EXPRESSION: "smoke or sanity"
PLATFORM: Windows 10
PYTEST_PROCESSES: 8
- LABEL: test-firefox-remote
BROWSER_NAME: firefox
MARK_EXPRESSION: "not headless and not download and not skip_if_firefox and not cdn"
DRIVER: Remote
PYTEST_PROCESSES: auto
- LABEL: test-headless
DRIVER: ""
MARK_EXPRESSION: headless
- LABEL: test-chrome-remote
BROWSER_NAME: chrome
DRIVER: Remote
MARK_EXPRESSION: "not headless and not download and not skip_if_not_firefox and not cdn"
PYTEST_PROCESSES: auto
env:
BASE_URL: ${{ github.event.inputs.mozorg_service_hostname }}
BROWSER_NAME: ${{ matrix.BROWSER_NAME }}
CI_JOB_ID: ${{ github.run_id }}
DRIVER: ${{ matrix.DRIVER }}
LABEL: ${{ matrix.LABEL }}
MARK_EXPRESSION: ${{ matrix.MARK_EXPRESSION }}
PLATFORM: ${{ matrix.PLATFORM }}
PYTEST_PROCESSES: ${{ matrix.PYTEST_PROCESSES }}
SAUCELABS_API_KEY: ${{ secrets.SAUCELABS_API_KEY }}
SAUCELABS_USERNAME: ${{ secrets.SAUCELABS_USERNAME }}
# Note we use if: always() below to keep things going, rather than
# continue-on-error, because that approach falsely marks the overall
# test suite as green/passed even if it has some failures.
steps:
- name: Fetch codebase
if: always()
uses: actions/checkout@v4
- name: Sets specific env vars IF we're on testing against dev/main only
if: ${{ github.event.inputs.branch == 'main'}}
run: |
echo "BOUNCER_URL=https://bouncer-bouncer.stage.mozaws.net/" >> $GITHUB_ENV
- name: Run functional integration tests
if: always()
run: ./bin/integration_tests/functional_tests.sh
env:
TEST_IMAGE: mozmeao/bedrock_test:${{ github.event.inputs.git_sha }}
- name: Cleanup after functional integration tests
if: always()
run: ./bin/integration_tests/cleanup_after_functional_tests.sh
- name: Store artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: results-${{github.run_id}}-${{matrix.label}}
if-no-files-found: ignore # this avoids a false "Warning" if there were no issues
playwright-tests:
if: always()
runs-on: ubuntu-latest
needs: [notify-of-test-run-start, integration-tests]
env:
PLAYWRIGHT_BASE_URL: ${{ github.event.inputs.mozorg_service_hostname }}
CI: true
CI_JOB_ID: ${{ github.run_id }}
DRIVER: ""
LABEL: playwright-tests
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: cd tests/playwright && npm ci && npm run install-deps
- name: Run Playwright tests
run: cd tests/playwright && npm run integration-tests
notify-of-test-run-completion:
if: always()
runs-on: ubuntu-latest
needs: [notify-of-test-run-start, integration-tests, playwright-tests]
steps:
- uses: actions/checkout@v4
- name: Notify via Slack of test-run success
if: ${{ needs.integration-tests.result == 'success' && needs.playwright-tests.result == 'success' }}
uses: ./.github/actions/slack
with:
env_name: test
label: "Integration tests [${{ inputs.git_sha }}]"
status: "success"
channel_id: ${{ env.SLACK_CHANNEL_ID }}
slack_bot_token: ${{ env.SLACK_BOT_TOKEN }}
ref: ${{ inputs.branch }}
message: "Integration tests completed. Status: success"
- name: Notify via Slack of test-run failure
if: ${{ needs.integration-tests.result == 'failure' || needs.playwright-tests.result == 'failure' }}
uses: ./.github/actions/slack
with:
env_name: test
label: "Integration tests [${{ inputs.git_sha }}]"
status: "failure"
channel_id: ${{ env.SLACK_CHANNEL_ID }}
slack_bot_token: ${{ env.SLACK_BOT_TOKEN }}
ref: ${{ inputs.branch }}
message: "Integration tests completed. Status: failure"
- name: Notify via Slack of test-run cancelled
if: ${{ needs.integration-tests.result == 'cancelled' || needs.playwright-tests.result == 'cancelled' }}
uses: ./.github/actions/slack
with:
env_name: test
label: "Integration tests [${{ inputs.git_sha }}]"
status: "cancelled"
channel_id: ${{ env.SLACK_CHANNEL_ID }}
slack_bot_token: ${{ env.SLACK_BOT_TOKEN }}
ref: ${{ inputs.branch }}
message: "Integration tests completed. Status: cancelled"