Skip to content

Merge pull request #36 from viktor-platform/update_setup_py_and_reque… #124

Merge pull request #36 from viktor-platform/update_setup_py_and_reque…

Merge pull request #36 from viktor-platform/update_setup_py_and_reque… #124

name: Test and publish
on:
push
jobs:
build:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov coverage
pip install -r requirements.txt
- name: Run tests
run: python -m unittest discover -b --start-directory ./tests
- name: Build coverage file
run: |
pytest --cov=bro --cov-config=.coveragerc --junitxml=report.xml --cov-report=html:html/test-coverage-results
coverage report --skip-covered || true
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: coverage-results
path: html/test-coverage-results
if: ${{ always() }}
- name: Download Coverage results
uses: actions/download-artifact@v3
with:
name: coverage-results
- name: build dist
run: python3 -m pip install --upgrade build && python3 -m build
- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}