Skip to content

Commit 4131512

Browse files
committed
Merge main
2 parents 48eab23 + 8654b84 commit 4131512

File tree

20 files changed

+216
-41
lines changed

20 files changed

+216
-41
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: 10 additions & 7 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'
@@ -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";
@@ -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 }}

choose_l10n_ci_set.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def process_changed_file(f, selected_mappings):
8181
with open(OUTPUT_FILE, "w") as file:
8282
pass # File is created or cleared
8383
l10n_mappings = valid_l10n_mappings()
84+
sample_mappings = {k: v for k, v in l10n_mappings.items() if k.startswith("demo")}
8485
if os.environ.get("TESTRAIL_REPORT") or os.environ.get("MANUAL"):
8586
# Run all tests if this is a scheduled beta or a manual run
8687
add_selected_mappings(l10n_mappings)
@@ -129,16 +130,16 @@ def process_changed_file(f, selected_mappings):
129130
base_page = os.path.join("modules", "page_base.py")
130131

131132
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)
133+
# Run sample tests for all mappings if main conftest or basepage changed
134+
add_selected_mappings(sample_mappings)
134135
sys.exit(0)
135136

136-
# Run all the tests for all mappings if any core l10n model, component, conftest, or tests are changed.
137+
# Run sample tests for all mappings if any core l10n model, component, conftest, or tests are changed.
137138
selected_mappings = defaultdict(set)
138139
for f in committed_files:
139140
for re_val in re_set_all:
140141
if re_val.match(f):
141-
add_selected_mappings(l10n_mappings)
142+
add_selected_mappings(sample_mappings)
142143
sys.exit(0)
143144
# check if constants, sites or region directory files were changed or added.
144145
# if so, add the site/region mappings.

choose_test_channel.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import os
2+
import re
3+
import sys
4+
from subprocess import check_output
5+
6+
ALL_CHANNELS = ["smoke", "l10n"]
7+
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
8+
SLASH = "/" if "/" in SCRIPT_DIR else "\\"
9+
10+
file_subsets = {
11+
"smoke": ["modules/data", "modules/page", "modules/browser", "tests/"],
12+
"l10n": ["l10n_CM/"],
13+
}
14+
15+
l10n_module_patterns = [
16+
r"modules/page_object_prefs\.py",
17+
r"modules/data/about_prefs\.components\.json",
18+
r"modules/page_object_autofill\.py",
19+
r"modules/data/address_fill\.components\.json",
20+
r"modules/data/credit_card_fill\.components\.json",
21+
r"modules/browser_object_autofill_popup\.py",
22+
r"modules/data/autofill_popup\.components\.json",
23+
]
24+
25+
l10n_module_patterns = set(
26+
[
27+
re.compile(val.replace("/", r"\\")) if SLASH == "\\" else re.compile(val)
28+
for val in l10n_module_patterns
29+
]
30+
)
31+
32+
check_output(["git", "fetch", "--quiet", "--depth=1", "origin", "main"])
33+
34+
committed_files = (
35+
check_output(["git", "--no-pager", "diff", "--name-only", "origin/main"])
36+
.decode()
37+
.replace("/", SLASH)
38+
.splitlines()
39+
)
40+
main_conftest = "conftest.py"
41+
base_page = os.path.join("modules", "page_base.py")
42+
43+
channels = []
44+
45+
if main_conftest in committed_files or base_page in committed_files:
46+
print(ALL_CHANNELS)
47+
sys.exit()
48+
49+
for f in committed_files:
50+
if any([r.match(f) for r in l10n_module_patterns]):
51+
print(ALL_CHANNELS)
52+
sys.exit()
53+
54+
for test_channel in file_subsets:
55+
for subset in file_subsets[test_channel]:
56+
if subset in f and test_channel not in channels:
57+
channels.append(test_channel)
58+
59+
if not channels:
60+
channels = ["smoke"]
61+
print(channels)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"url": "http://127.0.0.1:8080/justspices_ad.html",
3+
"field_mapping": {
4+
"given_name": "e9ead99b-3303-40da-9464-467d6513ad0e",
5+
"family_name": "3b629ea8-30e4-438e-a486-86e042ff940f",
6+
"street_address": "fa1f501d-691b-4d76-8459-1b2ecb7d5f35",
7+
"address_level_2": "86049b91-6cc7-44b1-aaa4-a7d4d27b0cb5",
8+
"postal_code": "bf63d255-5cdc-4b18-a8a5-5426ca1908ad",
9+
"telephone": "92f0f12c-1193-4430-9ca3-363cfbaadcd1",
10+
"country": "d575c937-5b58-43e2-b9de-d638f6327002"
11+
},
12+
"form_field": "*[data-moz-autofill-inspect-id='{given_name}']",
13+
"fields": [
14+
"e9ead99b-3303-40da-9464-467d6513ad0e",
15+
"3b629ea8-30e4-438e-a486-86e042ff940f",
16+
"fa1f501d-691b-4d76-8459-1b2ecb7d5f35",
17+
"86049b91-6cc7-44b1-aaa4-a7d4d27b0cb5",
18+
"bf63d255-5cdc-4b18-a8a5-5426ca1908ad",
19+
"92f0f12c-1193-4430-9ca3-363cfbaadcd1",
20+
"d575c937-5b58-43e2-b9de-d638f6327002"
21+
]
22+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"url": "http://127.0.0.1:8080/justspices_cc.html",
3+
"field_mapping": {
4+
"name": "79c20d90-38f6-4b37-a523-9451488f43a6",
5+
"card_number": "3db1e745-4e9d-4571-a607-276feb1099fd",
6+
"expiration_date": "93bddbeb-cc5c-4708-93ea-fbe0864fe3cd",
7+
"cvv": "5cb55c7b-747e-4ae4-a303-b5dfc119c499"
8+
},
9+
"form_field": "*[data-moz-autofill-inspect-id='{name}']",
10+
"skip": "True",
11+
"fields": [
12+
"79c20d90-38f6-4b37-a523-9451488f43a6",
13+
"3db1e745-4e9d-4571-a607-276feb1099fd",
14+
"93bddbeb-cc5c-4708-93ea-fbe0864fe3cd",
15+
"5cb55c7b-747e-4ae4-a303-b5dfc119c499"
16+
]
17+
}

l10n_CM/region/DE.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"sites": [
44
"amazon",
55
"mediamarkt",
6-
"demo"
6+
"demo",
7+
"justspices"
78
],
89
"tests": [
910
]

0 commit comments

Comments
 (0)