From d7fda402dc3e8b96cb679c9f7b4bf8ef32823de3 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sun, 3 Dec 2023 17:16:26 -0300 Subject: [PATCH 1/4] Create test-translations.yml --- .github/workflows/test-translations.yml | 71 +++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/test-translations.yml diff --git a/.github/workflows/test-translations.yml b/.github/workflows/test-translations.yml new file mode 100644 index 000000000..03df0ee70 --- /dev/null +++ b/.github/workflows/test-translations.yml @@ -0,0 +1,71 @@ +name: Test translations + +on: + workflow_dispatch: + pull_request: + paths: + - '**.po' + branches: + - translation/source + push: + paths: + - '**.po' + branches: + - translation/source + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + +env: + I18N_BRANCH: translation/source + +jobs: + matrix: + runs-on: ubuntu-latest + outputs: + languages: ${{ steps.languages.outputs.languages }} + + steps: + - name: Grab the repo src + uses: actions/checkout@v4 + with: + ref: ${{ env.I18N_BRANCH }} + + - name: List languages + id: languages + working-directory: locales + run: | + dirs=$(find * -maxdepth 0 -type d) + list="$(echo $dirs | sed "s|^|['|;s|$|']|;s| |', '|g")" + echo "languages=$list" >> $GITHUB_OUTPUT + + + test-translation: + runs-on: ubuntu-latest + needs: matrix + strategy: + fail-fast: false + matrix: + language: ${{fromJson(needs.matrix.outputs.languages)}} + + steps: + - name: Grab the repo src + uses: actions/checkout@v4 + with: + ref: ${{ env.I18N_BRANCH }} + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: >- + 3.10 + + - name: Install Python tooling + run: python -m pip install --upgrade nox virtualenv + + - name: Build translated docs in ${{ matrix.language }} + run: nox -s build -- -D language=${{ matrix.language }} From 6526d6fdd71b36353d0bf706ca5d4a0c1ed44a87 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sun, 3 Dec 2023 17:20:17 -0300 Subject: [PATCH 2/4] Add sphinx-lint, make sphinx quiet --- .github/workflows/test-translations.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-translations.yml b/.github/workflows/test-translations.yml index 03df0ee70..9b1ad5c6f 100644 --- a/.github/workflows/test-translations.yml +++ b/.github/workflows/test-translations.yml @@ -34,7 +34,7 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ env.I18N_BRANCH }} - + - name: List languages id: languages working-directory: locales @@ -65,7 +65,10 @@ jobs: 3.10 - name: Install Python tooling - run: python -m pip install --upgrade nox virtualenv + run: python -m pip install --upgrade nox virtualenv sphinx-lint - name: Build translated docs in ${{ matrix.language }} - run: nox -s build -- -D language=${{ matrix.language }} + run: nox -s build -- -q -D language=${{ matrix.language }} + + - name: Lint translation file + run: sphinx-lint locales/${{ matrix.language }}/LC_MESSAGES/message.po From 67f169ff1f2f26ba46eee3f7609381da6334b0ee Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Wed, 20 Dec 2023 09:43:56 -0300 Subject: [PATCH 3/4] Fix po filename in test-translations.yml --- .github/workflows/test-translations.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-translations.yml b/.github/workflows/test-translations.yml index 9b1ad5c6f..cdb40b1aa 100644 --- a/.github/workflows/test-translations.yml +++ b/.github/workflows/test-translations.yml @@ -71,4 +71,4 @@ jobs: run: nox -s build -- -q -D language=${{ matrix.language }} - name: Lint translation file - run: sphinx-lint locales/${{ matrix.language }}/LC_MESSAGES/message.po + run: sphinx-lint locales/${{ matrix.language }}/LC_MESSAGES/messages.po From b55365166533622f9c5fd6549dcbbe6f746aca07 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Wed, 20 Dec 2023 09:45:23 -0300 Subject: [PATCH 4/4] Make the matrix input generation more simpler Co-authored-by: Jean Abou-Samra --- .github/workflows/test-translations.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test-translations.yml b/.github/workflows/test-translations.yml index cdb40b1aa..50f2dd067 100644 --- a/.github/workflows/test-translations.yml +++ b/.github/workflows/test-translations.yml @@ -39,8 +39,7 @@ jobs: id: languages working-directory: locales run: | - dirs=$(find * -maxdepth 0 -type d) - list="$(echo $dirs | sed "s|^|['|;s|$|']|;s| |', '|g")" + list=$(find * -maxdepth 0 -type d | jq -nRc '[inputs]') echo "languages=$list" >> $GITHUB_OUTPUT