[pre-commit.ci] pre-commit autoupdate #69
This file contains 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: CI | |
on: | |
pull_request: | |
push: | |
branches: [master] | |
jobs: | |
test-and-publish-flow: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Set up python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Run Poetry image | |
uses: abatilo/actions-poetry@v2.0.0 | |
with: | |
poetry-version: 1.3.1 | |
- name: Install library | |
run: poetry install --no-interaction | |
- name: Run tests | |
run: poetry run pytest | |
# upload coverage only on master branch | |
- name: Upload coverage | |
if: ${{ github.ref == 'refs/heads/master' }} | |
uses: codecov/codecov-action@v2 | |
# publish version only when pyproject.toml is changed in master | |
- name: Filter changes in pyproject | |
uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
root: | |
- 'pyproject.toml' | |
- if: ${{ (github.ref == 'refs/heads/master') && (steps.changes.outputs.root == 'true')}} | |
name: Build and publish | |
env: | |
PYPI_USER: ${{ secrets.PYPI_USER }} | |
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: poetry publish --username $PYPI_USER --password $PYPI_PASSWORD --build |