Skip to content

Commit

Permalink
refactor: Update CI workflow for code quality checks and documentatio…
Browse files Browse the repository at this point in the history
…n build
  • Loading branch information
MountainGod2 committed Nov 2, 2024
1 parent 9b9f24b commit 432606e
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,67 +12,65 @@ on:

jobs:
ci:
name: Run Tests, Linting, and Build Documentation
name: CI - Code Quality and Documentation Build
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11, 3.12, 3.13]
fail-fast: true
timeout-minutes: 20
env:
UV_CACHE_DIR: /tmp/uv-cache-${{ matrix.python-version }}

steps:
- name: Checkout Repository
- name: Setup | Checkout Repository
uses: actions/[email protected]
with:
fetch-depth: 0
persist-credentials: false

- name: Set up UV Environment
- name: Setup | UV Environment
uses: astral-sh/[email protected]
with:
enable-cache: true
cache-dependency-glob: uv.lock

- name: Restore UV Cache
- name: Cache UV Dependencies
uses: actions/[email protected]
with:
path: /tmp/.uv-cache-${{ matrix.python-version }}
path: ${{ env.UV_CACHE_DIR }}
key: "uv-${{ matrix.python-version }}-${{ runner.os }}-${{ hashFiles('uv.lock') }}"
restore-keys: |
uv-${{ matrix.python-version }}-${{ runner.os }}
- name: Install Dependencies and Sync Project
env:
UV_CACHE_DIR: /tmp/.uv-cache-${{ matrix.python-version }}
- name: Install and Sync Dependencies
run: uv sync

- name: Run Formatting, Linting, Type Checks, and Tests
env:
UV_CACHE_DIR: /tmp/.uv-cache-${{ matrix.python-version }}
- name: Run Code Quality Checks (Formatting, Linting, Type Checks, Tests)
run: |
uv run ruff format ./
uv run ruff check --fix ./
uv run mypy ./
uv run pytest ./
- name: Build Documentation
env:
UV_CACHE_DIR: /tmp/.uv-cache-${{ matrix.python-version }}
if: matrix.python-version == '3.11'
run: uv run --group=docs make clean html --directory docs/

- name: Upload Documentation to GitHub Pages
- name: Deploy Documentation to GitHub Pages
if: success() && matrix.python-version == '3.11'
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html

- name: Scan with SonarCloud
- name: Scan Codebase with SonarCloud
if: matrix.python-version == '3.11'
uses: SonarSource/[email protected]
env:
SONAR_TOKEN: '${{ secrets.SONAR_TOKEN }}'

- name: Upload Test Coverage to Codecov
- name: Upload Test Coverage Report to Codecov
if: success() && matrix.python-version == '3.11'
uses: codecov/[email protected]
with:
Expand All @@ -81,6 +79,4 @@ jobs:
fail_ci_if_error: true

- name: Minimize UV Cache
env:
UV_CACHE_DIR: /tmp/.uv-cache-${{ matrix.python-version }}
run: uv cache prune --ci

0 comments on commit 432606e

Please sign in to comment.