Skip to content

chore: bump version of unity-sps-ogc-processes-api-python-client #56

chore: bump version of unity-sps-ogc-processes-api-python-client

chore: bump version of unity-sps-ogc-processes-api-python-client #56

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Unity-sds-client Python Build
# Do Run if we push anything changes in /libs/unity-py to the main branch
# Run on an PR if it includes unity-py changes OR if the schema in health are changed.
on:
push:
branches:
- main
paths:
- 'libs/unity-py/**'
pull_request:
branches:
- main
paths:
- 'libs/unity-py/**'
- 'schemas/health-service/health-services.schema.json'
jobs:
build:
defaults:
run:
working-directory: ./libs/unity-py
strategy:
fail-fast: false
max-parallel: 2
matrix:
python-version: [ "3.8", "3.9", "3.10" ]
poetry-version: [ "1.8.3" ]
# os: [ ubuntu-18.04, macos-latest, windows-latest ]
os: [ ubuntu-22.04, macos-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: abatilo/[email protected]
with:
poetry-version: ${{ matrix.poetry-version }}
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
src:
- 'libs/unity-py/**'
- name: Software Version Check
if: steps.changes.outputs.src == 'true'
run: |
unity_py_proposed_version=`poetry version -s`
echo "curl -s -o /dev/null -w \"%{http_code}\" https://pypi.org/project/unity-sds-client/$unity_py_proposed_version/"
status_code=`curl -s -o /dev/null -w "%{http_code}" https://pypi.org/project/unity-sds-client/$unity_py_proposed_version/`
echo "Received status code of $status_code"
if ((status_code == 200)); then
echo "Version already exists."
exit 1
fi
- name: Install dependencies
run: |
poetry self add poetry-monorepo-dependency-plugin
poetry install
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
env:
UNITY_USER: '${{ secrets.UNITY_TEST_USER }}'
UNITY_PASSWORD: '${{ secrets.UNITY_TEST_PASSWORD }}'
run: |
poetry run pytest --cov-report=lcov --cov=unity_sds_client -m "not regression"
- name: Regression Test with pytest
env:
UNITY_USER: '${{ secrets.UNITY_TEST_USER }}'
UNITY_PASSWORD: '${{ secrets.UNITY_TEST_PASSWORD }}'
run: |
poetry run pytest --cov-report=lcov --cov=unity_sds_client -o log_cli=true --log-cli-level=DEBUG
- name: Coveralls
uses: coverallsapp/[email protected]
version:
needs: build
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./libs/unity-py
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.UNITY_BUILD_PAT }}
- name: Set up Python
uses: actions/setup-python@v2
- name: Install Poetry
uses: abatilo/[email protected]
with:
poetry-version: "1.5.1"
# Commented out the version bump code. Will publish new unity-py version to pypi on push to main.
# This means we are always releasing. This will fail if the version already exists in Pypi.
# We must ensure that the version has been updated.
# ADded version check above.
# Future work: set PR test to ensure the version has been updated.
# - name: version-bump
# run: |
# poetry version prerelease
# - name: Commit Version Bump
# run: |
# git config --global user.name 'mdps bot'
# git config --global user.email '[email protected]'
# git commit -am "development version bump. [skip actions]"
# git push
- name: Install dependencies
run: |
poetry self add poetry-monorepo-dependency-plugin
poetry install
- name: build
run: |
poetry build
- name: Get version
id: get-version
run: |
echo "::set-output name=current_version::$(poetry version | awk '{print $2}')"
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: ./libs/unity-py/dist
outputs:
publishedVersion: ${{ steps.get-version.outputs.current_version }}
docs:
needs: build
defaults:
run:
working-directory: ./libs/unity-py
strategy:
fail-fast: false
matrix:
python-version: [ "3.10" ]
poetry-version: [ "1.8.3" ]
os: [ ubuntu-22.04 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: abatilo/[email protected]
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: |
poetry self add poetry-monorepo-dependency-plugin
poetry install --with docs
- name: build docs
run: |
poetry run sphinx-apidoc -f -o docs/source/ unity_sds_client
poetry run sphinx-build -M html docs/source docs/build/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: html-docs
path: ./libs/unity-py/docs/build/html/
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./libs/unity-py/docs/build/html
destination_dir: docs/unity-sds-client