Skip to content

Commit

Permalink
Add GitHub pytest workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Tobias Wolf <[email protected]>
  • Loading branch information
NotTheEvilOne committed Sep 10, 2024
1 parent 93231b7 commit 6e95bfa
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: pre-commit
name: py:pre-commit

on:
pull_request:
Expand All @@ -11,5 +11,5 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- run: python -m pip install .[tests]
- run: pip install .[tests]
- uses: pre-commit/[email protected]
52 changes: 52 additions & 0 deletions .github/workflows/on-push-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: py:test

on:
pull_request:
push:
branches: [main]

jobs:
codeql-analysis:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
id: setup-python
uses: actions/setup-python@v3
- name: Get the Python path
id: get-python-path
run: echo "python-path=`which python`"
- name: Install dependencies
run: |-
pip install -r ./requirements.txt
pip install pylint --upgrade
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: python
queries: security-extended
- name: Perform CodeQL analysis
env:
CODEQL_PYTHON: ${{ steps.get-python-path.outputs.python-path }}
uses: github/codeql-action/analyze@v3

test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12" ]

steps:
- name: Checkout commit
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |-
pip install -r ./requirements.txt
- name: Execute tests
run: pytest
Empty file added mock_src/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions mock_src/rados.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-

pass
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ classifiers = [
Homepage = "https://scs.community"

[tool.pytest.ini_options]
pythonpath = [ "src" ]
pythonpath = [ "src", "mock_src" ]

0 comments on commit 6e95bfa

Please sign in to comment.