Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
name: Run Unit Test via Pytest

on: [push]
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:
- main
pull_request:
# Runs CI on every day (at 06:00 UTC)
schedule:
- cron: '0 6 * * *'

jobs:
build:
Expand All @@ -10,19 +23,22 @@ jobs:
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
- 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
pip install requests
pip install pytest
pip install pytest-coverage
pip install testtools requests pytest pytest-coverage coverage
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
run: |
python -m unittest -v tests/test_*.py
- name: Run Unit Test and Generate report
run: |
coverage run -m pytest -v tests/test_*.py
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5
if: ${{ matrix.python-version == '3.12' }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}