diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/on-push-pre-commit.yml similarity index 78% rename from .github/workflows/pre-commit.yml rename to .github/workflows/on-push-pre-commit.yml index f17e487..1fe8af0 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/on-push-pre-commit.yml @@ -1,4 +1,4 @@ -name: pre-commit +name: py:pre-commit on: pull_request: @@ -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/action@v3.0.1 diff --git a/.github/workflows/on-push-test.yml b/.github/workflows/on-push-test.yml new file mode 100644 index 0000000..8bf1dec --- /dev/null +++ b/.github/workflows/on-push-test.yml @@ -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 diff --git a/mock_src/__init__.py b/mock_src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mock_src/rados.py b/mock_src/rados.py new file mode 100644 index 0000000..59bd7b8 --- /dev/null +++ b/mock_src/rados.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +pass diff --git a/pyproject.toml b/pyproject.toml index 16f1b0a..d00c896 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,4 +26,4 @@ classifiers = [ Homepage = "https://scs.community" [tool.pytest.ini_options] -pythonpath = [ "src" ] +pythonpath = [ "src", "mock_src" ]