Skip to content

fix: Update python dependencies to fix vulnerabilities. (#212) #95

fix: Update python dependencies to fix vulnerabilities. (#212)

fix: Update python dependencies to fix vulnerabilities. (#212) #95

Workflow file for this run

name: Dialogy Tag Publish CI
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: false
virtualenvs-in-project: false
installer-parallel: false
- name: Install dependencies
run: |
python -m pip install coverage black mypy pytest types-pytz types-requests
if [ -f pyproject.toml ]; then poetry config installer.modern-installation false; poetry run pip install 'setuptools==57.5.0'; poetry install --no-root; fi
- name: Lint with black and static type check with mypy
run: |
# stop the build if there are Python syntax errors or undefined names
black .
mypy dialogy --install-types
- name: Test with pytest and get Coverage
run: |
poetry run pytest --cov=dialogy --cov-report=xml tests/
coverage report | tee cov.out
echo "covpercentage=$(cat cov.out | tail -n1 | awk -F ' ' '{print $4}' | sed 's/.$//')" >> "$GITHUB_ENV"
- name: Upload coverage data to coverage
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
fail_ci_if_error: true
verbose: true
- name: Check if coverage less than 100%
if: env.covpercentage < '100'
uses: actions/github-script@v3
with:
script: |
core.setFailed('Code Coverage is less than 100%')
publish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: false
virtualenvs-in-project: false
installer-parallel: false
- name: Build and Publish to PYPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry version $(git describe --tags --abbrev=0)
pip install setuptools wheel twine
python -m pip install build --user
python -m build --sdist --wheel --outdir dist/
twine upload dist/*