-
Notifications
You must be signed in to change notification settings - Fork 11
252 lines (249 loc) · 9.46 KB
/
smoke.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
---
name: Mac and Windows Smoke
run-name: ${{ github.actor }} is running smoke tests
on:
pull_request:
workflow_call:
inputs:
job_to_run:
required: true
type: string
beta-version:
required: true
type: string
permissions:
contents: 'write'
env:
TESTRAIL_BASE_URL: ${{ secrets.TESTRAIL_BASE_URL }}
TESTRAIL_API_KEY: ${{ secrets.TESTRAIL_API_KEY }}
TESTRAIL_USERNAME: ${{ secrets.TESTRAIL_USERNAME }}
SVC_ACCT_DECRYPT: ${{ secrets.SVC_ACCT_DECRYPT }}
jobs:
Smoke-Windows:
if: ${{ inputs.job_to_run == 'Smoke-Windows' || github.event_name == 'pull_request'}}
runs-on: windows-latest
steps:
- name: Create app token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.BOT_CLIENT_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Set Environment
if: ${{ inputs.job_to_run == 'Smoke-Windows' }}
run: |
$env_contents = @"
TESTRAIL_REPORT='true'
BETA_VERSION=${{ inputs.beta-version }}
"@
New-item -Name .env -Value $env_contents -ItemType File -Force
Write-Host "Running report for most recent Beta on Windows"
Write-Host "$env:TESTRAIL_USERNAME"
- name: Install dependencies
run: |
mkdir -p artifacts;
pip3 install 'pipenv==2023.11.15';
pip3 install 'ruff>=0.4.8,<0.5';
rm ./pyproject.toml;
mv ./ci_pyproject.toml ./pyproject.toml;
pipenv install;
- name: Download Geckodriver
run: |
$gecko_url = (pipenv run python collect_executables.py -g) -join "`n"
echo $gecko_url
Invoke-WebRequest -Uri $gecko_url -OutFile "geckodriver.zip"
unzip geckodriver.zip
shell: pwsh
- name: Download Beta
run: |
$fx_url = (pipenv run python collect_executables.py) -join "`n"
echo $fx_url
Invoke-WebRequest -Uri $fx_url -OutFile "${{ github.workspace }}\setup.exe"
New-Item -ItemType Directory -Path "C:\Program Files\Custom Firefox" -Force
shell: pwsh
- name: Install Beta
id: setup
run: |
Start-Process -FilePath "${{ github.workspace }}\setup.exe" -ArgumentList "/S", '/D=C:\Program Files\Custom Firefox' -Wait -NoNewWindow -PassThru
shell: pwsh
- name: Run Smoke Tests in Win
if: steps.setup.conclusion == 'success'
env:
TESTRAIL_BASE_URL: ${{ secrets.TESTRAIL_BASE_URL }}
TESTRAIL_API_KEY: ${{ secrets.TESTRAIL_API_KEY }}
TESTRAIL_USERNAME: ${{ secrets.TESTRAIL_USERNAME }}
run: |
pipenv run python -c "import sys; print(sys.platform)"
$env:FX_EXECUTABLE = "C:\Program Files\Custom Firefox\firefox.exe"
Start-Process -FilePath $env:FX_EXECUTABLE -ArgumentList "--version" -Wait -NoNewWindow
pipenv run pytest -n 4 $(python choose_ci_set.py)
$env:TEST_EXIT_CODE = $LASTEXITCODE
mv artifacts artifacts-win || true
exit $env:TEST_EXIT_CODE
- name: Commit Changed Tracker Files
if: ${{ inputs.job_to_run == 'Smoke-Windows' }}
run: |
git pull
git config --global user.email ${{ github.actor }}@users.noreply.github.com;
git config --global user.name ${{ github.actor }};
git add win-latest-reported-version;
git commit -m "update windows reported version";
git push
- name: Run Smoke Tests in Win (Headed)
if: steps.setup.conclusion == 'success' && always()
env:
TESTRAIL_BASE_URL: ${{ secrets.TESTRAIL_BASE_URL }}
TESTRAIL_API_KEY: ${{ secrets.TESTRAIL_API_KEY }}
TESTRAIL_USERNAME: ${{ secrets.TESTRAIL_USERNAME }}
REPORTABLE: true
run: |
rm ./pyproject.toml;
mv ./ci_pyproject_headed.toml ./pyproject.toml;
$env:FX_EXECUTABLE = "C:\Program Files\Custom Firefox\firefox.exe"
pipenv run pytest $(python choose_ci_set.py)
$env:TEST_EXIT_CODE = $LASTEXITCODE
rm artifacts/assets -r -Force
Get-ChildItem -Path "artifacts" | ForEach-Object {
$destPath = "artifacts-win\" + $_.Name
if (-not (Test-Path -Path $destPath)) {
try {
Move-Item -Path $_.FullName -Destination $destPath
} catch {
# Ignore errors and continue
}
}
}
exit $env:TEST_EXIT_CODE
- name: Upload artifacts
if: ${{ always() && github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v4
with:
name: artifacts-win
path: artifacts-win
Smoke-MacOS:
if: ${{ inputs.job_to_run == 'Smoke-MacOS' || github.event_name == 'pull_request'}}
runs-on: macos-latest
steps:
- name: Create app token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.BOT_CLIENT_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Check test case numbers
run: |
python check_test_cases.py
exit $?
- name: Set Environment
if: ${{ inputs.job_to_run == 'Smoke-MacOS' }}
run:
echo "TESTRAIL_REPORT='true'" >> "$GITHUB_ENV";
echo "BETA_VERSION=${{ inputs.beta-version }}" >> "$GITHUB_ENV";
echo "Running report for most recent Beta on MacOS";
- name: Install dependencies
id: setup
run: |
mkdir -p artifacts;
pip3 install 'pipenv==2023.11.15';
pip3 install 'ruff>=0.4.8,<0.5';
rm ./pyproject.toml;
mv ./ci_pyproject.toml ./pyproject.toml;
pipenv install;
bash ./collect_executables.sh;
- name: Run Smoke Tests in MacOS
if: steps.setup.conclusion == 'success'
env:
TESTRAIL_BASE_URL: ${{ secrets.TESTRAIL_BASE_URL }}
TESTRAIL_API_KEY: ${{ secrets.TESTRAIL_API_KEY }}
TESTRAIL_USERNAME: ${{ secrets.TESTRAIL_USERNAME }}
FX_EXECUTABLE: /Volumes/Firefox/Firefox.app/Contents/MacOS/firefox
run: |
/Volumes/Firefox/Firefox.app/Contents/MacOS/firefox --version
pipenv run pytest --fx-executable="$FX_EXECUTABLE" -n 4 $(python choose_ci_set.py) || TEST_EXIT_CODE=$?
mv artifacts artifacts-mac || true
exit $TEST_EXIT_CODE
- name: Commit Changed Tracker Files
if: ${{ inputs.job_to_run == 'Smoke-MacOS' }}
run: |
git pull
git config --global user.email ${{ github.actor }}@users.noreply.github.com;
git config --global user.name ${{ github.actor }};
git add mac-latest-reported-version;
git commit -m "update macos reported version";
git push
- name: Run Smoke Tests in MacOS (Headed)
if: steps.setup.conclusion == 'success' && always()
env:
TESTRAIL_BASE_URL: ${{ secrets.TESTRAIL_BASE_URL }}
TESTRAIL_API_KEY: ${{ secrets.TESTRAIL_API_KEY }}
TESTRAIL_USERNAME: ${{ secrets.TESTRAIL_USERNAME }}
FX_EXECUTABLE: /Volumes/Firefox/Firefox.app/Contents/MacOS/firefox
REPORTABLE: true
run: |
mv ./ci_pyproject_headed.toml ./pyproject.toml;
pipenv run pytest --fx-executable="$FX_EXECUTABLE" $(python choose_ci_set.py) || TEST_EXIT_CODE=$?
mv -n artifacts/* artifacts-mac/ || true
exit $TEST_EXIT_CODE
- name: Upload artifacts
if: ${{ always() && github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v4
with:
name: artifacts-mac
path: artifacts-mac
Use-Artifacts:
runs-on: ubuntu-latest
needs:
- Smoke-Windows
- Smoke-MacOS
if: ${{ always() && github.event_name == 'pull_request' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
pip3 install 'pipenv==2023.11.15'
pipenv install
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: artifacts-win
path: artifacts-win
- name: Download MacOS artifact
uses: actions/download-artifact@v4
with:
name: artifacts-mac
path: artifacts-mac
- name: List downloaded files
run: ls artifacts-win/
- name: List downloaded MacOS files
run: ls artifacts-mac/
- name: Run script with secret
env:
SLACK_KEY: ${{ secrets.SLACK_KEY }}
GCP_CREDENTIAL: ${{ secrets.GCP_CREDENTIAL }}
GITHUB_SHA: ${{ github.sha }}
GITHUB_RUN_ID: ${{ github.run_id }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_REF_NAME: ${{ github.ref_name }}
run: |
pipenv run python notifier.py