diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index f3f5da8..d461342 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -1,8 +1,15 @@ -name: "Publish package and documentation" +name: publish-packages-and-docs 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/.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: diff --git a/Makefile b/Makefile index 98b8f84..87024ef 100644 --- a/Makefile +++ b/Makefile @@ -1,25 +1,28 @@ -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