ci: add problem matcher for htmlproofer invalid url errors and fix build #705
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
| # SPDX-FileCopyrightText: Copyright (C) 2025 Opal Health Informatics Group at the Research Institute of the McGill University Health Centre <john.kildea@mcgill.ca> | |
| # | |
| # SPDX-License-Identifier: MIT | |
| name: ci | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| merge_group: | |
| workflow_call: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| # don't cancel any workflows on the main branch | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0 | |
| id: setup-uv | |
| with: | |
| # renovate: datasource=pypi dependency=uv | |
| version: "0.9.26" | |
| - name: Install pre-commit | |
| run: | | |
| uv sync --locked --only-dev | |
| - uses: mschoettle/pre-commit-action@0ffaba63d7e205c4109d6a3ca4ced5fc4decd04b # v4.2.3 | |
| env: | |
| SKIP: markdownlint-cli2,reuse-lint-file | |
| run-reuse-workflow: | |
| uses: opalmedapps/.github/.github/workflows/reuse.yaml@main | |
| markdownlint: | |
| permissions: | |
| contents: read | |
| # required for upload-sarif action | |
| # https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github#example-workflow-for-sarif-files-generated-outside-of-a-repository | |
| security-events: write | |
| uses: opalmedapps/.github/.github/workflows/markdownlint.yaml@main | |
| with: | |
| semantic-linebreak: false | |
| mkdocs-material-linter: true | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - lint | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| # fetch the full git history to be able to determine creation dates for pages | |
| # see: https://github.com/timvink/mkdocs-git-revision-date-localized-plugin?tab=readme-ov-file#note-when-using-build-environments | |
| fetch-depth: 0 | |
| - uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0 | |
| id: setup-uv | |
| with: | |
| # renovate: datasource=pypi dependency=uv | |
| version: "0.9.26" | |
| - name: Install dependencies | |
| run: | | |
| uv sync --locked | |
| # see: https://squidfunk.github.io/mkdocs-material/publishing-your-site/#with-github-actions | |
| # weekly cache updates | |
| - run: echo "cache_id=$(date --utc '+%V')" >> "$GITHUB_ENV" | |
| - uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2 | |
| with: | |
| # weekly cache | |
| key: mkdocs-material-${{ env.cache_id }} | |
| path: .cache | |
| restore-keys: | | |
| mkdocs-material- | |
| # Problem matcher for htmlproofer warnings (instead of errors to avoid failing the build randomly) | |
| # https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md | |
| # https://github.com/actions/toolkit/blob/main/docs/commands.md#problem-matchers | |
| - name: Add problem matcher | |
| run: | | |
| echo "::add-matcher::.github/matcher-htmlproofer.json" | |
| - name: Build site | |
| run: uv run mkdocs build --strict | |
| deploy: | |
| uses: ./.github/workflows/deploy.yml | |
| if: success() && github.ref == 'refs/heads/main' | |
| needs: | |
| - lint | |
| - markdownlint | |
| - build | |
| permissions: | |
| contents: write |