Skip to content

Commit 3a7cf2b

Browse files
authored
Merge branch 'main' into anca/cm-de-thomann
2 parents 3f54298 + 6caeb92 commit 3a7cf2b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+523
-95
lines changed

.github/workflows/check-beta.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ jobs:
4747
uses: ./.github/workflows/smoke.yml
4848
with:
4949
job_to_run: Smoke-MacOS
50-
secrets: inherit
50+
secrets: inherit

.github/workflows/ci-dispatch.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
name: DTE Automation Dispatch
3+
4+
run-name: CI tests kicked off by ${{ github.actor }}
5+
on:
6+
pull_request:
7+
permissions:
8+
contents: "write"
9+
10+
jobs:
11+
Select-Channels:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
channels: ${{ steps.dispatch.outputs.channels }}
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
- name: Select test channels
19+
id: dispatch
20+
run: |
21+
python3 choose_test_channel.py
22+
echo channels=$(python3 choose_test_channel.py) >> "$GITHUB_OUTPUT"
23+
24+
25+
Run-Smoke-Win:
26+
needs: Select-Channels
27+
if: contains(fromJSON(needs.Select-Channels.outputs.channels), 'smoke')
28+
uses: ./.github/workflows/smoke.yml
29+
with:
30+
job_to_run: Smoke-Windows
31+
is_pull_request: true
32+
secrets: inherit
33+
34+
Run-Smoke-Mac:
35+
needs: Select-Channels
36+
if: contains(fromJSON(needs.Select-Channels.outputs.channels), 'smoke')
37+
uses: ./.github/workflows/smoke.yml
38+
with:
39+
job_to_run: Smoke-MacOS
40+
is_pull_request: true
41+
secrets: inherit
42+
43+
Run-L10n-Win:
44+
needs: Select-Channels
45+
if: contains(fromJSON(needs.Select-Channels.outputs.channels), 'l10n')
46+
uses: ./.github/workflows/l10n.yml
47+
with:
48+
job_to_run: L10n-Windows
49+
is_pull_request: true
50+
secrets: inherit
51+
52+
Run-L10n-Mac:
53+
needs: Select-Channels
54+
if: contains(fromJSON(needs.Select-Channels.outputs.channels), 'l10n')
55+
uses: ./.github/workflows/l10n.yml
56+
with:
57+
job_to_run: L10n-MacOS
58+
is_pull_request: true
59+
secrets: inherit
60+
61+
Run-L10n-Linux:
62+
needs: Select-Channels
63+
if: contains(fromJSON(needs.Select-Channels.outputs.channels), 'l10n')
64+
uses: ./.github/workflows/l10n.yml
65+
with:
66+
job_to_run: L10n-Linux
67+
is_pull_request: true
68+
secrets: inherit

.github/workflows/l10n.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: L10N Test Execution
33

44
run-name: ${{ github.actor }} is running l10n tests
55
on:
6-
pull_request:
76
workflow_call:
87
inputs:
98
channel:
@@ -14,6 +13,10 @@ on:
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:
@@ -38,7 +41,7 @@ env:
3841

3942
jobs:
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:
4447
- name: Create app token
@@ -56,7 +59,7 @@ jobs:
5659
with:
5760
python-version: "3.11"
5861
- name: Set Environment (Scheduled Beta)
59-
if: ${{ inputs.job_to_run == 'L10N-MacOS' }}
62+
if: ${{ inputs.job_to_run == 'L10N-MacOS' && inputs.is_pull_request == false }}
6063
run: |
6164
echo "TESTRAIL_REPORT='true'" >> "$GITHUB_ENV";
6265
echo "Running report for most recent Beta on MacOS";
@@ -123,7 +126,7 @@ jobs:
123126
name: artifacts-mac
124127
path: artifacts-mac
125128
L10N-Linux:
126-
if: ${{ inputs.job_to_run == 'L10N-Linux' || github.event_name == 'pull_request' || inputs.linux_tarball_link }}
129+
if: ${{ inputs.job_to_run == 'L10N-Linux' || inputs.linux_tarball_link }}
127130
runs-on: ubuntu-latest
128131
steps:
129132
- name: Create app token
@@ -141,7 +144,7 @@ jobs:
141144
with:
142145
python-version: "3.11"
143146
- name: Set Environment (Scheduled Beta)
144-
if: ${{ inputs.job_to_run == 'L10N-Linux' }}
147+
if: ${{ inputs.job_to_run == 'L10N-Linux' && inputs.is_pull_request == false }}
145148
run: |
146149
echo "TESTRAIL_REPORT='true'" >> "$GITHUB_ENV";
147150
echo "Running report for most recent Beta on Linux";
@@ -200,13 +203,13 @@ jobs:
200203
fi
201204
exit $SCRIPT_EXIT_CODE;
202205
- name: Upload artifacts
203-
if: ${{ always() && github.event_name == 'pull_request' }}
206+
if: ${{ always() && inputs.is_pull_request == true }}
204207
uses: actions/upload-artifact@v4
205208
with:
206209
name: artifacts-linux
207210
path: artifacts-linux
208211
L10N-Windows:
209-
if: ${{ inputs.job_to_run == 'L10N-Windows' || github.event_name == 'pull_request' || inputs.win_installer_link }}
212+
if: ${{ inputs.job_to_run == 'L10N-Windows' || inputs.win_installer_link }}
210213
runs-on: windows-latest
211214
steps:
212215
- name: Create app token
@@ -232,7 +235,7 @@ jobs:
232235
New-item -Name .env -Value $env_contents -ItemType File -Force
233236
Write-Host "Running l10n tests on supplied executable"
234237
- name: Set Environment (Scheduled Beta)
235-
if: ${{ inputs.job_to_run == 'L10N-Windows' }}
238+
if: ${{ inputs.job_to_run == 'L10N-Windows' && inputs.is_pull_request == false}}
236239
run: |
237240
$env_contents = @"
238241
TESTRAIL_REPORT='true'
@@ -340,7 +343,7 @@ jobs:
340343
}
341344
exit $env:SCRIPT_EXIT_CODE
342345
- name: Upload artifacts
343-
if: ${{ always() && github.event_name == 'pull_request' }}
346+
if: ${{ always() && inputs.is_pull_request == true }}
344347
uses: actions/upload-artifact@v4
345348
with:
346349
name: artifacts-win
@@ -367,17 +370,17 @@ jobs:
367370
- name: Download Windows artifact
368371
uses: actions/download-artifact@v4
369372
with:
370-
name: artifacts-win
373+
name: artifacts-win-l10n
371374
path: artifacts-win
372375
- name: Download Linux artifact
373376
uses: actions/download-artifact@v4
374377
with:
375-
name: artifacts-linux
378+
name: artifacts-linux-l10n
376379
path: artifacts-linux
377380
- name: Download MacOS artifact
378381
uses: actions/download-artifact@v4
379382
with:
380-
name: artifacts-mac
383+
name: artifacts-mac-l10n
381384
path: artifacts-mac
382385
- name: List downloaded Windows files
383386
run: ls artifacts-win/

.github/workflows/smoke.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: Smoke Test Execution
33

44
run-name: ${{ github.actor }} is running smoke tests
55
on:
6-
pull_request:
76
workflow_call:
87
inputs:
98
channel:
@@ -14,6 +13,10 @@ on:
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:
@@ -37,7 +40,7 @@ env:
3740

3841
jobs:
3942
Smoke-Windows:
40-
if: ${{ inputs.job_to_run == 'Smoke-Windows' || github.event_name == 'pull_request' || inputs.win_installer_link }}
43+
if: ${{ inputs.job_to_run == 'Smoke-Windows' || inputs.win_installer_link }}
4144
runs-on: windows-latest
4245
steps:
4346
- name: Create app token
@@ -63,7 +66,7 @@ jobs:
6366
New-item -Name .env -Value $env_contents -ItemType File -Force
6467
Write-Host "Running smoke tests on supplied executable"
6568
- name: Set Environment (Scheduled Beta)
66-
if: ${{ inputs.job_to_run == 'Smoke-Windows' }}
69+
if: ${{ inputs.job_to_run == 'Smoke-Windows' && inputs.is_pull_request == false}}
6770
run: |
6871
$env_contents = @"
6972
TESTRAIL_REPORT='true'
@@ -112,7 +115,7 @@ jobs:
112115
$env:FX_EXECUTABLE = "C:\Program Files\Custom Firefox\firefox.exe"
113116
Start-Process -FilePath $env:FX_EXECUTABLE -ArgumentList "--version" -Wait -NoNewWindow
114117
pipenv run python choose_ci_set.py
115-
pipenv run pytest -n 4 $(cat selected_tests)
118+
pipenv run pytest $(cat selected_tests)
116119
$env:TEST_EXIT_CODE = $LASTEXITCODE
117120
mv artifacts artifacts-win || true
118121
exit $env:TEST_EXIT_CODE
@@ -143,10 +146,10 @@ jobs:
143146
if: ${{ always() && github.event_name == 'pull_request' }}
144147
uses: actions/upload-artifact@v4
145148
with:
146-
name: artifacts-win
149+
name: artifacts-win-smoke
147150
path: artifacts-win
148151
Smoke-MacOS:
149-
if: ${{ inputs.job_to_run == 'Smoke-MacOS' || github.event_name == 'pull_request' || inputs.mac_installer_link }}
152+
if: ${{ inputs.job_to_run == 'Smoke-MacOS' || inputs.mac_installer_link }}
150153
runs-on: macos-latest
151154
steps:
152155
- name: Create app token
@@ -169,7 +172,7 @@ jobs:
169172
exit $?
170173
echo "Triggered by event: ${{ github.event_name }}"
171174
- name: Set Environment (Scheduled Beta)
172-
if: ${{ inputs.job_to_run == 'Smoke-MacOS' }}
175+
if: ${{ inputs.job_to_run == 'Smoke-MacOS' && inputs.is_pull_request == false}}
173176
run: |
174177
echo "TESTRAIL_REPORT='true'" >> "$GITHUB_ENV";
175178
echo "Running report for most recent Beta on MacOS";
@@ -199,7 +202,7 @@ jobs:
199202
run: |
200203
"$FX_EXECUTABLE" --version
201204
pipenv run python choose_ci_set.py
202-
pipenv run pytest --fx-executable="$FX_EXECUTABLE" -n 4 $(cat selected_tests) || TEST_EXIT_CODE=$?
205+
pipenv run pytest --fx-executable="$FX_EXECUTABLE" $(cat selected_tests) || TEST_EXIT_CODE=$?
203206
mv artifacts artifacts-mac || true
204207
exit $TEST_EXIT_CODE
205208
- name: Run Smoke Tests in MacOS (Headed)
@@ -217,7 +220,7 @@ jobs:
217220
if: ${{ always() && github.event_name == 'pull_request' }}
218221
uses: actions/upload-artifact@v4
219222
with:
220-
name: artifacts-mac
223+
name: artifacts-mac-smoke
221224
path: artifacts-mac
222225
Smoke-Linux:
223226
if: ${{ inputs.linux_tarball_link }}
@@ -268,7 +271,7 @@ jobs:
268271
"$FX_EXECUTABLE" --version;
269272
pipenv run python choose_ci_set.py;
270273
Xvfb :99 -screen 0 '1600x1200x24' > artifacts/xvfb.log &
271-
DISPLAY=:99 pipenv run pytest --fx-executable="$FX_EXECUTABLE" -n 4 $(cat selected_tests) || TEST_EXIT_CODE=$?
274+
DISPLAY=:99 pipenv run pytest --fx-executable="$FX_EXECUTABLE" $(cat selected_tests) || TEST_EXIT_CODE=$?
272275
exit $TEST_EXIT_CODE
273276
- name: Run Smoke Tests in Ubuntu (Headed)
274277
if: steps.setup.conclusion == 'success' && always()

choose_l10n_ci_set.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,18 @@ def process_changed_file(f, selected_mappings):
5353
selected_mappings: the selected mappings dictionary (updated in place).
5454
"""
5555
split = f.split(SLASH)
56-
if f.startswith("l10n_CM/sites/") or f.startswith("l10n_CM/constants/"):
56+
57+
if f.startswith(os.path.join("l10n_CM", "sites")) or f.startswith(
58+
os.path.join("l10n_CM", "constants")
59+
):
5760
# if constants or sites are changed, add a single site/region mapping entry.
5861
site = split[2]
5962
region = split[3]
6063
region_path = os.path.join("l10n_CM", "region", f"{region}.json")
6164
# make sure the region mapping file exists before adding the mapping
6265
if os.path.exists(region_path):
6366
selected_mappings[site].add(region)
64-
elif f.startswith("l10n_CM/region/"):
67+
elif f.startswith(os.path.join("l10n_CM", "region")):
6568
# if a region file is changed, add the region to each site mapping.
6669
region = split[-1].split(".")[0]
6770
with open(f, "r+") as f:
@@ -81,6 +84,7 @@ def process_changed_file(f, selected_mappings):
8184
with open(OUTPUT_FILE, "w") as file:
8285
pass # File is created or cleared
8386
l10n_mappings = valid_l10n_mappings()
87+
sample_mappings = {k: v for k, v in l10n_mappings.items() if k.startswith("demo")}
8488
if os.environ.get("TESTRAIL_REPORT") or os.environ.get("MANUAL"):
8589
# Run all tests if this is a scheduled beta or a manual run
8690
add_selected_mappings(l10n_mappings)
@@ -127,24 +131,22 @@ def process_changed_file(f, selected_mappings):
127131
)
128132
main_conftest = "conftest.py"
129133
base_page = os.path.join("modules", "page_base.py")
130-
134+
selected_mappings = defaultdict(set)
131135
if main_conftest in committed_files or base_page in committed_files:
132-
# Run all the tests for all mappings if main conftest or basepage changed
133-
add_selected_mappings(l10n_mappings)
134-
sys.exit(0)
136+
# Run sample tests for all mappings if main conftest or basepage changed
137+
selected_mappings |= sample_mappings
135138

136-
# Run all the tests for all mappings if any core l10n model, component, conftest, or tests are changed.
137-
selected_mappings = defaultdict(set)
139+
# Run sample tests for all mappings if any core l10n model, component, conftest, or tests are changed.
138140
for f in committed_files:
139-
for re_val in re_set_all:
140-
if re_val.match(f):
141-
add_selected_mappings(l10n_mappings)
142-
sys.exit(0)
143141
# check if constants, sites or region directory files were changed or added.
144142
# if so, add the site/region mappings.
145143
for re_val in re_set_select:
146144
if re_val.match(f):
147145
process_changed_file(f, selected_mappings)
146+
for re_val in re_set_all:
147+
if re_val.match(f):
148+
selected_mappings |= sample_mappings
149+
break
148150

149151
add_selected_mappings(selected_mappings)
150152
sys.exit(0)

0 commit comments

Comments
 (0)