Update to pytest and add coverage #41
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: Run Unit Test via Pytest | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
on: | |
# Run CI against all pushes (direct commits, also merged PRs), Pull Requests | |
workflow_dispatch: | |
push: | |
branches: | |
- collections | |
pull_request: | |
# Runs CI on every day (at 06:00 UTC) | |
schedule: | |
- cron: '0 6 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.9', '3.10', '3.11', '3.12'] | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install testtools requests pytest pytest-coverage coverage | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Run Unit Test and Generate report | |
run: | | |
coverage run -m pytest -v PyPowerStore/tests/unit_tests/test_*.py | |
- name: Upload Coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
if: ${{ matrix.python == '3.12' }} | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |