From 5236a8641d19579d5eea4b772b12f7fd24c2e8f7 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sat, 27 Jan 2024 22:28:39 +0100 Subject: [PATCH 1/3] Chore: Update .gitignore --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 655ff4f..f2115f6 100644 --- a/.gitignore +++ b/.gitignore @@ -10,8 +10,11 @@ rdflib_sqlalchemy.egg-info /.eggs/ /dist/ /venv/ +.venv* +.coverage +coverage.xml docs/api # JetBrains IDE files /.idea/ - +test/tmpdb.sqlite From ab880a4eb5230887edcbd16cac39b24097de579c Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sat, 27 Jan 2024 22:29:56 +0100 Subject: [PATCH 2/3] CI: Fix test dependencies and improve pytest configuration --- pytest.ini | 5 ++++- test-requirements.txt | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index 5604830..ea67ee6 100644 --- a/pytest.ini +++ b/pytest.ini @@ -6,7 +6,10 @@ norecursedirs = .git env # Output in color, run doctests -addopts = --color=yes +addopts = + -rsfEX -p pytester --strict-markers --verbosity=3 + --cov=rdflib_sqlalchemy --cov-report=term-missing --cov-report=xml + --color=yes testpaths = test # Run tests from files matching this glob diff --git a/test-requirements.txt b/test-requirements.txt index 8297640..8e47947 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,3 +1,5 @@ flake8 mock==3.0.5 ; python_version=="2.7" +pytest<8 +pytest-cov<5 tox From cce88449b7dbdb5e7712f14c6c9e24de3ae62075 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sat, 27 Jan 2024 22:32:10 +0100 Subject: [PATCH 3/3] CI: Add test configuration for GitHub Actions --- .github/dependabot.yml | 14 ++++++ .github/workflows/tests.yml | 86 +++++++++++++++++++++++++++++++++++++ README.md | 2 + 3 files changed, 102 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/tests.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..4c23d36 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,14 @@ +# Please see the documentation for all Dependabot configuration options: +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "weekly" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..fed35ef --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,86 @@ +name: "Tests: PR" + +on: + push: + branches: + - main + - develop + - ci-gha + pull_request: ~ + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: " + Python: ${{ matrix.python-version }} + SQLAlchemy: ${{ matrix.sqla-version }} + " + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ['ubuntu-latest'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + sqla-version: ['1.*'] + pip-allow-prerelease: ['false'] + + env: + PYTHON_VERSION: ${{ matrix.python-version }} + SQLALCHEMY_VERSION: ${{ matrix.sqla-version }} + PIP_ALLOW_PRERELEASE: ${{ matrix.pip-allow-prerelease }} + + steps: + + - name: Acquire sources + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + architecture: x64 + cache: 'pip' + cache-dependency-path: | + setup.cfg + setup.py + test-requirements.txt + + - name: Set up project + run: | + + # `setuptools 0.64.0` adds support for editable install hooks (PEP 660). + # https://github.com/pypa/setuptools/blob/main/CHANGES.rst#v6400 + pip install "setuptools>=64" --upgrade + + # Install package in editable mode. + pip install --use-pep517 --prefer-binary --editable='.[develop,test]' + + # Install development/test dependencies. + pip install -r test-requirements.txt + + # Explicitly install designated SQLAlchemy version to validate this test matrix slot. + pip install "sqlalchemy==${{ matrix.sqla-version }}" + + - name: Invoke tests + run: | + + # Report about the test matrix slot. + echo "Invoking tests with Python ${PYTHON_VERSION} and SQLAlchemy ${SQLALCHEMY_VERSION}" + + # Run linters and software tests. + flake8 rdflib_sqlalchemy test + pytest + + # https://github.com/codecov/codecov-action + - name: Upload coverage results to Codecov + uses: codecov/codecov-action@v3 + with: + files: ./coverage.xml + flags: main + env_vars: OS,PYTHON + name: codecov-umbrella + fail_ci_if_error: false diff --git a/README.md b/README.md index 6e10966..7b8e593 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ RDFLib-SQLAlchemy ================= +[![Tests](https://github.com/RDFLib/rdflib-sqlalchemy/actions/workflows/tests.yml/badge.svg)](https://github.com/RDFLib/rdflib-sqlalchemy/actions/workflows/tests.yml) + A SQLAlchemy-backed, formula-aware RDFLib Store. It stores its triples in the following partitions: