Skip to content

Tracy-Walker is running l10n tests #139

Tracy-Walker is running l10n tests

Tracy-Walker is running l10n tests #139

Workflow file for this run

---
name: L10N Test Execution
run-name: ${{ github.actor }} is running l10n tests
on:
pull_request:
workflow_call:
inputs:
channel:
description: "Channel to run tests against"
default: "beta"
type: string
required: false
job_to_run:
required: true
type: string
workflow_dispatch:
inputs:
win_installer_link:
description: 'The link to the Windows installer (win64) for the Fx under test'
required: false
type: string
mac_installer_link:
description: 'The link to the macOS installer for the Fx under test'
required: false
type: string
linux_tarball_link:
description: 'The link to the Linux tarball (linux-x86_64) for the Fx under test'
required: false
type: string
env:
FX_CHANNEL: ${{ inputs.channel }}
TESTRAIL_BASE_URL: ${{ secrets.TESTRAIL_BASE_URL }}
TESTRAIL_API_KEY: ${{ secrets.TESTRAIL_API_KEY }}
TESTRAIL_USERNAME: ${{ secrets.TESTRAIL_USERNAME }}
SVC_ACCT_DECRYPT: ${{ secrets.SVC_ACCT_DECRYPT }}
FX_L10N: true
jobs:
L10N-MacOS:
if: ${{ inputs.job_to_run == 'L10N-MacOS' || github.event_name == 'pull_request' || inputs.mac_installer_link }}
runs-on: macos-latest
steps:
- name: Create app token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.BOT_CLIENT_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Set Environment (Scheduled Beta)
if: ${{ inputs.job_to_run == 'L10N-MacOS' }}
run: |
echo "TESTRAIL_REPORT='true'" >> "$GITHUB_ENV";
echo "Running report for most recent Beta on MacOS";
- name: Set Environment (Manual)
if: ${{ inputs.mac_installer_link }}
run: |
echo "MANUAL='true'" >> "$GITHUB_ENV";
echo "Running l10n tests on supplied executable";
- name: Install dependencies
run: |
mkdir -p artifacts/;
pip3 install 'pipenv==2023.11.15';
pip3 install 'ruff>=0.4.8,<0.5';
rm ./pyproject.toml;
mv ./ci_pyproject.toml ./pyproject.toml;
pipenv install;
- name: Install Fx
id: setup
env:
MANUAL_DOWNLOAD_LINK: ${{ inputs.mac_installer_link }}
run:
echo app_name=$(bash ./collect_executables.sh | xargs -0 ./parse_executables.sh) >> "$GITHUB_OUTPUT";
- name: Run L10N Tests in MacOS
if: steps.setup.conclusion == 'success'
env:
FX_EXECUTABLE: /Volumes/${{ steps.setup.outputs.app_name }}/${{ steps.setup.outputs.app_name }}.app/Contents/MacOS/firefox
run: |
"$FX_EXECUTABLE" --version;
echo "0" > TEST_EXIT_CODE;
pipenv run python choose_l10n_ci_set.py;
while IFS= read -r line; do
echo "Running tests for: $line";
pipenv run python -m l10n_CM.run_l10n --fx-executable="$FX_EXECUTABLE" $line || SCRIPT_EXIT_CODE=$?;
done < selected_l10n_mappings;
mv artifacts artifacts-mac || true;
EXIT_CODE=$(cat TEST_EXIT_CODE);
if [ $EXIT_CODE != 0 ]; then
exit $EXIT_CODE;
fi
exit $SCRIPT_EXIT_CODE;
- name: Run L10N Tests in MacOS (Headed)
if: steps.setup.conclusion == 'success' && always()
env:
FX_EXECUTABLE: /Volumes/${{ steps.setup.outputs.app_name }}/${{ steps.setup.outputs.app_name }}.app/Contents/MacOS/firefox
REPORTABLE: ${{ env.TESTRAIL_REPORT == 'true' }}
run: |
mv ./ci_l10n_pyproject_headed.toml ./pyproject.toml;
echo "0" > TEST_EXIT_CODE;
while IFS= read -r line; do
echo "Running tests for: $line";
pipenv run python -m l10n_CM.run_l10n --fx-executable="$FX_EXECUTABLE" $line || SCRIPT_EXIT_CODE=$?;
done < selected_l10n_mappings;
mv -n artifacts/* artifacts-mac/ || true;
EXIT_CODE=$(cat TEST_EXIT_CODE);
if [ $EXIT_CODE != 0 ]; then
exit $EXIT_CODE;
fi
exit $SCRIPT_EXIT_CODE;
- name: Upload artifacts
if: ${{ always() && github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v4
with:
name: artifacts-mac
path: artifacts-mac
L10N-Linux:
if: ${{ inputs.job_to_run == 'L10N-Linux' || github.event_name == 'pull_request' || inputs.linux_tarball_link }}
runs-on: ubuntu-latest
steps:
- name: Create app token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.BOT_CLIENT_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Set Environment (Scheduled Beta)
if: ${{ inputs.job_to_run == 'L10N-Linux' }}
run: |
echo "TESTRAIL_REPORT='true'" >> "$GITHUB_ENV";
echo "Running report for most recent Beta on Linux";
- name: Install dependencies
id: setup
env:
MANUAL_DOWNLOAD_LINK: ${{ inputs.linux_tarball_link }}
run: |
echo "Running l10n tests on supplied executable";
sudo apt install gnome-screenshot;
uname -m;
mkdir -p artifacts;
pip3 install 'pipenv==2023.11.15';
pip3 install 'ruff>=0.4.8,<0.5';
rm ./pyproject.toml;
mv ./ci_xvfb_pyproject.toml ./pyproject.toml;
pipenv install;
./collect_executables.sh;
./firefox/firefox --version;
- name: Run L10N Tests in Ubuntu
if: steps.setup.conclusion == 'success'
env:
FX_EXECUTABLE: ./firefox/firefox
run: |
"$FX_EXECUTABLE" --version;
echo "0" > TEST_EXIT_CODE;
pipenv run python choose_l10n_ci_set.py;
Xvfb :99 -screen 0 '1600x1200x24' > artifacts/xvfb.log &
while IFS= read -r line; do
echo "Running tests for: $line";
DISPLAY=:99 pipenv run python -m l10n_CM.run_l10n --fx-executable="$FX_EXECUTABLE" $line || SCRIPT_EXIT_CODE=$?;
done < selected_l10n_mappings;
mv artifacts artifacts-linux || true;
EXIT_CODE=$(cat TEST_EXIT_CODE);
if [ $EXIT_CODE != 0 ]; then
exit $EXIT_CODE;
fi
exit $SCRIPT_EXIT_CODE;
- name: Run Smoke Tests in Ubuntu (Headed)
if: steps.setup.conclusion == 'success' && always()
env:
REPORTABLE: ${{ env.TESTRAIL_REPORT == 'true' }}
FX_EXECUTABLE: ./firefox/firefox
run: |
mv ./ci_l10n_pyproject_headed.toml ./pyproject.toml;
echo "0" > TEST_EXIT_CODE;
while IFS= read -r line; do
echo "Running tests for: $line";
DISPLAY=:99 pipenv run python -m l10n_CM.run_l10n --fx-executable="$FX_EXECUTABLE" $line || SCRIPT_EXIT_CODE=$?;
done < selected_l10n_mappings;
mv -n artifacts/* artifacts-linux/ || true;
EXIT_CODE=$(cat TEST_EXIT_CODE);
if [ $EXIT_CODE != 0 ]; then
exit $EXIT_CODE;
fi
exit $SCRIPT_EXIT_CODE;
- name: Upload artifacts
if: ${{ always() && github.event_name == 'pull_request' }}
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 }}
runs-on: windows-latest
steps:
- name: Create app token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.BOT_CLIENT_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Set Environment (Manual)
if: ${{ inputs.win_installer_link }}
run: |
$env_contents = @"
MANUAL='true'
"@
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' }}
run: |
$env_contents = @"
TESTRAIL_REPORT='true'
"@
New-item -Name .env -Value $env_contents -ItemType File -Force
Write-Host "Running report for most recent Beta on Windows"
Write-Host "$env:TESTRAIL_USERNAME"
- name: Install dependencies
run: |
mkdir -p artifacts;
pip3 install 'pipenv==2023.11.15';
pip3 install 'ruff>=0.4.8,<0.5';
rm ./pyproject.toml;
mv ./ci_pyproject.toml ./pyproject.toml;
pipenv install;
- name: Download Geckodriver
run: |
$gecko_url = (pipenv run python collect_executables.py -g) -join "`n"
echo $gecko_url
Invoke-WebRequest -Uri $gecko_url -OutFile "geckodriver.zip"
unzip geckodriver.zip
shell: pwsh
- name: Download Beta
if: ${{ !inputs.win_installer_link }}
run: |
$fx_url = (pipenv run python collect_executables.py) -join "`n"
echo $fx_url
Invoke-WebRequest -Uri $fx_url -OutFile "${{ github.workspace }}\setup.exe"
New-Item -ItemType Directory -Path "C:\Program Files\Custom Firefox" -Force
shell: pwsh
- name: Download Executable
if: ${{ inputs.win_installer_link }}
run: |
Invoke-WebRequest -Uri ${{ inputs.win_installer_link }} -OutFile "${{ github.workspace }}\setup.exe"
New-Item -ItemType Directory -Path "C:\Program Files\Custom Firefox" -Force
shell: pwsh
- name: Install Beta
id: setup
run: |
Start-Process -FilePath "${{ github.workspace }}\setup.exe" -ArgumentList "/S", '/D=C:\Program Files\Custom Firefox' -Wait -NoNewWindow -PassThru
shell: pwsh
- name: Run L10N Tests in Win
if: steps.setup.conclusion == 'success'
run: |
pipenv run python -c "import sys; print(sys.platform)"
$env:FX_EXECUTABLE = 'C:\Program Files\Custom Firefox\firefox.exe'
Start-Process -FilePath $env:FX_EXECUTABLE -ArgumentList "--version" -Wait -NoNewWindow
pipenv run python choose_l10n_ci_set.py
"0" | Set-Content -Path "TEST_EXIT_CODE"
$SCRIPT_EXIT_CODE = 0
Get-Content "selected_l10n_mappings" | ForEach-Object {
$line = $_
Write-Host "Running tests for: $line"
try {
pipenv run python -m l10n_CM.run_l10n --fx-executable="$env:FX_EXECUTABLE" $line
} catch {
$SCRIPT_EXIT_CODE = $_.Exception.HResult
}
}
mv artifacts artifacts-win || true
$EXIT_CODE = Get-Content -Path "TEST_EXIT_CODE"
if ($EXIT_CODE -ne 0) {
exit [int]$EXIT_CODE
}
exit $env:SCRIPT_EXIT_CODE
- name: Run L10N Tests in Win (Headed)
if: steps.setup.conclusion == 'success' && always()
env:
REPORTABLE: ${{ env.TESTRAIL_REPORT == 'true' }}
run: |
rm ./pyproject.toml;
mv ./ci_l10n_pyproject_headed.toml ./pyproject.toml;
$env:FX_EXECUTABLE = 'C:\Program Files\Custom Firefox\firefox.exe'
Write-Host "FX_EXECUTABLE: $FX_EXECUTABLE"
pipenv run python choose_l10n_ci_set.py
"0" | Set-Content -Path "TEST_EXIT_CODE"
$SCRIPT_EXIT_CODE = 0
Get-Content "selected_l10n_mappings" | ForEach-Object {
$line = $_
Write-Host "Running tests for: $line"
try {
pipenv run python -m l10n_CM.run_l10n --fx-executable="$env:FX_EXECUTABLE" $line
} catch {
$SCRIPT_EXIT_CODE = $_.Exception.HResult
}
}
rm artifacts/assets -r -Force
Get-ChildItem -Path "artifacts" | ForEach-Object {
$destPath = "artifacts-win\" + $_.Name
if (-not (Test-Path -Path $destPath)) {
try {
Move-Item -Path $_.FullName -Destination $destPath
} catch {
# Ignore errors and continue
}
}
}
$EXIT_CODE = Get-Content -Path "TEST_EXIT_CODE"
if ($EXIT_CODE -ne 0) {
exit [int]$EXIT_CODE
}
exit $env:SCRIPT_EXIT_CODE
- name: Upload artifacts
if: ${{ always() && github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v4
with:
name: artifacts-win
path: artifacts-win
Use-Artifacts:
if: ${{ github.event_name != 'workflow_dispatch' }}
runs-on: ubuntu-latest
needs:
- L10N-Windows
- L10N-MacOS
- L10N-Linux
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
pip3 install 'pipenv==2023.11.15'
pipenv install
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: artifacts-win
path: artifacts-win
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: artifacts-linux
path: artifacts-linux
- name: Download MacOS artifact
uses: actions/download-artifact@v4
with:
name: artifacts-mac
path: artifacts-mac
- name: List downloaded Windows files
run: ls artifacts-win/
- name: List downloaded Linux files
run: ls artifacts-linux/
- name: List downloaded MacOS files
run: ls artifacts-mac/
- name: Run script with secret
env:
SLACK_KEY: ${{ secrets.SLACK_KEY }}
GCP_CREDENTIAL: ${{ secrets.GCP_CREDENTIAL }}
GITHUB_SHA: ${{ github.sha }}
GITHUB_RUN_ID: ${{ github.run_id }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_REF_NAME: ${{ github.ref_name }}
run: |
pipenv run python notifier.py