-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add semantic release to CI/CD (#26)
algokit cli is now part of poetry CICD group so that it's included in cache and to simplify steps algokit localnet stop command has been removed to speed things up a tiny bit minor tweaks to reduce coverage comment size --------- Co-authored-by: Adam Chidlow <[email protected]>
- Loading branch information
1 parent
2982680
commit f32e760
Showing
7 changed files
with
1,045 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
name: Continuous Delivery of Python package | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
inputs: | ||
run_checks: | ||
description: "Run checks?" | ||
type: boolean | ||
required: true | ||
default: true | ||
production_release: | ||
description: "Production release?" | ||
type: boolean | ||
|
@@ -19,13 +21,8 @@ permissions: | |
packages: read | ||
|
||
jobs: | ||
ci-check-python: | ||
name: Check Python | ||
uses: ./.github/workflows/check-python.yaml | ||
|
||
release: | ||
name: Release Library | ||
needs: ci-check-python | ||
runs-on: ubuntu-latest | ||
permissions: | ||
# IMPORTANT: this permission is mandatory for trusted publishing | ||
|
@@ -49,7 +46,16 @@ jobs: | |
cache: "poetry" | ||
|
||
- name: Install dependencies | ||
run: poetry install --no-interaction --no-root | ||
run: poetry install --no-interaction --with cicd | ||
|
||
- name: pre-commit and pytest | ||
if: inputs.run_checks | ||
run: | | ||
set -o pipefail | ||
source $(poetry env info --path)/bin/activate | ||
pre-commit run --all-files && git diff --exit-code | ||
algokit localnet start | ||
pytest | ||
- name: Get branch name | ||
shell: bash | ||
|
@@ -59,11 +65,21 @@ jobs: | |
- name: Set Git user as GitHub actions | ||
run: git config --global user.email "[email protected]" && git config --global user.name "github-actions" | ||
|
||
- name: Create Continuous Deployment - Production | ||
- name: Update release - Production | ||
if: steps.get_branch.outputs.branch == 'main' && inputs.production_release | ||
run: | | ||
poetry build --format wheel | ||
run: semantic-release version | ||
|
||
- name: Update release - Prerelease | ||
if: steps.get_branch.outputs.branch == 'main' && !inputs.production_release | ||
run: semantic-release version --prerelease | ||
|
||
- name: Create Wheel | ||
run: poetry build --format wheel | ||
|
||
- name: Publish to GitHub | ||
if: steps.get_branch.outputs.branch == 'main' | ||
run: semantic-release publish | ||
|
||
- name: Publish package distributions to PyPI | ||
- name: Publish to PyPI | ||
if: steps.get_branch.outputs.branch == 'main' && inputs.production_release | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
f32e760
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage Report