@@ -3,7 +3,6 @@ name: L10N Test Execution
33
44run-name : ${{ github.actor }} is running l10n tests
55on :
6- pull_request :
76 workflow_call :
87 inputs :
98 channel :
1413 job_to_run :
1514 required : true
1615 type : string
16+ is_pull_request :
17+ description : " Is this a PR?"
18+ default : false
19+ type : boolean
1720 workflow_dispatch :
1821 inputs :
1922 win_installer_link :
3841
3942jobs :
4043 L10N-MacOS :
41- if : ${{ inputs.job_to_run == 'L10N-MacOS' || github.event_name == 'pull_request' || inputs.mac_installer_link }}
44+ if : ${{ inputs.job_to_run == 'L10N-MacOS' || inputs.mac_installer_link }}
4245 runs-on : macos-latest
4346 steps :
44- - name : Create app token
45- uses : actions/create-github-app-token@v1
46- id : app-token
47- with :
48- app-id : ${{ secrets.BOT_CLIENT_ID }}
49- private-key : ${{ secrets.BOT_PRIVATE_KEY }}
5047 - name : Checkout repository
5148 uses : actions/checkout@v4
52- with :
53- token : ${{ steps.app-token.outputs.token }}
5449 - name : Set up Python 3.11
5550 uses : actions/setup-python@v5
5651 with :
5752 python-version : " 3.11"
5853 - name : Set Environment (Scheduled Beta)
59- if : ${{ inputs.job_to_run == 'L10N-MacOS' }}
54+ if : ${{ inputs.job_to_run == 'L10N-MacOS' && inputs.is_pull_request == false }}
6055 run : |
6156 echo "TESTRAIL_REPORT='true'" >> "$GITHUB_ENV";
6257 echo "Running report for most recent Beta on MacOS";
@@ -97,51 +92,24 @@ jobs:
9792 exit $EXIT_CODE;
9893 fi
9994 exit $SCRIPT_EXIT_CODE;
100- - name : Run L10N Tests in MacOS (Headed)
101- if : steps.setup.conclusion == 'success' && always()
102- env :
103- FX_EXECUTABLE : /Volumes/${{ steps.setup.outputs.app_name }}/${{ steps.setup.outputs.app_name }}.app/Contents/MacOS/firefox
104- REPORTABLE : ${{ env.TESTRAIL_REPORT == 'true' }}
105- run : |
106- mv ./ci_l10n_pyproject_headed.toml ./pyproject.toml;
107- echo "0" > TEST_EXIT_CODE;
108- while IFS= read -r line; do
109- echo "Running tests for: $line";
110- pipenv run python -m l10n_CM.run_l10n --fx-executable="$FX_EXECUTABLE" $line || SCRIPT_EXIT_CODE=$?;
111- done < selected_l10n_mappings;
112- ls artifacts-mac/* &>/dev/null || echo "No mappings to report" >> artifacts-mac/placeholder.txt
113- mv -n artifacts/* artifacts-mac/ || true;
114- EXIT_CODE=$(cat TEST_EXIT_CODE);
115- if [ $EXIT_CODE != 0 ]; then
116- exit $EXIT_CODE;
117- fi
118- exit $SCRIPT_EXIT_CODE;
11995 - name : Upload artifacts
12096 if : ${{ always() && github.event_name == 'pull_request' }}
12197 uses : actions/upload-artifact@v4
12298 with :
12399 name : artifacts-mac
124100 path : artifacts-mac
125101 L10N-Linux :
126- if : ${{ inputs.job_to_run == 'L10N-Linux' || github.event_name == 'pull_request' || inputs.linux_tarball_link }}
102+ if : ${{ inputs.job_to_run == 'L10N-Linux' || inputs.linux_tarball_link }}
127103 runs-on : ubuntu-latest
128104 steps :
129- - name : Create app token
130- uses : actions/create-github-app-token@v1
131- id : app-token
132- with :
133- app-id : ${{ secrets.BOT_CLIENT_ID }}
134- private-key : ${{ secrets.BOT_PRIVATE_KEY }}
135105 - name : Checkout repository
136106 uses : actions/checkout@v4
137- with :
138- token : ${{ steps.app-token.outputs.token }}
139107 - name : Set up Python 3.11
140108 uses : actions/setup-python@v5
141109 with :
142110 python-version : " 3.11"
143111 - name : Set Environment (Scheduled Beta)
144- if : ${{ inputs.job_to_run == 'L10N-Linux' }}
112+ if : ${{ inputs.job_to_run == 'L10N-Linux' && inputs.is_pull_request == false }}
145113 run : |
146114 echo "TESTRAIL_REPORT='true'" >> "$GITHUB_ENV";
147115 echo "Running report for most recent Beta on Linux";
@@ -180,45 +148,18 @@ jobs:
180148 exit $EXIT_CODE;
181149 fi
182150 exit $SCRIPT_EXIT_CODE;
183- - name : Run Smoke Tests in Ubuntu (Headed)
184- if : steps.setup.conclusion == 'success' && always()
185- env :
186- REPORTABLE : ${{ env.TESTRAIL_REPORT == 'true' }}
187- FX_EXECUTABLE : ./firefox/firefox
188- run : |
189- mv ./ci_l10n_pyproject_headed.toml ./pyproject.toml;
190- echo "0" > TEST_EXIT_CODE;
191- while IFS= read -r line; do
192- echo "Running tests for: $line";
193- DISPLAY=:99 pipenv run python -m l10n_CM.run_l10n --fx-executable="$FX_EXECUTABLE" $line || SCRIPT_EXIT_CODE=$?;
194- done < selected_l10n_mappings;
195- ls artifacts-linux/* &>/dev/null || echo "No mappings to report" >> artifacts-linux/placeholder.txt
196- mv -n artifacts/* artifacts-linux/ || true;
197- EXIT_CODE=$(cat TEST_EXIT_CODE);
198- if [ $EXIT_CODE != 0 ]; then
199- exit $EXIT_CODE;
200- fi
201- exit $SCRIPT_EXIT_CODE;
202151 - name : Upload artifacts
203- if : ${{ always() && github.event_name == 'pull_request' }}
152+ if : ${{ always() && inputs.is_pull_request == true }}
204153 uses : actions/upload-artifact@v4
205154 with :
206155 name : artifacts-linux
207156 path : artifacts-linux
208157 L10N-Windows :
209- if : ${{ inputs.job_to_run == 'L10N-Windows' || github.event_name == 'pull_request' || inputs.win_installer_link }}
158+ if : ${{ inputs.job_to_run == 'L10N-Windows' || inputs.win_installer_link }}
210159 runs-on : windows-latest
211160 steps :
212- - name : Create app token
213- uses : actions/create-github-app-token@v1
214- id : app-token
215- with :
216- app-id : ${{ secrets.BOT_CLIENT_ID }}
217- private-key : ${{ secrets.BOT_PRIVATE_KEY }}
218161 - name : Checkout repository
219162 uses : actions/checkout@v4
220- with :
221- token : ${{ steps.app-token.outputs.token }}
222163 - name : Set up Python 3.11
223164 uses : actions/setup-python@v5
224165 with :
@@ -232,7 +173,7 @@ jobs:
232173 New-item -Name .env -Value $env_contents -ItemType File -Force
233174 Write-Host "Running l10n tests on supplied executable"
234175 - name : Set Environment (Scheduled Beta)
235- if : ${{ inputs.job_to_run == 'L10N-Windows' }}
176+ if : ${{ inputs.job_to_run == 'L10N-Windows' && inputs.is_pull_request == false }}
236177 run : |
237178 $env_contents = @"
238179 TESTRAIL_REPORT='true'
@@ -298,49 +239,8 @@ jobs:
298239 exit [int]$EXIT_CODE
299240 }
300241 exit $env:SCRIPT_EXIT_CODE
301- - name : Run L10N Tests in Win (Headed)
302- if : steps.setup.conclusion == 'success' && always()
303- env :
304- REPORTABLE : ${{ env.TESTRAIL_REPORT == 'true' }}
305- run : |
306- rm ./pyproject.toml;
307- mv ./ci_l10n_pyproject_headed.toml ./pyproject.toml;
308- $env:FX_EXECUTABLE = 'C:\Program Files\Custom Firefox\firefox.exe'
309- Write-Host "FX_EXECUTABLE: $FX_EXECUTABLE"
310- pipenv run python choose_l10n_ci_set.py
311- "0" | Set-Content -Path "TEST_EXIT_CODE"
312- $SCRIPT_EXIT_CODE = 0
313- Get-Content "selected_l10n_mappings" | ForEach-Object {
314- $line = $_
315- Write-Host "Running tests for: $line"
316- try {
317- pipenv run python -m l10n_CM.run_l10n --fx-executable="$env:FX_EXECUTABLE" $line
318- } catch {
319- $SCRIPT_EXIT_CODE = $_.Exception.HResult
320- }
321- }
322- rm artifacts/assets -r -Force -ErrorAction SilentlyContinue
323- Get-ChildItem -Path "artifacts" -ErrorAction SilentlyContinue | ForEach-Object {
324- $destPath = "artifacts-win\" + $_.Name
325- if (-not (Test-Path -Path $destPath)) {
326- try {
327- Move-Item -Path $_.FullName -Destination $destPath
328- } catch {
329- # Ignore errors and continue
330- }
331- }
332- }
333- mkdir artifacts-win -Force
334- if (-not (Test-Path -Path "artifacts-win\*")) {
335- New-Item -Path "artifacts-win\placeholder.txt" -ItemType File -Value "no mappings to report."
336- }
337- $EXIT_CODE = Get-Content -Path "TEST_EXIT_CODE"
338- if ($EXIT_CODE -ne 0) {
339- exit [int]$EXIT_CODE
340- }
341- exit $env:SCRIPT_EXIT_CODE
342242 - name : Upload artifacts
343- if : ${{ always() && github.event_name == 'pull_request' }}
243+ if : ${{ always() && inputs.is_pull_request == true }}
344244 uses : actions/upload-artifact@v4
345245 with :
346246 name : artifacts-win
@@ -367,17 +267,17 @@ jobs:
367267 - name : Download Windows artifact
368268 uses : actions/download-artifact@v4
369269 with :
370- name : artifacts-win
270+ name : artifacts-win-l10n
371271 path : artifacts-win
372272 - name : Download Linux artifact
373273 uses : actions/download-artifact@v4
374274 with :
375- name : artifacts-linux
275+ name : artifacts-linux-l10n
376276 path : artifacts-linux
377277 - name : Download MacOS artifact
378278 uses : actions/download-artifact@v4
379279 with :
380- name : artifacts-mac
280+ name : artifacts-mac-l10n
381281 path : artifacts-mac
382282 - name : List downloaded Windows files
383283 run : ls artifacts-win/
0 commit comments