Skip to content
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

Configure CI workflows #13

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# TOPSTSCHOOL Sphinx (Documentation) Deployment Workflow
# ======================================================
#
# Author: Akshay Mestry <[email protected]>
# Created on: Sunday, October 27 2024
# Last updated on: Sunday, October 27 2024

name: deployment
run-name: Auto-started ${{ github.workflow }} after linting

on:
workflow_run:
workflows: [linting]
types: [completed]
branches: [$default-branch]

permissions:
contents: write

env:
ARTIFACTNAME: topstschool-pages
BUILDDIR: docs/build/
SOURCEDIR: docs/source
PYTHONVERSION: 3.12.1

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: build
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
with:
fetch-depth: 1
- name: Setup
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHONVERSION }}
cache: pip
- name: Build pages with Sphinx
id: build
run: |
echo "Clean installing latest version of sphinx and other runtime dependencies..."
python -m pip install -Uq pip -rrequirements.txt
echo "Building documentation pages..."
sphinx-build -EWqa --builder html ${{ env.SOURCEDIR }} ${{ env.BUILDDIR }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
name: ${{ env.ARTIFACTNAME }}
path: ${{ env.BUILDDIR }}
deploy:
name: deploy
needs: build
permissions:
contents: read
pages: write
id-token: write
environment:
name: canary
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: ${{ env.ARTIFACTNAME }}
45 changes: 45 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# TOPSTSCHOOL Sphinx (Documentation) Document & Code Linting Workflow
# ==================================================================
#
# Author: Akshay Mestry <[email protected]>
# Created on: Sunday, October 27 2024
# Last updated on: Thursday, October 31 2024

name: linting
run-name: Linting initiated after ${{ github.actor }}'s actions

on:
pull_request:
paths:
- 'docs/**'
- 'requirements*'

permissions:
contents: read

env:
SOURCEDIR: docs/source
PYTHONVERSION: 3.12.1

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
name: linting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
- name: Setup
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHONVERSION }}
cache: pip
- name: Analyze
id: linting
run: |
python -m pip install -Uq pip -rrequirements-dev.txt
echo "Checking code for issues..."
flake8 "$_" && sphinx-lint "$_"