Skip to content

added mock testing files #1

added mock testing files

added mock testing files #1

# 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: Python application
on:
push:
pull_request:
permissions:
contents: read
jobs:
check-tests:
runs-on: ubuntu-latest
outputs:
tests_exist: ${{ steps.check.outputs.tests_exist }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Check for test files
id: check
run: |
if find . -type f -name "*.test.py" | grep -q .; then
echo "::set-output name=tests_exist::true"
else
echo "::set-output name=tests_exist::false"
fi
run-tests:
runs-on: ubuntu-latest
needs: check-tests
if: needs.check-tests.outputs.tests_exist == 'true'
steps:
- uses: actions/checkout@v4
- 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 pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
run: |
pytest
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}