Skip to content

Update tests for pytest changes #176

Update tests for pytest changes

Update tests for pytest changes #176

# SOURCE: https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
name: Upload Python TEST Package
on:
workflow_dispatch:
push:
branches:
- development
pull_request:
branches:
- development
jobs:
validate:
name: Code Quality Assessment
runs-on: ubuntu-20.04 # Use ubuntu-latest when https://github.com/actions/setup-python/issues/544 is fixed
strategy:
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set Environment Variables
run: |
echo "${HOME}/.gem/ruby/2.7.0/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
gem install --user-install hiera-eyaml -v 2.1.0
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install --upgrade wheel
python -m pip install --upgrade mypy pytest pytest-cov pytest-console-scripts pylint coveralls pydocstyle
python -m pip install --editable .
- name: Validate Compliance with pydocstyle
run: |
pydocstyle yamlpath
- name: Validate Compliance with MyPY
run: |
mypy yamlpath
- name: Lint with pylint
run: |
pylint yamlpath
- name: Unit Test with pytest
run: |
pytest --verbose --cov=yamlpath --cov-report=term-missing --cov-fail-under=100 --script-launch-mode=subprocess tests
publish:
name: Publish to TEST PyPI
if: github.ref == 'refs/heads/development'
runs-on: ubuntu-latest
environment: 'PyPI: Test'
needs: validate
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install Build Tools
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools wheel
- name: Build Artifacts
run: |
sed -i -r -e "s/(^__version__[[:space:]]*=[[:space:]]*)("'"'"[[:digit:]](\.[[:digit:]])+)"'"'"/\1\2.RC$(date "+%Y%m%d%H%M%S")"'"'"/" yamlpath/__init__.py
python setup.py sdist bdist_wheel
- name: Publish Artifacts
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/