Skip to content

Merge pull request #298 from naorlivne/dependabot/pip/coverage-7.6.5 #97

Merge pull request #298 from naorlivne/dependabot/pip/coverage-7.6.5

Merge pull request #298 from naorlivne/dependabot/pip/coverage-7.6.5 #97

name: push CI CD
on:
push:
branches: [ "master" ]
jobs:
testing_job:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.9", "3.10", "3.11" ]
container: python:${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
coverage run -m unittest
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
build_and_publish_job:
runs-on: ubuntu-latest
needs: testing_job
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}