Skip to content

feat(ci): add github action unit_test #4

feat(ci): add github action unit_test

feat(ci): add github action unit_test #4

Workflow file for this run

name: Unit Tests
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
jobs:
test:
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, 'docs:')) }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.8' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Update setuptools
run: |
pip install --upgrade pip
pip install setuptools==68.2.2 wheel==0.41.2
- name: Set PYTHONPATH
run: |
echo "PYTHONPATH=$PYTHONPATH:${{ github.workspace }}/src" >> $GITHUB_ENV
- name: Install dependencies
run: |
export PIP_DEFAULT_TIMEOUT=300
pip install -r requirements.txt
pip install -r requirements-test.txt
- name: Show installed pip packages (versions)
run: |
python -m pip list --format=columns
- name: Run tests with coverage
run: |
coverage run -m pytest tests/unit
- name: Generate coverage report
run: |
coverage report -m