Skip to content

updated README

updated README #2

# 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: Python Build
on:
push:
branches: [ main, develop ]
paths:
- 'libs/unity-py/**'
pull_request:
branches: [ main, develop ]
paths:
- 'libs/unity-py/**'
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.5.1" ]
# 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 }}
- name: Install dependencies
run: |
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/develop' && 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"
- 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 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 }}
outputs:
publishedVersion: ${{ steps.get-version.outputs.current_version }}