Create pytest-tests.yml workflow #17
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
# This workflow will install Python dependencies, run tests and pre-commit hook 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: Run Unit Test via Pytest | |
on: | |
push: | |
branches: [ "develop" ] | |
pull_request: | |
branches: [ "develop" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
strategy: | |
matrix: | |
python-version: ["3.11"] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup Python virtual environment | |
run: | | |
python3.11 -m venv venv | |
source venv/bin/activate | |
- name: Install dependencies | |
run: | | |
source venv/bin/activate | |
python -m pip install ".[dev]" | |
pre-commit install | |
- name: pre-commit check | |
run: | | |
source venv/bin/activate | |
pre-commit run --all | |
- name: Test with pytest | |
run: | | |
source venv/bin/activate | |
pytest ./src/tests/ |