Cancel concurrent in progress actions #143
This file contains hidden or 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
| name: Build documentation | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| branches: | |
| - master | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| generate-language-list: | |
| name: Generate languages list | |
| runs-on: ubuntu-latest | |
| outputs: | |
| langs: ${{ steps.language-list.outputs.langs }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - id: language-list | |
| name: Send languages to outputs | |
| run: | | |
| echo "langs=[$(make list-languages-as-json)]" >> $GITHUB_OUTPUT | |
| build-docs: | |
| name: Build the documentation | |
| runs-on: ubuntu-latest | |
| needs: generate-language-list | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: ${{ fromJSON(needs.generate-language-list.outputs.langs) }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - name: Install Sphinx | |
| run: sudo apt install sphinx-doc python3-sphinx | |
| - name: Install gettext | |
| run: sudo apt-get install -y gettext | |
| - name: Install git-restore-mtime | |
| run: | | |
| sudo apt-get install -y git-restore-mtime | |
| # https://github.com/MestreLion/git-tools/pull/83#issuecomment-3707215048 | |
| sudo sed -i 's,whatchanged,log --raw,' /usr/lib/git-core/git-restore-mtime | |
| sudo sed -i "s,if merge: cmd += ' -m',cmd += ' -m' if merge else ' --no-merges'," /usr/lib/git-core/git-restore-mtime | |
| - name: Restore modification times | |
| run: git restore-mtime | |
| - name: Restore modification times for phpMyAdmin | |
| working-directory: phpmyadmin | |
| run: git restore-mtime | |
| - name: Cache output for "${{ matrix.languageCode }}" | |
| uses: actions/cache@v5 | |
| with: | |
| path: output/${{ matrix.languageCode }} | |
| key: docs-output-${{ matrix.languageCode }} | |
| - name: Build the documentation (${{ matrix.languageCode }}) | |
| # -n (Run in nitpicky mode. This generates warnings for all missing references) | |
| # -a (Always write all output files, even if there is no changes) | |
| # -W (Turn warnings into errors) | |
| # NOTE: Changed in version 8.1: sphinx-build no longer exits on the first warning, | |
| # NOTE: but instead runs the entire build and exits with exit status 1 if any warnings were generated. | |
| # NOTE: This behaviour was previously enabled with --keep-going. | |
| # -w (Warnings file) | |
| run: make html-${{ matrix.languageCode }} SPHINXOPTS='-n -W -a -w /tmp/sphinx-warnings.txt --keep-going' | |
| - name: Report all errors | |
| if: ${{ failure() }} | |
| # TODO: format errors like '::error file={name},line={line},endLine={endLine},title={title}::{message}' | |
| run: | | |
| echo '### Errors for ${{ matrix.languageCode }}' >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| sed "s,$PWD/,," /tmp/sphinx-warnings.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY |