Skip to content

Commit ebebe97

Browse files
added workflow
1 parent c7d3438 commit ebebe97

File tree

1 file changed

+156
-0
lines changed

1 file changed

+156
-0
lines changed

.github/workflows/l10n.yml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
2+
File filter
3+
---
4+
name: L10N Test Execution
5+
6+
run-name: ${{ github.actor }} is running l10n tests
7+
on:
8+
pull_request:
9+
workflow_call:
10+
inputs:
11+
channel:
12+
description: "Channel to run tests against"
13+
default: "beta"
14+
type: string
15+
required: false
16+
job_to_run:
17+
required: true
18+
type: string
19+
workflow_dispatch:
20+
inputs:
21+
mac_installer_link:
22+
description: 'The link to the macOS installer for the Fx under test'
23+
required: false
24+
type: string
25+
env:
26+
FX_CHANNEL: ${{ inputs.channel }}
27+
TESTRAIL_BASE_URL: ${{ secrets.TESTRAIL_BASE_URL }}
28+
TESTRAIL_API_KEY: ${{ secrets.TESTRAIL_API_KEY }}
29+
TESTRAIL_USERNAME: ${{ secrets.TESTRAIL_USERNAME }}
30+
SVC_ACCT_DECRYPT: ${{ secrets.SVC_ACCT_DECRYPT }}
31+
FX_L10N: 'true'
32+
33+
jobs:
34+
L10N-MacOS:
35+
if: ${{ inputs.job_to_run == 'L10N-MacOS' || github.event_name == 'pull_request' || inputs.mac_installer_link }}
36+
runs-on: macos-latest
37+
steps:
38+
- name: Create app token
39+
uses: actions/create-github-app-token@v1
40+
id: app-token
41+
with:
42+
app-id: ${{ secrets.BOT_CLIENT_ID }}
43+
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
44+
- name: Checkout repository
45+
uses: actions/checkout@v4
46+
with:
47+
token: ${{ steps.app-token.outputs.token }}
48+
- name: Set up Python 3.11
49+
uses: actions/setup-python@v5
50+
with:
51+
python-version: "3.11"
52+
- name: Check test case numbers
53+
run: |
54+
python check_test_cases.py
55+
exit $?
56+
echo "Triggered by event: ${{ github.event_name }}"
57+
- name: Set Environment (Scheduled Beta)
58+
if: ${{ inputs.job_to_run == 'L10N-MacOS' }}
59+
run: |
60+
echo "TESTRAIL_REPORT='true'" >> "$GITHUB_ENV";
61+
echo "Running report for most recent Beta on MacOS";
62+
- name: Set Environment (Manual)
63+
if: ${{ inputs.mac_installer_link }}
64+
run: |
65+
echo "MANUAL='true'" >> "$GITHUB_ENV";
66+
echo "Running smoke tests on supplied executable";
67+
- name: Install dependencies
68+
run: |
69+
mkdir -p artifacts/;
70+
pip3 install 'pipenv==2023.11.15';
71+
pip3 install 'ruff>=0.4.8,<0.5';
72+
rm ./pyproject.toml;
73+
mv ./ci_pyproject.toml ./pyproject.toml;
74+
pipenv install
75+
- name: Install Fx
76+
id: setup
77+
env:
78+
MANUAL_DOWNLOAD_LINK: ${{ inputs.mac_installer_link }}
79+
run:
80+
echo app_name=$(bash ./collect_executables.sh | xargs -0 ./parse_executables.sh) >> "$GITHUB_OUTPUT"
81+
- name: Run L10N Tests in MacOS
82+
if: steps.setup.conclusion == 'success'
83+
env:
84+
FX_EXECUTABLE: /Volumes/${{ steps.setup.outputs.app_name }}/${{ steps.setup.outputs.app_name }}.app/Contents/MacOS/firefox
85+
run: |
86+
"$FX_EXECUTABLE" --version
87+
echo "0" > TEST_EXIT_CODE
88+
pipenv run python check_l10n_test_cases.py
89+
while IFS= read -r line; do
90+
echo "Running tests for: $line"
91+
pipenv run python l10n_CM/run_l10n.py --fx-executable="$FX_EXECUTABLE" $line || SCRIPT_EXIT_CODE=$?
92+
done < selected_l10n_mappings
93+
mv artifacts artifacts-mac || true
94+
EXIT_CODE=$(cat TEST_EXIT_CODE)
95+
if [ $EXIT_CODE != 0 ]; then
96+
exit $EXIT_CODE
97+
fi
98+
exit $SCRIPT_EXIT_CODE
99+
- name: Run L10N Tests in MacOS (Headed)
100+
if: steps.setup.conclusion == 'success' && always()
101+
env:
102+
FX_EXECUTABLE: /Volumes/${{ steps.setup.outputs.app_name }}/${{ steps.setup.outputs.app_name }}.app/Contents/MacOS/firefox
103+
REPORTABLE: ${{ env.TESTRAIL_REPORT == 'true' }}
104+
run: |
105+
mv ./ci_l10n_pyproject_headed.toml ./pyproject.toml;
106+
echo "0" > TEST_EXIT_CODE
107+
pipenv run python check_l10n_test_cases.py
108+
while IFS= read -r line; do
109+
echo "Running tests for: $line"
110+
pipenv run python l10n_CM/run_l10n.py --fx-executable="$FX_EXECUTABLE" $line || SCRIPT_EXIT_CODE=$?
111+
done < selected_l10n_mappings
112+
mv -n artifacts/* artifacts-mac/ || true
113+
EXIT_CODE=$(cat TEST_EXIT_CODE)
114+
if [ $EXIT_CODE != 0 ]; then
115+
exit $EXIT_CODE
116+
fi
117+
exit $SCRIPT_EXIT_CODE
118+
- name: Upload artifacts
119+
if: ${{ always() && github.event_name == 'pull_request' }}
120+
uses: actions/upload-artifact@v4
121+
with:
122+
name: artifacts-mac
123+
path: artifacts-mac
124+
Use-Artifacts:
125+
if: ${{ github.event_name != 'workflow_dispatch' }}
126+
runs-on: ubuntu-latest
127+
needs:
128+
- L10N-MacOS
129+
steps:
130+
- name: Checkout repository
131+
uses: actions/checkout@v4
132+
- name: Set up Python 3.11
133+
uses: actions/setup-python@v5
134+
with:
135+
python-version: "3.11"
136+
- name: Install dependencies
137+
run: |
138+
pip3 install 'pipenv==2023.11.15'
139+
pipenv install
140+
- name: Download MacOS artifact
141+
uses: actions/download-artifact@v4
142+
with:
143+
name: artifacts-mac
144+
path: artifacts-mac
145+
- name: List downloaded MacOS files
146+
run: ls artifacts-mac/
147+
- name: Run script with secret
148+
env:
149+
SLACK_KEY: ${{ secrets.SLACK_KEY }}
150+
GCP_CREDENTIAL: ${{ secrets.GCP_CREDENTIAL }}
151+
GITHUB_SHA: ${{ github.sha }}
152+
GITHUB_RUN_ID: ${{ github.run_id }}
153+
GITHUB_ACTOR: ${{ github.actor }}
154+
GITHUB_REF_NAME: ${{ github.ref_name }}
155+
run: |
156+
pipenv run python notifier.py

0 commit comments

Comments
 (0)