Skip to content

Commit

Permalink
Merge branch 'main' into package-without-editable-flag
Browse files Browse the repository at this point in the history
  • Loading branch information
VukW committed Apr 29, 2024
2 parents 872cc66 + 55f5f2e commit 49dc914
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 3 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/check-version-increase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Check version increase

on:
pull_request:
branches: [ main ]

jobs:
extract-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract package version
id: extract_version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python -m pip install packaging
new_version=$(python3 -c "exec(open('./cli/medperf/_version.py').read()); print(__version__)")
echo "version found: [$new_version]"
echo "latest release:"
gh release list --repo ${{ github.repository }} | head -n 1
latest_version=$(gh release list --repo ${{ github.repository }} | head -n 1 | awk '{print $1}')
echo "latest version found: [$latest_version]"
if [ -z "$latest_version" ]; then
latest_version="0.0.0"
fi
echo "latest version found: [$latest_version]"
python3 -c "from packaging.version import parse; assert parse('$new_version') >= parse('$latest_version'), 'New version must be greater than the latest version'"
98 changes: 98 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Release Workflow

on:
push:
branches:
- main

jobs:
extract-version:
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.extract_version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Extract package version
id: extract_version
run: |
version=$(python3 -c "exec(open('./cli/medperf/_version.py').read()); print(__version__)")
echo "version=$version" >> $GITHUB_OUTPUT
echo "version found: [$version]"
check-release:
needs: extract-version
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
should_release: ${{ steps.check_release.outputs.should_release }}
steps:
- name: Check if release exists
id: check_release
run: |
version=${{ needs.extract-version.outputs.new_version }}
echo "version found: [$version]"
if gh release view "v$version" --repo ${{ github.repository }}; then
echo "should_release=false" >> $GITHUB_OUTPUT
else
echo "should_release=true" >> $GITHUB_OUTPUT
fi
build-and-sign:
name: Build distribution 📦
needs: check-release
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
if: needs.check-release.outputs.should_release == 'true'
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: python -m pip install --upgrade pip wheel setuptools
- name: Build a binary wheel and a source tarball
run: |
cd cli
python setup.py sdist bdist_wheel
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: ./cli/dist/*.tar.gz ./cli/dist/*.whl
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: cli/dist/

create-github-release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
needs: [build-and-sign, extract-version]
runs-on: ubuntu-latest
permissions:
contents: write # Allows for creating releases
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: cli/dist
- name: Create and push tag
run: |
version=${{ needs.extract-version.outputs.new_version }}
echo "version found: [$version]"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "v$version" -m "Release v$version"
git push origin "v$version"
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
version=${{ needs.extract-version.outputs.new_version }}
gh release create "v$version" cli/dist/* --generate-notes --repo ${{ github.repository }}
6 changes: 3 additions & 3 deletions cli/medperf/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class CommunicationRetrievalError(CommunicationError):


class CommunicationRequestError(CommunicationError):
"""Raised when the communication interface can't handle a request appropiately"""
"""Raised when the communication interface can't handle a request appropriately"""


class CommunicationAuthenticationError(CommunicationError):
Expand All @@ -23,15 +23,15 @@ class InvalidEntityError(MedperfException):


class InvalidArgumentError(MedperfException):
"""Raised when an argument or set of arguments are consided invalid"""
"""Raised when an argument or set of arguments are considered invalid"""


class ExecutionError(MedperfException):
"""Raised when an execution component fails"""


class CleanExit(MedperfException):
"""Raised when Medperf needs to stop for non erroneous reasons"""
"""Raised when Medperf needs to stop for non-erroneous reasons"""

def __init__(self, *args, medperf_status_code=0) -> None:
super().__init__(*args)
Expand Down

0 comments on commit 49dc914

Please sign in to comment.