Skip to content

ci: switch to GitHub Actions #228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Feb 3, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -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
98 changes: 98 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
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:
- name: Checkout ${{ github.repository }}
uses: actions/[email protected]
- name: Install uv
uses: astral-sh/[email protected]
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
- name: Run pre-commit
uses: pre-commit/[email protected]
- name: Run markdownlint
uses: YannickTeKulve/[email protected]
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
# - name: Upload SARIF file
# 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/[email protected]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this step have a name, like the checkout step above?

Same question for one of the other steps below that doesn't have a name.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not required, it will then say "Run actions/[email protected]".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I leave it up to you then.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed names where it is obvious (when reusing an action).

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: Install uv
uses: astral-sh/[email protected]
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 ${{ steps.setup-uv.outputs.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/[email protected]
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- name: Build site
run: mkdocs build --strict
75 changes: 0 additions & 75 deletions .gitlab-ci.yml

This file was deleted.

2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ validation:
unrecognized_links: warn
anchors: warn

strict: true


watch:
- CHANGELOG.md