Skip to content
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
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2

updates:
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 2
commit-message:
prefix: "build"
include: "scope"
rebase-strategy: "auto"
- package-ecosystem: github-actions
directory: /
commit-message:
prefix: "build"
include: "scope"
rebase-strategy: "auto"
schedule:
interval: "weekly"
19 changes: 19 additions & 0 deletions .github/labeler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
dependencies:
- changed-files:
- any-glob-to-any-file: "uv.lock"

github_actions:
- changed-files:
- any-glob-to-any-file: ".github/**"

docs:
- changed-files:
- any-glob-to-any-file: "**/*.md"

release:
- changed-files:
- any-glob-to-any-file: "CHANGELOG.md"

tests:
- changed-files:
- any-glob-to-any-file: "tests/**"
140 changes: 72 additions & 68 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,100 +2,104 @@ name: CI

on:
push:
branches: [main]
pull_request:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
env:
DEFAULT_PYTHON: "3.12"
DEFAULT_OS: ubuntu-latest
UV_VERSION: "0.9.4"

jobs:
pre-commit:
runs-on: ubuntu-latest
name: Pre-commit hooks (lint/format/spell/type, all files)
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version-file: "pyproject.toml"

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
version: ${{ env.UV_VERSION }}

- name: Install dependencies
run: uv sync --all-groups

- name: Run pre-commit
run: uv run pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage push


pytest:
name: Tests ${{ matrix.os }} / py${{ matrix.python }}
needs: pre-commit
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
os: [ubuntu-latest, windows-latest]
plexos-version: ["v9.2R6", "v10.0R2", "v11.0R4"]
permissions:
pull-requests: write
contents: write
needs: [pre-commit, mypy, ruff]

runs-on: ${{ matrix.os }}
python: ["3.11", "3.12", "3.13", "3.14"]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
version: ${{ env.UV_VERSION }}

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python }}
run: uv python install ${{ matrix.python }}

- name: Installing dependencies
run: uv sync --dev
- name: Install dependencies
run: uv sync --all-groups

- name: Running package tests
run: |
uv run pytest -vvl --cov --cov-report=xml -k ${{ matrix.plexos-version }}
uv run pytest --cov --cov-report=xml

- name: codecov
uses: codecov/codecov-action@v4.2.0
if: ${{ matrix.os == env.DEFAULT_OS && matrix.python-version == env.DEFAULT_PYTHON && matrix.plexos-version == 'v11.0R4' }}
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: r2x-test
fail_ci_if_error: false
verbose: true

pre-commit:
package:
name: Package smoke test
needs: pytest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Set up pinned Python version
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Checkout
uses: actions/checkout@v6

- name: Installing dependencies
run: uv sync --dev
- name: Run pre-commit
run: |
uv run pre-commit run --all-files

mypy:
runs-on: ubuntu-latest
name: "mypy"
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version-file: "pyproject.toml"
- name: Installing dependencies
run: uv sync --dev
- name: Run mypy
run: |
uv run mypy --config-file=pyproject.toml src/

ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Set up Python
uses: actions/setup-python@v5
uses: astral-sh/setup-uv@v7
with:
python-version-file: "pyproject.toml"
- name: Installing dependencies
run: uv sync --dev
- name: Run Ruff
run: uv run ruff check --output-format=github src/
version: ${{ env.UV_VERSION }}
enable-cache: true

- name: Install dependencies
run: uv sync --all-groups

- name: Build and install wheel
run: |
uv build
python -m venv pkgtest
source pkgtest/bin/activate
python -m pip install --upgrade pip
python -m pip install dist/*.whl
python -c "import plexosdb as m; print(getattr(m, '__version__', 'OK'))"
46 changes: 46 additions & 0 deletions .github/workflows/commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: on-commit

on:
pull_request:
types: [opened, reopened, synchronize]

jobs:
labeler:
name: apply labels
permissions:
contents: read
pull-requests: write
issues: write
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v6
- uses: actions/labeler@v6.0.1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: .github/labeler.yaml
sync-labels: true

lint-commit-messages:
name: lint commit message
runs-on: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Commitizen check
run: |
uvx --from commitizen cz check --rev-range HEAD^!
lint-pr-title:
# default: lints titles using https://github.com/commitizen/conventional-commit-types
name: lint pr title
runs-on: [ubuntu-latest]
permissions:
pull-requests: read
steps:
- uses: amannn/action-semantic-pull-request@v6.1.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: "Set up Python"
uses: actions/setup-python@v5
uses: astral-sh/setup-uv@v7
with:
python-version-file: "pyproject.toml"
version: "latest"

- name: Install the project
run: uv sync --group docs

- name: Generate docstring coverage badge
run: uv run docstr-coverage src --badge docs/source/_static

- name: Build Sphinx documentation
run: uv run sphinx-build docs/source/ docs/build/
run: uv run sphinx-build docs/source/ docs/_build/

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/
publish_dir: docs/_build/
force_orphan: true
Loading