Skip to content

Commit b45354d

Browse files
report l10n runs only on new beta
1 parent 4fabf88 commit b45354d

File tree

2 files changed

+67
-8
lines changed

2 files changed

+67
-8
lines changed

.github/workflows/check-beta-l10n.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Check new beta version
2+
3+
on:
4+
pull_request:
5+
schedule:
6+
- cron: "40 */1 * * *"
7+
env:
8+
LATEST: ""
9+
permissions:
10+
contents: "write"
11+
12+
jobs:
13+
Check-Beta-Version:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
win_reportable: ${{ steps.reportable.outputs.win }}
17+
mac_reportable: ${{ steps.reportable.outputs.mac }}
18+
mac_l10n_reportable: ${{ steps.l10n-reportable.outputs.mac_l10n }}
19+
win_l10n_reportable: ${{ steps.l10n-reportable.outputs.win_l10n }}
20+
linux_l10n_reportable: ${{ steps.l10n-reportable.outputs.linux_l10n }}
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
- name: Check if the l10n run is reportable
25+
id: l10n-reportable
26+
env:
27+
TESTRAIL_REPORT: true
28+
FX_L10N: true
29+
TESTRAIL_BASE_URL: ${{ secrets.TESTRAIL_BASE_URL }}
30+
TESTRAIL_API_KEY: ${{ secrets.TESTRAIL_API_KEY }}
31+
TESTRAIL_USERNAME: ${{ secrets.TESTRAIL_USERNAME }}
32+
run: |
33+
pip3 install 'pipenv==2023.11.15';
34+
pipenv install
35+
echo win_l10n=$(pipenv run python -c 'from modules import testrail_integration as tri; print(tri.reportable("Windows"))') >> "$GITHUB_OUTPUT"
36+
echo mac_l10n=$(pipenv run python -c 'from modules import testrail_integration as tri; print(tri.reportable("Darwin"))') >> "$GITHUB_OUTPUT"
37+
echo linux_l10n=$(pipenv run python -c 'from modules import testrail_integration as tri; print(tri.reportable("Linux"))') >> "$GITHUB_OUTPUT"
38+
39+
Run-L10N-Mac-Smoke:
40+
needs: Check-Beta-Version
41+
if: ${{ needs.Check-Beta-Version.outputs.mac_l10n_reportable == 'True' }}
42+
uses: ./.github/workflows/l10n.yml
43+
with:
44+
job_to_run: L10N-MacOS
45+
secrets: inherit
46+
47+
Run-L10N-Win-Smoke:
48+
needs: Check-Beta-Version
49+
if: ${{ needs.Check-Beta-Version.outputs.win_l10n_reportable == 'True' }}
50+
uses: ./.github/workflows/l10n.yml
51+
with:
52+
job_to_run: L10N-Windows
53+
secrets: inherit
54+
55+
Run-L10N-Linux-Smoke:
56+
needs: Check-Beta-Version
57+
if: ${{ needs.Check-Beta-Version.outputs.linux_l10n_reportable == 'True' }}
58+
uses: ./.github/workflows/l10n.yml
59+
with:
60+
job_to_run: L10N-Linux
61+
secrets: inherit

modules/testrail_integration.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,27 +157,25 @@ def reportable(platform_to_test=None):
157157
plan_entries = this_plan.get("entries")
158158
if os.environ.get("FX_L10N"):
159159
l10n_mappings = valid_l10n_mappings()
160-
covered_suites = 0
160+
covered_mappings = 0
161+
# keeping this logic to still see how many mappings are reported.
161162
for entry in plan_entries:
162163
if entry.get("name") in l10n_mappings:
163164
site = entry.get("name")
164165
for run_ in entry.get("runs"):
165166
if run_.get("config"):
166167
run_region, run_platform = run_.get("config").split("-")
167-
covered_suites += (
168+
covered_mappings += (
168169
1
169170
if run_region in l10n_mappings[site]
170171
and platform in run_platform
171172
else 0
172173
)
173-
num_suites = 0
174-
for site, regions in l10n_mappings.items():
175-
# each region for win and mac (linux not yet added)
176-
num_suites += len(regions)
177174
logging.warning(
178-
f"Potentially matching run found for {platform}, may be reportable. ({covered_suites} out of {num_suites} site/region mappings already reported.)"
175+
f"Potentially matching run found for {platform}, may be reportable. (Found {covered_mappings} site/region mappings reported.)"
179176
)
180-
return covered_suites < num_suites
177+
# Only report when there is a new beta and no other site/region mappings are reported.
178+
return covered_mappings == 0
181179
else:
182180
covered_suites = 0
183181
for entry in plan_entries:

0 commit comments

Comments
 (0)