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
6 changes: 3 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@

## Validation
<!-- Choose from the relevant commands below and list what you actually ran. If a relevant check was skipped, explain why. -->
<!-- Common options: make check, make test, make coverage, make test-e2e, make docs-build, make convert-notebooks -->
<!-- Common options: mise run check ::: test, mise run test:coverage, mise run test:e2e, mise run docs:build, mise run notebooks:execute -->
- Commands run:
- Skipped checks or known failures:

## Documentation and Artifacts
- [ ] Docs updated, or not needed
- [ ] If docs changed: `make docs-build` passes locally
- [ ] If tutorial sources changed: notebooks regenerated with `make convert-notebooks`
- [ ] If docs changed: `mise run docs:build` passes locally
- [ ] If tutorial sources changed: notebooks regenerated with `mise run notebooks:execute`
- [ ] If e2e, benchmark, or model-provider behavior changed: relevant validation is listed above
34 changes: 26 additions & 8 deletions .github/actions/setup-python-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

name: "Setup Python Environment"
description: "Common setup for Python projects: checkout, uv, Python, and dependencies"
description: "Common setup for Python projects: checkout, mise, Python, and dependencies"

inputs:
ref:
Expand All @@ -28,6 +28,14 @@ inputs:
description: "Number of commits to fetch (0 for all history)"
required: false
default: "1"
checkout:
description: "Whether to checkout the repository before setting up the environment"
required: false
default: "true"
dependency-profile:
description: "Locked dependency profile to sync: runtime, dev, docs, or notebooks"
required: false
default: "dev"

outputs:
merge-base:
Expand All @@ -38,14 +46,15 @@ runs:
using: "composite"
steps:
- name: Checkout repository
if: inputs.checkout == 'true'
uses: actions/checkout@v6
with:
ref: ${{ inputs.ref || github.ref }}
fetch-depth: ${{ inputs.fetch-depth }}

- name: Get the merge base SHA
id: get_merge_base
if: inputs.fetch-depth == '0'
if: inputs.checkout == 'true' && inputs.fetch-depth == '0'
shell: bash
run: |
if [ -n "${{ github.base_ref }}" ]; then
Expand All @@ -58,12 +67,6 @@ runs:
echo "Merge Base SHA: $MERGE_BASE_SHA"
echo "merge_base=$MERGE_BASE_SHA" >> $GITHUB_OUTPUT

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
# version is parsed from pyproject.toml
enable-cache: true

- name: Set up Python ${{ inputs.python-version }}
if: inputs.python-version != ''
uses: actions/setup-python@v6
Expand All @@ -75,3 +78,18 @@ runs:
uses: actions/setup-python@v6
with:
python-version-file: ".python-version"

- name: Install mise and project tools
env:
MISE_REQUIRE_SIGNED_INSTALL: "1"
shell: bash
run: |
MISE_GPG_KEY=24853EC9F655CE80B48E6C3A8B81C9D17413A06D \
bash tools/install-mise.sh
export PATH="$HOME/.local/bin:$HOME/.local/share/mise/shims:$PATH"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "$HOME/.local/share/mise/shims" >> "$GITHUB_PATH"
if [ -n "${{ inputs.python-version }}" ]; then
export UV_PYTHON="${{ inputs.python-version }}"
fi
MISE_YES=1 mise run setup "${{ inputs.dependency-profile }}" --no-hooks
31 changes: 15 additions & 16 deletions .github/workflows/benchmark-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,26 @@ jobs:
timeout-minutes: 120

steps:
- name: Checkout workflow revision
uses: actions/checkout@v6

- uses: ./.github/actions/setup-python-env
with:
checkout: "false"
python-version: "3.11"

- name: Checkout benchmark target
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
ref: ${{ env.BENCHMARK_REF }}
fetch-depth: "0"
path: benchmark-target

- name: Resolve benchmark target commit
id: target
working-directory: benchmark-target
run: echo "commit=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"

- name: Install dependencies
run: uv sync --group dev

- name: Check NVIDIA API key
env:
NVIDIA_API_KEY: ${{ secrets.NVIDIA_API_KEY }}
Expand All @@ -96,6 +93,7 @@ jobs:
fi

- name: Run benchmark suite
working-directory: benchmark-target
env:
NVIDIA_API_KEY: ${{ secrets.NVIDIA_API_KEY }}
run: |
Expand All @@ -114,7 +112,7 @@ jobs:
FAIL_FAST_ARGS+=(--fail-fast)
fi

uv run python tools/measurement/run_benchmarks.py \
uv run --locked python tools/measurement/run_benchmarks.py \
"$BENCHMARK_SUITE" \
--output "$BENCHMARK_OUTPUT_DIR" \
--overwrite \
Expand All @@ -124,6 +122,7 @@ jobs:

- name: Add benchmark summary
if: always()
working-directory: benchmark-target
env:
BENCHMARK_COMMIT: ${{ steps.target.outputs.commit }}
run: |
Expand Down Expand Up @@ -170,5 +169,5 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: anonymizer-benchmark-${{ steps.target.outputs.commit }}
path: ${{ env.BENCHMARK_OUTPUT_DIR }}/
path: benchmark-target/${{ env.BENCHMARK_OUTPUT_DIR }}/
if-no-files-found: warn
13 changes: 6 additions & 7 deletions .github/workflows/build-notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ jobs:
NVIDIA_API_KEY: ${{ secrets.NVIDIA_API_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install uv
uses: astral-sh/setup-uv@v6
uses: actions/checkout@v6
- uses: ./.github/actions/setup-python-env
with:
version: "0.9.5"
- name: Set up Python
run: uv python install 3.11
checkout: "false"
python-version: "3.11"
dependency-profile: "notebooks"
- name: Convert and execute notebooks
run: make convert-notebooks
run: mise run notebooks:execute
- name: Upload notebooks as artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
31 changes: 20 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ env:
DEFAULT_PYTHON_VERSION: "3.11"

jobs:
benchmark-task-shell:
name: Benchmark task (macOS Bash 3.2)
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Test benchmark task
run: bash tests/tools/test_benchmark_task.sh

test:
name: Test
runs-on: ubuntu-latest
Expand All @@ -32,14 +42,12 @@ jobs:

- uses: ./.github/actions/setup-python-env
with:
checkout: "false"
fetch-depth: "0"
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --group dev

- name: Run tests with coverage
run: make coverage
run: mise run test:coverage

check:
name: Check
Expand All @@ -53,20 +61,21 @@ jobs:

- uses: ./.github/actions/setup-python-env
with:
checkout: "false"
fetch-depth: "0"
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}

- name: Install dependencies
run: uv sync --group dev
- name: Check formatting
run: mise run check:format

- name: Check format and lint
run: make format-check
- name: Check lint rules
run: mise run check:lint

- name: Run type checks
run: make typecheck
run: mise run check:type

- name: Check uv.lock is up to date
run: make lock-check
run: mise run check:lock

- name: Check copyright headers
run: make copyright-check
run: mise run check:license:headers
26 changes: 16 additions & 10 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,21 @@ on:
- "mkdocs.yml"
- "src/**"
- ".github/workflows/docs.yml"
- ".github/actions/setup-python-env/action.yml"
- ".mise.toml"
- "mise.lock"
- ".mise/tasks/**"
pull_request:
branches: [main]
paths:
- "docs/**"
- "mkdocs.yml"
- "src/**"
- ".github/workflows/docs.yml"
- ".github/actions/setup-python-env/action.yml"
- ".mise.toml"
- "mise.lock"
- ".mise/tasks/**"
workflow_dispatch:
release:
types: [published]
Expand Down Expand Up @@ -48,22 +56,21 @@ jobs:

- uses: ./.github/actions/setup-python-env
with:
checkout: "false"
fetch-depth: "0"

- name: Install docs dependencies
run: uv sync --group dev --group docs
dependency-profile: "docs"

- name: Configure git for mike
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Build docs
run: make docs-build
run: mise run docs:build

- name: Deploy docs with mike
if: github.event_name == 'push'
run: uv run --group docs mike deploy --push --update-aliases dev
run: uv run --locked --group docs mike deploy --push --update-aliases dev

deploy-release:
if: github.event_name == 'release'
Expand All @@ -78,10 +85,9 @@ jobs:

- uses: ./.github/actions/setup-python-env
with:
checkout: "false"
fetch-depth: "0"

- name: Install docs dependencies
run: uv sync --group dev --group docs
dependency-profile: "docs"

- name: Download notebook artifacts
uses: actions/download-artifact@v5
Expand All @@ -95,9 +101,9 @@ jobs:
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Build docs
run: make docs-build
run: mise run docs:build

- name: Deploy release docs with mike
run: |
VERSION=$(echo "${{ github.event.release.tag_name }}" | sed 's/^v//' | sed 's/ .*$//')
uv run --group docs mike deploy --push --update-aliases "$VERSION" latest
uv run --locked --group docs mike deploy --push --update-aliases "$VERSION" latest
22 changes: 8 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,15 @@ jobs:
fetch-depth: 0
fetch-tags: true

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true

- name: Set up Python
uses: actions/setup-python@v6
- uses: ./.github/actions/setup-python-env

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we keep the workflow revision checked out while this local action runs, then check out release-ref into a separate directory like benchmark-ci.yml does? Right now the action comes from release-ref, so older tags use the old setup action: checkout: "false" is ignored, the workspace switches back to github.ref, and Mise never gets installed. Historical releases therefore fail at the build step, and the docs job has the same issue.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in stacked follow-up #249. Instead of adding a second release checkout, it follows Safe Synthesizer’s tag-push strategy: pushed v* tags run the full production release from the triggering revision, while workflow_dispatch remains available with dry-run and create-gh-release controls but no release-ref input. Every job uses its ordinary checkout ref, so workflow orchestration, setup, build, and docs stay on one revision. The focused workflow suite passes (21 tests), the full local gate passes (1,212 tests), and the strict docs build passes. I am leaving this thread open until the stacked follow-up lands.

with:
python-version-file: ".python-version"
checkout: "false"
dependency-profile: "runtime"

- name: Build wheel
id: build
run: |
make build-wheel
mise run build:wheel
WHEEL=$(ls dist/*.whl)
VERSION=$(echo "$WHEEL" | sed -n 's/.*-\([0-9][^-]*\)-.*/\1/p')
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -149,21 +144,20 @@ jobs:

- uses: ./.github/actions/setup-python-env
with:
checkout: "false"
ref: ${{ inputs.release-ref }}
fetch-depth: "0"

- name: Install docs dependencies
run: uv sync --group dev --group docs
dependency-profile: "docs"

- name: Configure git for mike
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Build docs
run: make docs-build
run: mise run docs:build

- name: Deploy release docs with mike
env:
VERSION: ${{ needs.publish-wheel.outputs.version }}
run: uv run --group docs mike deploy --push --update-aliases "$VERSION" latest
run: uv run --locked --group docs mike deploy --push --update-aliases "$VERSION" latest
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ ipython_config.py
.uv/
uv.lock.bak

# mise local overrides
.mise.local.toml
mise.local.toml
mise.*.local.toml
!.mise/tasks/build/
!.mise/tasks/build/**

# Environments
.env
.env.*
Expand Down
Loading
Loading