test(tests): added codecoverage percentage checks [2024-11-27] #53
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: HerdingCats Unit Tests | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "tests/**" | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
- name: Configure Poetry | |
run: | | |
poetry config virtualenvs.create false | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
poetry install --no-interaction | |
- name: Create pytest.ini | |
run: | | |
echo "[pytest]" > pytest.ini | |
echo "pythonpath = ." >> pytest.ini | |
- name: Run tests with coverage | |
run: | | |
poetry run pytest tests/ --cov=./ --cov-report=xml | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
file: ./coverage.xml | |
verbose: true | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |