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
21 changes: 14 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ name: CI

on:
push:
branches: [main, dev]
branches:
- "feature/**"
- "fix/**"
pull_request:
branches: [main, dev]
branches:
- main
- dev
- "feature/**"
- "fix/**"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -15,12 +21,13 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v9.0.0
with:
python-version: "3.13"
enable-cache: true
save-cache: false
- name: Install dependencies
run: uv sync --all-groups
- name: Lint with ruff
Expand All @@ -37,13 +44,13 @@ jobs:
matrix:
python-version: ["3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v9.0.0
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
- name: Install dependencies
run: uv sync --all-groups
- name: Run tests
run: uv run pytest tests/
run: uv run pytest tests/
24 changes: 24 additions & 0 deletions .github/workflows/dev_policy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Dev PR policy

on:
pull_request:
branches: [dev]

jobs:
require-feature-or-fix-source:
runs-on: ubuntu-latest
steps:
- name: Require source branch to be feature or fix
run: |
if [[ "${{ github.head_ref }}" != feature/* && "${{ github.head_ref }}" != fix/* ]]; then
echo "Pull requests into dev must come from a feature/* or fix/* branch."
echo "Actual source branch: ${{ github.head_ref }}"
exit 1
fi

# Assumes following Github ruleset:
# Target branch: dev
# Restrict deletions
# Require a pull request before merging
# Require status checks to pass
# Block force pushes
23 changes: 12 additions & 11 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ name: Docs

on:
push:
branches: [main]
branches:
- main # only used for deplyoing docs after a PR into main
pull_request:
branches: [main]
branches: [dev, main]

permissions:
contents: read
Expand All @@ -20,13 +21,13 @@ concurrency:
# 2. Source: GitHub Actions (NOT "Deploy from a branch")

jobs:
build:
build-docs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- uses: astral-sh/setup-uv@v5
- uses: astral-sh/setup-uv@v9.0.0
with:
python-version: "3.13"
enable-cache: true
Expand All @@ -38,19 +39,19 @@ jobs:
run: uv run mkdocs build --strict

- name: Upload Pages artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v5
with:
path: site/

deploy:
needs: build
if: github.ref == 'refs/heads/main'
deploy-docs:
needs: build-docs
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v5
24 changes: 24 additions & 0 deletions .github/workflows/main_policy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Main PR policy

on:
pull_request:
branches: [main]

jobs:
require-dev-source:
runs-on: ubuntu-latest
steps:
- name: Require source branch to be dev
run: |
if [ "${{ github.head_ref }}" != "dev" ]; then
echo "Pull requests into main must come from dev."
echo "Actual source branch: ${{ github.head_ref }}"
exit 1
fi

# Assumes following Github ruleset:
# Target branch: main
# Restrict deletions
# Require a pull request before merging
# Require status checks to pass
# Block force pushes
14 changes: 7 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ on:
- "v*"

jobs:
build:
build-release:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
with:
fetch-depth: 0
fetch-tags: true
- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v9.0.0
with:
python-version: "3.13"
- name: Build wheel and sdist
Expand All @@ -26,8 +26,8 @@ jobs:
name: dist
path: dist/

publish:
needs: build
publish-release:
needs: build-release
runs-on: ubuntu-latest
timeout-minutes: 10
environment: pypi
Expand All @@ -43,7 +43,7 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
needs: publish
needs: publish-release
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
Expand All @@ -58,4 +58,4 @@ jobs:
uses: softprops/action-gh-release@v2
with:
files: dist/*
generate_release_notes: true
generate_release_notes: true
2 changes: 1 addition & 1 deletion src/simses/converter/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(self, loss_model: ConverterLossModel, max_power: float, storage: An
storage: Downstream storage exposing ``step(power, dt)`` and
``state.power``. Typically a :class:`Battery`.
tolerance: Relative difference between requested and
actual DC power above which AC power is re-calculated
actual DC power above which AC power is re-calculated.
"""
self.max_power = max_power
self.state = ConverterState()
Expand Down