Skip to content

Commit 7628270

Browse files
authored
ci: switch to GitHub Actions (#228)
Add GitHub Actions workflow for CI and deployment to GitHub pages.
1 parent 52a04a2 commit 7628270

File tree

6 files changed

+158
-79
lines changed

6 files changed

+158
-79
lines changed

.gitlab/markdownlint/.markdownlint-cli2.yaml renamed to .github/markdownlint/.markdownlint-cli2.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ customRules:
1212
- "markdownlint-rule-max-one-sentence-per-line"
1313

1414
outputFormatters:
15-
- - markdownlint-cli2-formatter-default
16-
- - markdownlint-cli2-formatter-codequality
15+
- - markdownlint-cli2-formatter-pretty
16+
- - markdownlint-cli2-formatter-sarif

.github/workflows/ci.yml

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
merge_group:
10+
11+
concurrency:
12+
group: "${{ github.ref }}"
13+
cancel-in-progress: true
14+
15+
16+
jobs:
17+
lint:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
# required for upload-sarif action
21+
# 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
22+
security-events: write
23+
contents: read
24+
steps:
25+
- uses: actions/[email protected]
26+
- uses: astral-sh/[email protected]
27+
id: setup-uv
28+
with:
29+
# renovate: datasource=pypi dependency=uv
30+
version: "0.5.25"
31+
# ubuntu-latest already has Python 3.x installed (pip is needed by the pre-commit action)
32+
- name: Print the installed versions
33+
run: |
34+
echo "Installed uv version is ${{ steps.setup-uv.outputs.uv-version }}"
35+
echo "Installed Python version is $(python --version)"
36+
uv python list
37+
- uses: pre-commit/[email protected]
38+
- name: Run markdownlint
39+
uses: YannickTeKulve/[email protected]
40+
with:
41+
image: davidanson/markdownlint-cli2-rules:v0.17.2
42+
# node user does not have permissions to workspace due to user id mismatch
43+
options: -v ${{ github.workspace }}:/workdir --user root
44+
# use the config file that is stored outside the root for CI specific configuration
45+
# don't fail step if there are violations
46+
run: markdownlint-cli2 --config .github/markdownlint/.markdownlint-cli2.yaml "**/*.md" || true
47+
# Needs to be a public repo in order for uploading SARIF files to work
48+
# https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github
49+
# - uses: github/codeql-action/upload-sarif@v3
50+
# with:
51+
# # Path to SARIF file relative to the root of the repository
52+
# sarif_file: markdownlint-cli2-sarif.sarif
53+
# # Optional category for the results
54+
# # Used to differentiate multiple results for one commit
55+
# category: markdownlint
56+
# fail if there are markdownlint violations
57+
- name: Check markdownlint results
58+
run: |
59+
cat markdownlint-cli2-sarif.sarif | grep -q '"results": \[\]'
60+
61+
62+
build:
63+
runs-on: ubuntu-latest
64+
needs:
65+
- lint
66+
steps:
67+
- uses: actions/[email protected]
68+
with:
69+
# fetch the full git history to be able to determine creation dates for pages
70+
# see: https://github.com/timvink/mkdocs-git-revision-date-localized-plugin?tab=readme-ov-file#note-when-using-build-environments
71+
fetch-depth: 0
72+
- uses: astral-sh/[email protected]
73+
id: setup-uv
74+
with:
75+
# renovate: datasource=pypi dependency=uv
76+
version: "0.5.25"
77+
python-version: 3.13
78+
- name: Print the installed versions
79+
run: |
80+
echo "Installed uv version is ${{ steps.setup-uv.outputs.uv-version }}"
81+
echo "Installed Python version is $(python --version)"
82+
uv python list
83+
- name: Install dependencies
84+
run: uv pip install -r requirements.txt
85+
- uses: actions/[email protected]
86+
with:
87+
# weekly cache
88+
key: mkdocs-material-$(date --utc '+%V')
89+
path: .cache
90+
restore-keys: |
91+
mkdocs-material-
92+
- name: Build site
93+
run: mkdocs build --strict

.github/workflows/deploy.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: deploy
2+
3+
on:
4+
workflow_run:
5+
workflows: [ci]
6+
branches:
7+
- main
8+
types:
9+
- completed
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: deploy
14+
cancel-in-progress: true
15+
16+
jobs:
17+
deploy:
18+
runs-on: ubuntu-latest
19+
# only run if CI workflow completed successfully
20+
# 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
21+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
22+
permissions:
23+
contents: write
24+
environment: pages
25+
steps:
26+
- uses: actions/[email protected]
27+
with:
28+
# fetch the full git history to be able to determine creation dates for pages
29+
# see: https://github.com/timvink/mkdocs-git-revision-date-localized-plugin?tab=readme-ov-file#note-when-using-build-environments
30+
fetch-depth: 0
31+
- name: Configure Git Credentials
32+
# see: https://github.com/actions/checkout#push-a-commit-using-the-built-in-token
33+
run: |
34+
git config user.name github-actions[bot]
35+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
36+
- name: Install uv
37+
uses: astral-sh/[email protected]
38+
id: setup-uv
39+
with:
40+
# renovate: datasource=pypi dependency=uv
41+
version: "0.5.25"
42+
python-version: 3.13
43+
- name: Print the installed versions
44+
run: |
45+
echo "Installed uv version is ${{ steps.setup-uv.outputs.uv-version }}"
46+
echo "Installed Python version is $(python --version)"
47+
uv python list
48+
- name: Install dependencies
49+
run: uv pip install -r requirements.txt
50+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
51+
- uses: actions/[email protected]
52+
with:
53+
key: mkdocs-material-${{ env.cache_id }}
54+
path: .cache
55+
restore-keys: |
56+
mkdocs-material-
57+
- name: Deploy to GitHub Pages
58+
# see: https://squidfunk.github.io/mkdocs-material/publishing-your-site/#with-github-actions
59+
run: mkdocs gh-deploy --strict --force

.gitlab-ci.yml

-75
This file was deleted.

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Opal Documentation
22

3-
[![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)
3+
[![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)
44

55
Project for the Opal documentation site.
66

@@ -9,7 +9,7 @@ Material for MkDocs makes use of [Python Markdown](https://python-markdown.githu
99

1010
In addition, we use the [PlantUML Markdown extension](https://github.com/mikitex70/plantuml-markdown) to render [PlantUML](https://plantuml.com) diagrams.
1111

12-
The documentation site is deployed to GitLab Pages at https://docs.opalmedapps.ca.
12+
The documentation site is deployed to GitHub Pages at https://docs.opalmedapps.com.
1313

1414
## Contributing
1515

mkdocs.yml

+2
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ validation:
175175
unrecognized_links: warn
176176
anchors: warn
177177

178+
strict: true
179+
178180

179181
watch:
180182
- CHANGELOG.md

0 commit comments

Comments
 (0)