Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/ci-dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
name: DTE Automation Dispatch

run-name: CI tests kicked off by ${{ github.actor }}
on:
pull_request:
permissions:
contents: "write"

jobs:
Select-Channels:
runs-on: ubuntu-latest
outputs:
channels: ${{ steps.dispatch.outputs.channels }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Select test channels
id: dispatch
run: |
python3 choose_test_channel.py
echo channels=$(python3 choose_test_channel.py) >> "$GITHUB_OUTPUT"


Run-Smoke-Win:
needs: Select-Channels
if: contains(fromJSON(needs.Select-Channels.outputs.channels), 'smoke')
uses: ./.github/workflows/smoke.yml
with:
job_to_run: Smoke-Windows
is_pull_request: true
secrets: inherit

Run-Smoke-Mac:
needs: Select-Channels
if: contains(fromJSON(needs.Select-Channels.outputs.channels), 'smoke')
uses: ./.github/workflows/smoke.yml
with:
job_to_run: Smoke-MacOS
is_pull_request: true
secrets: inherit

Run-L10n-Win:
needs: Select-Channels
if: contains(fromJSON(needs.Select-Channels.outputs.channels), 'l10n')
uses: ./.github/workflows/l10n.yml
with:
job_to_run: L10n-Windows
is_pull_request: true
secrets: inherit

Run-L10n-Mac:
needs: Select-Channels
if: contains(fromJSON(needs.Select-Channels.outputs.channels), 'l10n')
uses: ./.github/workflows/l10n.yml
with:
job_to_run: L10n-MacOS
is_pull_request: true
secrets: inherit

Run-L10n-Linux:
needs: Select-Channels
if: contains(fromJSON(needs.Select-Channels.outputs.channels), 'l10n')
uses: ./.github/workflows/l10n.yml
with:
job_to_run: L10n-Linux
is_pull_request: true
secrets: inherit
28 changes: 16 additions & 12 deletions .github/workflows/l10n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: L10N Test Execution

run-name: ${{ github.actor }} is running l10n tests
on:
pull_request:
workflow_call:
inputs:
channel:
Expand All @@ -14,6 +13,11 @@ on:
job_to_run:
required: true
type: string
is_pull_request:
description: "Is this a PR?"
default: false
type: boolean
required: true
workflow_dispatch:
inputs:
win_installer_link:
Expand All @@ -38,7 +42,7 @@ env:

jobs:
L10N-MacOS:
if: ${{ inputs.job_to_run == 'L10N-MacOS' || github.event_name == 'pull_request' || inputs.mac_installer_link }}
if: ${{ inputs.job_to_run == 'L10N-MacOS' || inputs.mac_installer_link }}
runs-on: macos-latest
steps:
- name: Create app token
Expand All @@ -56,7 +60,7 @@ jobs:
with:
python-version: "3.11"
- name: Set Environment (Scheduled Beta)
if: ${{ inputs.job_to_run == 'L10N-MacOS' }}
if: ${{ inputs.job_to_run == 'L10N-MacOS' && inputs.is_pull_request == false }}
run: |
echo "TESTRAIL_REPORT='true'" >> "$GITHUB_ENV";
echo "Running report for most recent Beta on MacOS";
Expand Down Expand Up @@ -123,7 +127,7 @@ jobs:
name: artifacts-mac
path: artifacts-mac
L10N-Linux:
if: ${{ inputs.job_to_run == 'L10N-Linux' || github.event_name == 'pull_request' || inputs.linux_tarball_link }}
if: ${{ inputs.job_to_run == 'L10N-Linux' || inputs.linux_tarball_link }}
runs-on: ubuntu-latest
steps:
- name: Create app token
Expand All @@ -141,7 +145,7 @@ jobs:
with:
python-version: "3.11"
- name: Set Environment (Scheduled Beta)
if: ${{ inputs.job_to_run == 'L10N-Linux' }}
if: ${{ inputs.job_to_run == 'L10N-Linux' && inputs.is_pull_request == false }}
run: |
echo "TESTRAIL_REPORT='true'" >> "$GITHUB_ENV";
echo "Running report for most recent Beta on Linux";
Expand Down Expand Up @@ -200,13 +204,13 @@ jobs:
fi
exit $SCRIPT_EXIT_CODE;
- name: Upload artifacts
if: ${{ always() && github.event_name == 'pull_request' }}
if: ${{ always() && inputs.is_pull_request == true }}
uses: actions/upload-artifact@v4
with:
name: artifacts-linux
path: artifacts-linux
L10N-Windows:
if: ${{ inputs.job_to_run == 'L10N-Windows' || github.event_name == 'pull_request' || inputs.win_installer_link }}
if: ${{ inputs.job_to_run == 'L10N-Windows' || inputs.win_installer_link }}
runs-on: windows-latest
steps:
- name: Create app token
Expand All @@ -232,7 +236,7 @@ jobs:
New-item -Name .env -Value $env_contents -ItemType File -Force
Write-Host "Running l10n tests on supplied executable"
- name: Set Environment (Scheduled Beta)
if: ${{ inputs.job_to_run == 'L10N-Windows' }}
if: ${{ inputs.job_to_run == 'L10N-Windows' && inputs.is_pull_request == false}}
run: |
$env_contents = @"
TESTRAIL_REPORT='true'
Expand Down Expand Up @@ -340,7 +344,7 @@ jobs:
}
exit $env:SCRIPT_EXIT_CODE
- name: Upload artifacts
if: ${{ always() && github.event_name == 'pull_request' }}
if: ${{ always() && inputs.is_pull_request == true }}
uses: actions/upload-artifact@v4
with:
name: artifacts-win
Expand All @@ -367,17 +371,17 @@ jobs:
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: artifacts-win
name: artifacts-win-l10n
path: artifacts-win
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: artifacts-linux
name: artifacts-linux-l10n
path: artifacts-linux
- name: Download MacOS artifact
uses: actions/download-artifact@v4
with:
name: artifacts-mac
name: artifacts-mac-l10n
path: artifacts-mac
- name: List downloaded Windows files
run: ls artifacts-win/
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Smoke Test Execution

run-name: ${{ github.actor }} is running smoke tests
on:
pull_request:
workflow_call:
inputs:
channel:
Expand All @@ -14,6 +13,11 @@ on:
job_to_run:
required: true
type: string
is_pull_request:
description: "Is this a PR?"
default: false
type: boolean
required: true
workflow_dispatch:
inputs:
win_installer_link:
Expand All @@ -37,7 +41,7 @@ env:

jobs:
Smoke-Windows:
if: ${{ inputs.job_to_run == 'Smoke-Windows' || github.event_name == 'pull_request' || inputs.win_installer_link }}
if: ${{ inputs.job_to_run == 'Smoke-Windows' || inputs.win_installer_link }}
runs-on: windows-latest
steps:
- name: Create app token
Expand All @@ -63,7 +67,7 @@ jobs:
New-item -Name .env -Value $env_contents -ItemType File -Force
Write-Host "Running smoke tests on supplied executable"
- name: Set Environment (Scheduled Beta)
if: ${{ inputs.job_to_run == 'Smoke-Windows' }}
if: ${{ inputs.job_to_run == 'Smoke-Windows' && inputs.is_pull_request == false}}
run: |
$env_contents = @"
TESTRAIL_REPORT='true'
Expand Down Expand Up @@ -143,10 +147,10 @@ jobs:
if: ${{ always() && github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v4
with:
name: artifacts-win
name: artifacts-win-smoke
path: artifacts-win
Smoke-MacOS:
if: ${{ inputs.job_to_run == 'Smoke-MacOS' || github.event_name == 'pull_request' || inputs.mac_installer_link }}
if: ${{ inputs.job_to_run == 'Smoke-MacOS' || inputs.mac_installer_link }}
runs-on: macos-latest
steps:
- name: Create app token
Expand All @@ -169,7 +173,7 @@ jobs:
exit $?
echo "Triggered by event: ${{ github.event_name }}"
- name: Set Environment (Scheduled Beta)
if: ${{ inputs.job_to_run == 'Smoke-MacOS' }}
if: ${{ inputs.job_to_run == 'Smoke-MacOS' && inputs.is_pull_request == false}}
run: |
echo "TESTRAIL_REPORT='true'" >> "$GITHUB_ENV";
echo "Running report for most recent Beta on MacOS";
Expand Down Expand Up @@ -217,7 +221,7 @@ jobs:
if: ${{ always() && github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v4
with:
name: artifacts-mac
name: artifacts-mac-smoke
path: artifacts-mac
Smoke-Linux:
if: ${{ inputs.linux_tarball_link }}
Expand Down
61 changes: 61 additions & 0 deletions choose_test_channel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import os
import re
import sys
from subprocess import check_output

ALL_CHANNELS = ["smoke", "l10n"]
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
SLASH = "/" if "/" in SCRIPT_DIR else "\\"

file_subsets = {
"smoke": ["modules/data", "modules/page", "modules/browser", "tests/"],
"l10n": ["l10n_CM/"],
}

l10n_module_patterns = [
r"modules/page_object_prefs\.py",
r"modules/data/about_prefs\.components\.json",
r"modules/page_object_autofill\.py",
r"modules/data/address_fill\.components\.json",
r"modules/data/credit_card_fill\.components\.json",
r"modules/browser_object_autofill_popup\.py",
r"modules/data/autofill_popup\.components\.json",
]

l10n_module_patterns = set(
[
re.compile(val.replace("/", r"\\")) if SLASH == "\\" else re.compile(val)
for val in l10n_module_patterns
]
)

check_output(["git", "fetch", "--quiet", "--depth=1", "origin", "main"])

committed_files = (
check_output(["git", "--no-pager", "diff", "--name-only", "origin/main"])
.decode()
.replace("/", SLASH)
.splitlines()
)
main_conftest = "conftest.py"
base_page = os.path.join("modules", "page_base.py")

channels = []

if main_conftest in committed_files or base_page in committed_files:
print(ALL_CHANNELS)
sys.exit()

for f in committed_files:
if any([r.match(f) for r in l10n_module_patterns]):
print(ALL_CHANNELS)
sys.exit()

for test_channel in file_subsets:
for subset in file_subsets[test_channel]:
if subset in f and test_channel not in channels:
channels.append(test_channel)

if not channels:
channels = ["smoke"]
print(channels)
4 changes: 2 additions & 2 deletions l10n_CM/sites/canadatire/CA/canadatire_ad.html

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion modules/testrail_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,12 @@ def organize_l10n_entries(
if not test_results[category].get(run_id):
test_results[category][run_id] = []
test_results[category][run_id].append(
{"suite_id": suite_id, "site": site, "test_case": test_case, "duration": f"{duration}s"}
{
"suite_id": suite_id,
"site": site,
"test_case": test_case,
"duration": f"{duration}s",
}
)

return test_results
Expand Down
5 changes: 3 additions & 2 deletions taskcluster/kinds/run-smoke-tests/kind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ transforms:
- taskgraph.transforms.notify:transforms

task-defaults:
label: "Smoke Tests"
description: "Runs Smoke Tests and Notifies Slack"
label: "CI Smoke Tests"
description: "Runs CI Smoke Tests and Notifies Slack"
worker-type: t-linux-wayland
worker:
taskcluster-proxy: true
Expand Down Expand Up @@ -34,6 +34,7 @@ tasks:
./collect_executables.sh;
./firefox/firefox --version;
. ./keyring-unlock.sh
if [[ ! $(python3 choose_test_channel.py) =~ "smoke" ]]; then exit 0; fi
pipenv run python3 choose_ci_set.py
pipenv run pytest --fx-executable ./firefox/firefox -n 4 $(cat selected_tests)
export FAILURE=${?}
Expand Down
Loading