Skip to content

Commit

Permalink
Add pytest unit test Github action (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
balancap authored Nov 8, 2023
1 parent d9dfb39 commit f8f4a65
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,26 @@ jobs:
with:
python-version: 3.8
- uses: pre-commit/action@v3.0.0

unit_tests:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Cancel previous
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
if: ${{github.ref != 'refs/head/main'}}
- uses: actions/checkout@v3
- name: Update pip
id: pip-cache
run: |
python3 -m pip install --upgrade pip
- name: Local install & test requirements
run: |
pip3 install -e ./
pip3 install -r ./test-requirements.txt
# Run repository unit tests.
- name: Run unit tests
run: |
pytest --tb=short -v --log-cli-level=INFO ./
17 changes: 9 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: no-commit-to-branch
args: [--branch, main]
# Issue on Github action CI?
# - id: no-commit-to-branch
# args: [--branch, main]
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/PyCQA/isort
Expand All @@ -17,21 +18,21 @@ repos:
- id: isort
args: [--profile, black]
- repo: https://github.com/asottile/pyupgrade
rev: v3.2.2
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
rev: 6.1.0
hooks:
- id: flake8
args: ['--ignore=E501,E203,E731,W503']
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.990
rev: v1.6.1
hooks:
- id: mypy
additional_dependencies: [types-dataclasses, numpy==1.22.4]
additional_dependencies: [types-dataclasses, numpy]

0 comments on commit f8f4a65

Please sign in to comment.