feat(onboarding): small improvements and fixes #57
This file contains 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: 2024 Margo | |
# | |
# SPDX-License-Identifier: MIT | |
# | |
# Author: Christian Storm <[email protected]> | |
# Author: Silvano Cirujano Cuesta <[email protected]> | |
--- | |
name: GitHub Pages | |
on: [push, pull_request, workflow_dispatch] | |
permissions: | |
contents: write | |
jobs: | |
quality-checks: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Check pyproject.toml and poetry.lock | |
run: poetry check | |
validate: | |
needs: | |
- quality-checks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Ensure tags if not run from main repo | |
if: github.repository != 'margo/specification' | |
run: | | |
git remote add upstream https://github.com/margo/specification | |
git fetch upstream --tags | |
- name: Install poetry | |
run: pipx install poetry | |
- uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: '3.12' | |
cache: 'poetry' | |
- name: Install dependencies | |
run: poetry install --no-interaction --all-extras | |
- name: Run tests | |
run: | | |
doc-generation/check-examples.bash | |
documents: | |
needs: | |
- quality-checks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Ensure tags if not run from main repo | |
if: github.repository != 'margo/specification' | |
run: | | |
git remote add upstream https://github.com/margo/specification | |
git fetch upstream --tags | |
- name: Install poetry | |
run: pipx install poetry | |
- uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: '3.12' | |
cache: 'poetry' | |
- name: Install dependencies | |
run: poetry install --no-interaction --all-extras | |
- name: Generate MarkDown documentation | |
run: | | |
doc-generation/generate-documentation.bash | |
- name: Share generated documentation with later jobs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: generated-documentation | |
path: | | |
system-design/app-interoperability/application-package-definition.md | |
system-design/margo-api-reference/workload-api/desired-state-api/desired-state.md | |
pages: | |
needs: | |
- validate | |
- documents | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
- name: Install poetry | |
uses: abatilo/actions-poetry@v2 | |
# create local virtualenv to enable caching in CI | |
- name: Configure poetry | |
run: | | |
poetry config virtualenvs.create true --local | |
poetry config virtualenvs.in-project true --local | |
- name: Setup Cache | |
uses: actions/cache@v4 | |
with: | |
path: ./.venv | |
# cache is invalidated if dependencies change | |
key: venv-${{ hashFiles('poetry.lock') }} | |
- name: Install the project dependencies | |
run: poetry install | |
- name: Get generated documentation from previous jobs | |
uses: actions/download-artifact@v4 | |
with: | |
name: generated-documentation | |
path: system-design/ | |
- name: Build Pages | |
run: poetry run -- mkdocs build | |
- name: GitHub Pages Deploy | |
# only deploy if we are on the default branch | |
if: ${{ github.ref == 'refs/heads/pre-draft' }} | |
run: poetry run -- mkdocs gh-deploy --force --clean --verbose | |
- name: Upload pages | |
uses: actions/upload-artifact@v4 | |
if: ${{ github.ref != 'refs/heads/pre-draft' }} | |
with: | |
name: margo-specification | |
path: site | |
retention-days: 5 |