Translations update from Hosted Weblate #3045
Workflow file for this run
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: Documentation and public code coverage | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| merge_group: | |
| permissions: | |
| contents: read | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| src: ${{ steps.filter.outputs.src }} | |
| tests: ${{ steps.filter.outputs.tests }} | |
| docs: ${{ steps.filter.outputs.docs }} | |
| steps: | |
| - uses: actions/checkout@v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - uses: dorny/paths-filter@v4.0.1 | |
| id: filter | |
| with: | |
| base: main | |
| filters: | | |
| src: | |
| - "src/**" | |
| - "**.cpp" | |
| - "**.h" | |
| - "**.hpp" | |
| - "**.ui" | |
| - "**.qrc" | |
| - "**.pro" | |
| - "**.pri" | |
| tests: | |
| - "tests/**" | |
| docs: | |
| - "docs/**" | |
| docs: | |
| needs: changes | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Check if docs needed | |
| id: need_docs | |
| shell: bash | |
| run: | | |
| if [[ "${NEEDS_CHANGES_OUTPUTS_SRC}" == "true" ]] || \ | |
| [[ "${NEEDS_CHANGES_OUTPUTS_TESTS}" == "true" ]] || \ | |
| [[ "${NEEDS_CHANGES_OUTPUTS_DOCS}" == "true" ]] || \ | |
| [[ "${{ github.event_name }}" == "merge_group" ]]; then | |
| echo "run_docs=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "run_docs=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| env: | |
| NEEDS_CHANGES_OUTPUTS_SRC: ${{ needs.changes.outputs.src }} | |
| NEEDS_CHANGES_OUTPUTS_TESTS: ${{ needs.changes.outputs.tests }} | |
| NEEDS_CHANGES_OUTPUTS_DOCS: ${{ needs.changes.outputs.docs }} | |
| - name: No changes - skipping | |
| if: steps.need_docs.outputs.run_docs != 'true' | |
| run: echo "No relevant changes - skipping docs and coverage" | |
| - uses: actions/checkout@v7.0.0 | |
| if: steps.need_docs.outputs.run_docs == 'true' | |
| with: | |
| persist-credentials: false | |
| - name: Install Qt | |
| if: steps.need_docs.outputs.run_docs == 'true' | |
| uses: jurplel/install-qt-action@v4.3.1 | |
| - name: Install Doxygen | |
| if: steps.need_docs.outputs.run_docs == 'true' | |
| run: | | |
| # Pinned Doxygen release. doxygen.nl has intermittent outages, so try | |
| # the identical GitHub release asset (CDN-backed) first and fall back | |
| # to doxygen.nl, retrying each source before giving up. | |
| DOXYGEN_VERSION=1.17.0 | |
| tarball="doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz" | |
| github_tag="Release_${DOXYGEN_VERSION//./_}" | |
| urls=( | |
| "https://github.com/doxygen/doxygen/releases/download/${github_tag}/${tarball}" | |
| "https://doxygen.nl/files/${tarball}" | |
| ) | |
| downloaded=0 | |
| for url in "${urls[@]}"; do | |
| echo "Fetching Doxygen from ${url}" | |
| if curl -fsSL --retry 3 --retry-delay 5 --retry-all-errors \ | |
| "${url}" -o doxygen.tar.gz; then | |
| downloaded=1 | |
| break | |
| fi | |
| echo "::warning::Failed to download Doxygen from ${url}" | |
| done | |
| if [ "${downloaded}" -ne 1 ]; then | |
| echo "::error::Could not download Doxygen ${DOXYGEN_VERSION}" | |
| exit 1 | |
| fi | |
| tar -xzf doxygen.tar.gz | |
| sudo cp -r "doxygen-${DOXYGEN_VERSION}/bin/"* /usr/local/bin/ | |
| rm -rf doxygen.tar.gz "doxygen-${DOXYGEN_VERSION}" | |
| # Install graphviz via apt | |
| sudo apt-get update && sudo apt-get install -y graphviz | |
| - name: Extract version | |
| if: steps.need_docs.outputs.run_docs == 'true' | |
| run: | | |
| VERSION=$(grep -E '^VERSION *=' qtpass.pri | cut -d'=' -f2 | tr -d ' ') | |
| if [ -z "$VERSION" ]; then | |
| echo "Error: Failed to extract VERSION from qtpass.pri" >&2 | |
| exit 1 | |
| fi | |
| echo "QTPASS_VERSION=$VERSION" >> "$GITHUB_ENV" | |
| echo "Extracted version: $VERSION" | |
| TMPFILE=$(mktemp) | |
| if [ -z "$TMPFILE" ]; then | |
| echo "Error: Failed to create temporary file." >&2 | |
| exit 1 | |
| fi | |
| if ! sed "s|^PROJECT_NUMBER.*=.*|PROJECT_NUMBER = $VERSION|" Doxyfile > "$TMPFILE"; then | |
| echo "Error: Failed to update PROJECT_NUMBER in Doxyfile." >&2 | |
| rm -f "$TMPFILE" | |
| exit 1 | |
| fi | |
| if ! grep -qF -- "PROJECT_NUMBER = $VERSION" "$TMPFILE"; then | |
| echo "Error: PROJECT_NUMBER was not updated in Doxyfile." >&2 | |
| rm -f "$TMPFILE" | |
| exit 1 | |
| fi | |
| if ! mv "$TMPFILE" Doxyfile; then | |
| echo "Error: Failed to replace Doxyfile with updated content." >&2 | |
| rm -f "$TMPFILE" | |
| exit 1 | |
| fi | |
| echo "Updated Doxyfile with version: $VERSION" | |
| - name: Generate documentation | |
| if: steps.need_docs.outputs.run_docs == 'true' | |
| run: doxygen | |
| - name: Install lcov | |
| if: steps.need_docs.outputs.run_docs == 'true' | |
| run: sudo apt-get update && sudo apt-get install -y lcov | |
| - name: qmake | |
| if: steps.need_docs.outputs.run_docs == 'true' | |
| run: qmake CONFIG+=coverage | |
| - name: Build | |
| if: steps.need_docs.outputs.run_docs == 'true' | |
| run: make | |
| - name: Run tests and generate coverage | |
| if: steps.need_docs.outputs.run_docs == 'true' | |
| run: | | |
| make lcov TESTARGS="--platform offscreen -o qtpass.junit.xml,junitxml" | |
| - name: Upload coverage to Codecov | |
| if: steps.need_docs.outputs.run_docs == 'true' && !cancelled() | |
| uses: codecov/codecov-action@v7.0.0 | |
| with: | |
| files: ./docs/coverage/.lcov.total | |
| flags: qtpass | |
| name: qtpass-lcov | |
| fail_ci_if_error: false | |
| verbose: true | |
| use_pypi: true | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Upload test results to Codecov | |
| if: steps.need_docs.outputs.run_docs == 'true' && !cancelled() | |
| uses: codecov/codecov-action@v7.0.0 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: "tests/auto/*/qtpass.junit.xml" | |
| report_type: test_results | |
| use_pypi: true | |
| fail_ci_if_error: true | |
| - name: Upload coverage to Coveralls | |
| if: steps.need_docs.outputs.run_docs == 'true' && !cancelled() | |
| uses: coverallsapp/github-action@v2.3.7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| files: ./docs/coverage/.lcov.total | |
| format: lcov | |
| fail-on-error: false | |
| - name: Deploy to GitHub Pages | |
| if: steps.need_docs.outputs.run_docs == 'true' && github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| uses: peaceiris/actions-gh-pages@v4.1.0 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_branch: gh-pages | |
| publish_dir: ./docs | |
| destination_dir: docs | |
| keep_files: true | |
| user_name: "GitHub Actions" | |
| user_email: "github-actions[bot]@users.noreply.github.com" |