Skip to content
Open
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
26 changes: 24 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,39 @@ jobs:
files: coverage.xml
fail_ci_if_error: false

docs:
name: Docs build
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v6

- uses: astral-sh/setup-uv@v7
with:
enable-cache: true

- uses: actions/setup-python@v6
with:
python-version: "3.12"

- name: Install dependencies
run: uv sync --extra docs

- name: Build docs
run: uv run mkdocs build --strict

ci-success:
name: CI Success
needs: [lint, typecheck, test]
needs: [lint, typecheck, test, docs]
if: always()
runs-on: ubuntu-24.04
steps:
- name: Check all jobs passed
run: |
if [[ "${{ needs.lint.result }}" != "success" || \
"${{ needs.typecheck.result }}" != "success" || \
"${{ needs.test.result }}" != "success" ]]; then
"${{ needs.test.result }}" != "success" || \
"${{ needs.docs.result }}" != "success" ]]; then
echo "::error::One or more CI jobs failed"
exit 1
fi
2 changes: 1 addition & 1 deletion .github/workflows/pr-title.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: ['release-please--**']
pull_request:
types: [opened, edited, synchronize, reopened]
types: [opened, edited, reopened]

jobs:
validate:
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Publish

on:
push:
tags: ["v*"]
workflow_call:
inputs:
tag:
required: true
type: string

concurrency:
group: publish-${{ inputs.tag || github.ref_name }}
cancel-in-progress: false

permissions:
contents: write
id-token: write
attestations: write

jobs:
publish:
name: Build & publish to PyPI
runs-on: ubuntu-24.04
timeout-minutes: 10
environment:
name: pypi
url: https://pypi.org/project/fluxopt_plot
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref_name }}
fetch-depth: 0

- uses: astral-sh/setup-uv@v7
with:
enable-cache: true

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Build
run: uv build

- uses: pypa/gh-action-pypi-publish@release/v1

github-release:
name: Create GitHub Release
needs: [publish]
if: github.event_name == 'push' && needs.publish.result == 'success'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}

- name: Create GitHub Release
run: |
if gh release view "$TAG" &>/dev/null; then
echo "Release $TAG already exists, skipping."
exit 0
fi
if [[ "$TAG" == *-* ]]; then
gh release create "$TAG" --generate-notes --prerelease
else
gh release create "$TAG" --generate-notes
fi
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
53 changes: 6 additions & 47 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@ name: Release
on:
push:
branches: [main]
workflow_dispatch:
inputs:
branch:
description: Branch to create the release from
required: true
default: main
prerelease:
description: Create a pre-release
type: boolean
default: true

permissions:
contents: write
Expand All @@ -26,7 +16,7 @@ jobs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: actions/create-github-app-token@v3
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ secrets.APP_ID }}
Expand All @@ -35,48 +25,17 @@ jobs:
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ steps.app-token.outputs.token }}
config-file: .release-please-config.json
manifest-file: .release-please-manifest.json
token: ${{ steps.app-token.outputs.token }}
target-branch: ${{ inputs.branch || github.ref_name }}
prerelease: ${{ inputs.prerelease }}

publish:
name: Build & publish to PyPI
needs: [release-please]
needs: release-please
if: needs.release-please.outputs.release_created
runs-on: ubuntu-24.04
timeout-minutes: 10
environment:
name: pypi
url: https://pypi.org/project/fluxopt_plot
permissions:
id-token: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- uses: astral-sh/setup-uv@v7
with:
enable-cache: true

- uses: actions/setup-python@v6
with:
python-version: "3.12"

- name: Build
run: uv build

- uses: pypa/gh-action-pypi-publish@release/v1

deploy-docs:
name: Deploy docs
needs: [release-please, publish]
if: needs.release-please.outputs.release_created
permissions:
contents: write
uses: ./.github/workflows/docs.yaml
attestations: write
uses: ./.github/workflows/publish.yaml
with:
deploy: true
version: ${{ needs.release-please.outputs.tag_name }}
tag: ${{ needs.release-please.outputs.tag_name }}
18 changes: 18 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2

mkdocs:
configuration: mkdocs.yml

build:
os: ubuntu-24.04
tools:
python: "3.13"
jobs:
pre_create_environment:
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
create_environment:
- uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
install:
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --group docs
Loading