Skip to content

Merge branch 'issue/19' #56

Merge branch 'issue/19'

Merge branch 'issue/19' #56

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: GitHub Actions CI/CD
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
# can install packages from a requirements file
if [ -f ci-cd-requirements.txt ]; then pip install -r ci-cd-requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 --max-complexity=10 --max-line-length=100 --count --show-source --statistics A0/hello
flake8 --max-complexity=10 --max-line-length=100 --count --show-source --statistics A0-OOP/hello
flake8 --max-complexity=10 --max-line-length=100 --count --show-source --statistics A1/cold
flake8 --max-complexity=10 --max-line-length=100 --count --show-source --statistics A1-OOP/cold
# 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: Check types with mypy
run: |
mypy --strict --allow-untyped-decorators --ignore-missing-imports A0/hello
mypy --strict --allow-untyped-decorators --ignore-missing-imports A0-OOP/hello
mypy --strict --allow-untyped-decorators --ignore-missing-imports A1/cold
mypy --strict --allow-untyped-decorators --ignore-missing-imports A1-OOP/cold
- name: Test with pytest
run: |
pytest --verbose A0/hello/tests
pytest --verbose A0-OOP/hello/tests
pytest --verbose A1/cold/tests
pytest --verbose A1-OOP/cold/tests
- name: Generate coverage report
run: |
pytest --cov-report=xml:A0/hello --cov=A0/hello A0/hello/tests
pytest --cov-report=xml:A0-OOP/hello --cov=A0-OOP/hello A0-OOP/hello/tests
pytest --cov-report=xml:A1/cold --cov=A1/cold A1/cold/tests
pytest --cov-report=xml:A1-OOP/cold --cov=A1-OOP/cold A1-OOP/cold/tests
codecov
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
fail_ci_if_error: true # optional (default = false)
files: A0/hello/coverage.xml \
A0-OOP/hello/coverage.xml \
A1/cold/coverage.xml \
A1-OOP/cold/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
slug: rambasnet/course-container