From 2e4ff76d3643b90457b2fd50bfa22f54cd03c8e6 Mon Sep 17 00:00:00 2001 From: John Mikos Date: Tue, 9 Dec 2025 12:19:34 +0000 Subject: [PATCH 1/4] chore: allow workflow to publish to test locations Co-authored-by: Shane Dowling --- .github/workflows/publish.yaml | 27 +++++++++++++++++---------- Makefile | 15 ++++++++++----- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index f3f5da8..58fba25 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -3,6 +3,13 @@ name: "Publish package and documentation" on: release: types: ["published"] + workflow_dispatch: + inputs: + is_test: + description: 'Indicates that the run should publish to the test repositories' + required: false + type: boolean + default: false jobs: packages: @@ -22,16 +29,16 @@ jobs: with: enable-cache: true - - name: Build - run: uv build + - name: Build package + run: make build - - name: Publish RC packages to PyPI Test - if: contains(github.event.release.tag_name, '-rc') + - name: Publish packages to PyPI Test + if: ${{ github.event.inputs.run_deploy == 'true' }} run: | uv publish --index testpypi --token ${{ secrets.TEST_PYPI_TOKEN }} - name: Publish release packages to PyPI - if: ${{ ! contains(github.event.release.tag_name, '-rc') }} + if: ${{ github.event.inputs.run_deploy == 'false' }} run: uv publish --token ${{ secrets.PYPI_TOKEN }} docs: @@ -50,10 +57,10 @@ jobs: enable-cache: true - name: Generate docs - run: make install generate-docs + run: make generate-docs - - name: Publish RC docs - if: contains(github.event.release.tag_name, '-rc') + - name: Publish release docs to test location + if: ${{ github.event.inputs.run_deploy == 'true' }} uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} @@ -61,8 +68,8 @@ jobs: # this puts the docs for this tag under gh-pages:/rc// destination_dir: rc/${{ github.event.release.tag_name }} - - name: Publish release docs - if: ${{ ! contains(github.event.release.tag_name, '-rc') }} + - name: Publish release docs to production location + if: ${{ github.event.inputs.run_deploy == 'false' }} uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index 98b8f84..d5bd0b7 100644 --- a/Makefile +++ b/Makefile @@ -1,25 +1,30 @@ UV_PYTHON ?= 3.12 -.PHONY: help install test lint fmt generate-docs build-and-load-configure image build-and-load-system-test-image +.PHONY: build help install test lint fmt generate-docs build-and-load-configure image build-and-load-system-test-image help: # Show help for each of the Makefile recipes. @grep -E '^[a-zA-Z0-9 -]+:.*#' Makefile | sort | while read -r l; do printf "\033[1;34m$$(echo $$l | cut -f 1 -d':')\033[00m:$$(echo $$l | cut -f 2- -d'#')\n"; done install: # install dependencies for running tests and linting uv python install + +dev: install # Install development/release dependencies uv sync --extra dev -test: install # run tests +build: install # build package + uv build + +test: install dev # run tests uv run --isolated --with-editable '.[dev]' pytest -lint: install # run linting checks +lint: install dev # run linting checks uv run ruff check kratix_sdk tests uv run ruff format --check kratix_sdk tests -fmt: install # run code formatter +fmt: install dev # run code formatter uv run ruff format kratix_sdk tests -generate-docs: install # create API documentation +generate-docs: install dev # create API documentation uv run pdoc src/kratix_sdk -o docs build-and-load-configure-image: # build example docker image and load it into kind From 1d6705ede3fecabb8701200afca49f3098aa933d Mon Sep 17 00:00:00 2001 From: John Mikos Date: Tue, 9 Dec 2025 12:21:07 +0000 Subject: [PATCH 2/4] chore: removed UV_PYTHON as we have .python-version Co-authored-by: Shane Dowling --- Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Makefile b/Makefile index d5bd0b7..87024ef 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,3 @@ -UV_PYTHON ?= 3.12 - .PHONY: build help install test lint fmt generate-docs build-and-load-configure image build-and-load-system-test-image help: # Show help for each of the Makefile recipes. From 342ac46ee600f2bee666d9baed0f0092b6806dbf Mon Sep 17 00:00:00 2001 From: John Mikos Date: Tue, 9 Dec 2025 12:25:34 +0000 Subject: [PATCH 3/4] chore: being more conservative about when to run - run when there is a PR based on main - run when there is a push to main (that is, PR merged or direct push) Co-authored-by: Shane Dowling --- .github/workflows/test.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 90e2bf8..17dcae2 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -2,6 +2,11 @@ name: test on: push: + branches: + - main + pull_request: + branches: + - main workflow_dispatch: jobs: From d9813c2eec21a9207a964d20a7880ad27c9abdd8 Mon Sep 17 00:00:00 2001 From: John Mikos Date: Tue, 9 Dec 2025 12:27:27 +0000 Subject: [PATCH 4/4] chore: renamed workflow to follow pattern Co-authored-by: Shane Dowling --- .github/workflows/publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 58fba25..d461342 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -1,4 +1,4 @@ -name: "Publish package and documentation" +name: publish-packages-and-docs on: release: