unittests #30
This file contains hidden or 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
| name: Upload Python Package | |
| on: | |
| release: | |
| types: [published] | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| permissions: | |
| contents: write | |
| jobs: | |
| release-build: | |
| if: github.event_name != 'pull_request' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
| - name: Install dependencies | |
| id: set-version | |
| run: | | |
| VERSION=$(grep version pyproject.toml | cut -d= -f2 | tr -d '[:blank:]' | tr -d '"') | |
| VERSION+=b && VERSION+=$(($(git tag -l "*$VERSION*" | cut -db -f2 | sort -n | tail -1)+1)) | |
| [ $GITHUB_EVENT_NAME == 'release' ] && VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/} | |
| echo VERSION = $VERSION | |
| sed -ie "s/version = .*/version = \"$VERSION\"/" pyproject.toml | |
| echo version=$VERSION >> $GITHUB_OUTPUT | |
| - name: Build release distributions | |
| run: | | |
| # NOTE: put your own distribution build steps here. | |
| python -m pip install -e . | |
| python -m pip install build | |
| python -m build | |
| - name: Test | |
| run: | | |
| python -m pip install -r requirements-dev.txt | |
| pytest -vs --container containers.intersystems.com/intersystems/iris-community:latest-preview | |
| - name: Create Beta Release | |
| id: create_release | |
| if: github.event_name == 'push' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.set-version.outputs.version }} | |
| prerelease: ${{ github.event_name != 'release' }} | |
| - name: Publish release distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dist/ | |
| - uses: actions/checkout@v4 | |
| if: github.event_name == 'release' | |
| with: | |
| ref: master | |
| - name: Bump version | |
| if: github.event_name == 'release' | |
| run: | | |
| git config --global user.name 'ProjectBot' | |
| git config --global user.email '[email protected]' | |
| VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/} | |
| VERSION=`echo $VERSION | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.` | |
| sed -ie "s/version = .*/version = \"$VERSION\"/" pyproject.toml | |
| git add pyproject.toml | |
| git commit -m 'auto bump version with release' | |
| git push |