-
Notifications
You must be signed in to change notification settings - Fork 696
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7222 from freedomofpress/l10n-gha
Migrate translation-tests to GitHub Actions
- Loading branch information
Showing
2 changed files
with
58 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Translation | ||
on: | ||
push: | ||
branches: | ||
- 'l10n-*' | ||
pull_request: | ||
schedule: | ||
# Weekly on Sundays | ||
- cron: '0 3 * * 0' | ||
|
||
# Only build for latest push/PR unless it's main or release/ | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !startsWith( github.ref, 'refs/heads/release/' ) }} | ||
|
||
jobs: | ||
locales: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
locales: ${{ steps.locales.outputs.locales }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Generate locale list | ||
id: locales | ||
run: | | ||
# We only want to run if it's: | ||
# 1. A pull request from the weblate-fpf user | ||
# 2. A scheduled run | ||
# 3. A push to a `l10n-*` branch | ||
# Two and Three are checked above, so we just need to check One. | ||
if [ "${{ github.event_name }}" = "pull_request" ] && [ "${{ github.actor }}" = "weblate-fpf" ]; then | ||
echo "locales=$(make supported-locales)" >> "$GITHUB_OUTPUT" | ||
else | ||
if [ "${{ github.event_name }}" != "pull_request" ]; then | ||
echo "locales=$(make supported-locales)" >> "$GITHUB_OUTPUT" | ||
else | ||
# skip: non weblate-fpf PR, just output an empty list | ||
echo "locales=[]" >> "$GITHUB_OUTPUT" | ||
fi | ||
fi | ||
test: | ||
runs-on: ubuntu-latest | ||
needs: locales | ||
# If we're in the skip case above, we'll have an empty list | ||
if: "join(fromJSON(needs.locales.outputs.locales), '') != ''" | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
locale: ${{ fromJson(needs.locales.outputs.locales) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build image | ||
run: | | ||
DOCKER_BUILD_VERBOSE=true ./securedrop/bin/dev-shell true | ||
- name: Run translation tests | ||
run: | | ||
LOCALES="${{ matrix.locale }}" make translation-test |