diff --git a/.gitlab/markdownlint/.markdownlint-cli2.yaml b/.github/markdownlint/.markdownlint-cli2.yaml similarity index 86% rename from .gitlab/markdownlint/.markdownlint-cli2.yaml rename to .github/markdownlint/.markdownlint-cli2.yaml index 2320768..3f41881 100644 --- a/.gitlab/markdownlint/.markdownlint-cli2.yaml +++ b/.github/markdownlint/.markdownlint-cli2.yaml @@ -12,5 +12,5 @@ customRules: - "markdownlint-rule-max-one-sentence-per-line" outputFormatters: - - - markdownlint-cli2-formatter-default - - - markdownlint-cli2-formatter-codequality + - - markdownlint-cli2-formatter-pretty + - - markdownlint-cli2-formatter-sarif diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d2686d1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,93 @@ +name: ci + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + merge_group: + +concurrency: + group: "${{ github.ref }}" + cancel-in-progress: true + + +jobs: + lint: + runs-on: ubuntu-latest + permissions: + # 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 + contents: read + steps: + - uses: actions/checkout@v4.2.2 + - uses: astral-sh/setup-uv@v5.2.2 + id: setup-uv + with: + # renovate: datasource=pypi dependency=uv + version: "0.5.25" + # ubuntu-latest already has Python 3.x installed (pip is needed by the pre-commit action) + - name: Print the installed versions + run: | + echo "Installed uv version is ${{ steps.setup-uv.outputs.uv-version }}" + echo "Installed Python version is $(python --version)" + uv python list + - uses: pre-commit/action@v3.0.1 + - name: Run markdownlint + uses: YannickTeKulve/docker-run-action@0.0.6 + with: + image: davidanson/markdownlint-cli2-rules:v0.17.2 + # node user does not have permissions to workspace due to user id mismatch + options: -v ${{ github.workspace }}:/workdir --user root + # use the config file that is stored outside the root for CI specific configuration + # don't fail step if there are violations + run: markdownlint-cli2 --config .github/markdownlint/.markdownlint-cli2.yaml "**/*.md" || true + # Needs to be a public repo in order for uploading SARIF files to work + # https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github + # - uses: github/codeql-action/upload-sarif@v3 + # with: + # # Path to SARIF file relative to the root of the repository + # sarif_file: markdownlint-cli2-sarif.sarif + # # Optional category for the results + # # Used to differentiate multiple results for one commit + # category: markdownlint + # fail if there are markdownlint violations + - name: Check markdownlint results + run: | + cat markdownlint-cli2-sarif.sarif | grep -q '"results": \[\]' + + + build: + runs-on: ubuntu-latest + needs: + - lint + steps: + - uses: actions/checkout@v4.2.2 + with: + # 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@v5.2.2 + id: setup-uv + with: + # renovate: datasource=pypi dependency=uv + version: "0.5.25" + python-version: 3.13 + - name: Print the installed versions + run: | + echo "Installed uv version is ${{ steps.setup-uv.outputs.uv-version }}" + echo "Installed Python version is $(python --version)" + uv python list + - name: Install dependencies + run: uv pip install -r requirements.txt + - uses: actions/cache@v4.2.0 + with: + # weekly cache + key: mkdocs-material-$(date --utc '+%V') + path: .cache + restore-keys: | + mkdocs-material- + - name: Build site + run: mkdocs build --strict diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..111ec0d --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,59 @@ +name: deploy + +on: + workflow_run: + workflows: [ci] + branches: + - main + types: + - completed + workflow_dispatch: + +concurrency: + group: deploy + cancel-in-progress: true + +jobs: + deploy: + runs-on: ubuntu-latest + # only run if CI workflow completed successfully + # https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow + if: ${{ github.event.workflow_run.conclusion == 'success' }} + permissions: + contents: write + environment: pages + steps: + - uses: actions/checkout@v4.2.2 + with: + # 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 + - name: Configure Git Credentials + # see: https://github.com/actions/checkout#push-a-commit-using-the-built-in-token + run: | + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + - name: Install uv + uses: astral-sh/setup-uv@v5.2.2 + id: setup-uv + with: + # renovate: datasource=pypi dependency=uv + version: "0.5.25" + python-version: 3.13 + - name: Print the installed versions + run: | + echo "Installed uv version is ${{ steps.setup-uv.outputs.uv-version }}" + echo "Installed Python version is $(python --version)" + uv python list + - name: Install dependencies + run: uv pip install -r requirements.txt + - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + - uses: actions/cache@v4.2.0 + with: + key: mkdocs-material-${{ env.cache_id }} + path: .cache + restore-keys: | + mkdocs-material- + - name: Deploy to GitHub Pages + # see: https://squidfunk.github.io/mkdocs-material/publishing-your-site/#with-github-actions + run: mkdocs gh-deploy --strict --force diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 48f4783..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,75 +0,0 @@ -# Publish docs to GitLab Pages -# see: https://squidfunk.github.io/mkdocs-material/publishing-your-site/#gitlab-pages -# -default: - image: - name: squidfunk/mkdocs-material:9.5.50 - entrypoint: [""] - - -stages: - - lint - - build - - deploy - -pre-commit: - stage: lint - script: - - pip install pre-commit - # skip markdownlint and run it in a separate job since it requires node - - SKIP="markdownlint-cli2" pre-commit run --all - -markdownlint: - stage: lint - image: - name: davidanson/markdownlint-cli2-rules:v0.17.2 - # overwrite default entrypoint (which is a call to markdownlint-cli2) - entrypoint: [""] - script: - # use the config file that is stored outside the root - - markdownlint-cli2 --config .gitlab/markdownlint/.markdownlint-cli2.yaml "**/*.md" - artifacts: - when: always - reports: - codequality: markdownlint-cli2-codequality.json - -build: - stage: build - variables: - # 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 - GIT_DEPTH: 0 - script: - - pip install -r requirements.txt - - mkdocs --version - - mkdocs build --strict --site-dir public - artifacts: - expire_in: 7 days - paths: - - public - -pages: - stage: deploy - rules: - # deploy only on default branch - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - script: - - mkdocs --version - artifacts: - paths: - - public - - -workflow: - # auto cancel redundant pipelines - # https://docs.gitlab.com/ee/ci/pipelines/settings.html#auto-cancel-redundant-pipelines - # https://docs.gitlab.com/ee/ci/yaml/index.html#workflowauto_cancelon_new_commit - auto_cancel: - on_new_commit: interruptible - -include: - # run pipelines for default branch, tags, and all types of merge request pipelines - # to support merge trains - # see: https://docs.gitlab.com/ee/ci/pipelines/merge_trains.html#enable-merge-trains - # https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Workflows/MergeRequest-Pipelines.gitlab-ci.yml - - template: Workflows/MergeRequest-Pipelines.gitlab-ci.yml diff --git a/README.md b/README.md index 80feb50..65d83d5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Opal Documentation -[![pipeline status](https://gitlab.com/opalmedapps/docs/badges/main/pipeline.svg)](https://gitlab.com/opalmedapps/docs/-/commits/main) [![Docs](https://img.shields.io/badge/docs-available-brightgreen.svg)](https://docs.opalmedapps.ca) +[![ci](https://github.com/opalmedapps/docs/actions/workflows/ci.yml/badge.svg)](https://github.com/opalmedapps/docs/actions/workflows/ci.yml) [![Docs](https://img.shields.io/badge/docs-available-brightgreen.svg)](https://docs.opalmedapps.com) Project for the Opal documentation site. @@ -9,7 +9,7 @@ Material for MkDocs makes use of [Python Markdown](https://python-markdown.githu In addition, we use the [PlantUML Markdown extension](https://github.com/mikitex70/plantuml-markdown) to render [PlantUML](https://plantuml.com) diagrams. -The documentation site is deployed to GitLab Pages at https://docs.opalmedapps.ca. +The documentation site is deployed to GitHub Pages at https://docs.opalmedapps.com. ## Contributing diff --git a/mkdocs.yml b/mkdocs.yml index ce15c55..b2a5d55 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -175,6 +175,8 @@ validation: unrecognized_links: warn anchors: warn +strict: true + watch: - CHANGELOG.md