From d7dc3e791de0f79ffeffb7583595fdc26b727482 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Fri, 4 Nov 2022 12:55:31 -0300 Subject: [PATCH] Add l10n workflow to build translated docs --- .github/workflows/L10n.yml | 33 +++++++++++++++++++++++++++++++++ .github/workflows/docs.yml | 9 +++++++++ 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/L10n.yml diff --git a/.github/workflows/L10n.yml b/.github/workflows/L10n.yml new file mode 100644 index 00000000..28b8617d --- /dev/null +++ b/.github/workflows/L10n.yml @@ -0,0 +1,33 @@ +name: test + +on: + workflow_dispatch: + push: + paths: + - 'po/' + +jobs: + get-langs-changed: + runs-on: ubuntu-latest + outputs: + languages: ${{ steps.languages.outputs.languages }} + steps: + - uses: actions/checkout@v3 + - id: languages + shell: bash + run: | + content="$(find . -mindepth 1 -maxdepth 1 -type d -printf '"%P"\n' | sort | tr '\n' ',' | sed 's|,$||')" + echo "languages=[$content]" >> $GITHUB_OUTPUT + working-directory: po + + # GitHub Actions editor complains "array was expected but string was found", and it is OK + build-translated-docs: + needs: [get-langs-changed] + strategy: + max-parallel: 2 + fail-fast: false + matrix: + language: ${{ fromJSON(needs.get-langs-changed.outputs.languages) }} + uses: ./.github/workflows/docs.yml + with: + language: ${{ matrix.language }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index d820767e..3f148d01 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -3,6 +3,13 @@ name: Docs on: push: pull_request: + workflow_dispatch: + workflow_call: + inputs: + language: + required: false + type: string + default: '' permissions: contents: read @@ -25,6 +32,7 @@ jobs: - name: Sphinx build run: | echo "::add-matcher::.github/matchers/sphinx.json" + test -n "${{ inputs.language }}" && SPHINXOPTS+=" -D language=${{ inputs.language }}" make -C docs/ html SPHINXOPTS="${SPHINXOPTS}" echo "::remove-matcher owner=sphinx::" env: @@ -51,6 +59,7 @@ jobs: pip install -U -r requirements.txt - name: Sphinx linkcheck run: | + test -n "${{ inputs.language }}" && SPHINXOPTS+=" -D language=${{ inputs.language }}" make -C docs/ linkcheck SPHINXOPTS="${SPHINXOPTS}" env: SPHINXOPTS: -n -W -a --keep-going