diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 3ea1707..c616870 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -22,11 +22,10 @@ jobs: - name: Install dependencies run: | - pip install -e .[vis] + pip install -e .[vis,doc] - name: Build docs run: | - pip install sphinx sphinx_rtd_theme myst-parser sphinx-autodoc-typehints sphinx-copybutton sphinx-prompt sphinx-notfound-page sphinx-build -b html docs/ ./public cp -r docs/additional_resources/* ./public/ diff --git a/.github/workflows/test-main.yml b/.github/workflows/run-tests.yml similarity index 71% rename from .github/workflows/test-main.yml rename to .github/workflows/run-tests.yml index 2551e73..1adcbb6 100644 --- a/.github/workflows/test-main.yml +++ b/.github/workflows/run-tests.yml @@ -1,17 +1,15 @@ -name: Test main branch 🧪 +name: Test 🧪 -on: - push: - branches: - - main - pull_request: - branches: - - main +on: [push, pull_request] jobs: test: name: Test runs-on: ubuntu-latest + strategy: + matrix: + # Test on oldest and newest supported Python versions + python-version: ["3.8", "3.12"] steps: - name: Check out repository code uses: actions/checkout@v4 @@ -20,22 +18,21 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: "3.8" + python-version: ${{ matrix.python-version }} + cache: 'pip' - name: Upgrade pip run: | python -m pip install --upgrade pip - pip install setuptools wheel twine - name: Install dependencies run: | - pip install numpy pytest coverage pytest-mock - pip install -e .[vis] + pip install -e .[vis,test] - name: Run tests with pytest run: coverage run --source pathfinding3d -m pytest - - name: Show basic test coverage report + - name: Generate coverage reports run: | coverage report -m coverage xml diff --git a/.github/workflows/test-and-publish-release.yml b/.github/workflows/test-and-publish-release.yml index 6e42768..80d315b 100644 --- a/.github/workflows/test-and-publish-release.yml +++ b/.github/workflows/test-and-publish-release.yml @@ -25,13 +25,12 @@ jobs: - name: Install dependencies run: | - pip install numpy pytest coverage pytest-mock - pip install -e .[vis] + pip install -e .[vis,test,doc] - name: Run tests with pytest run: coverage run --source pathfinding3d -m pytest - - name: Show basic test coverage report + - name: Generate coverage reports run: | coverage report -m coverage xml @@ -46,7 +45,6 @@ jobs: - name: Build docs run: | - pip install sphinx sphinx_rtd_theme myst-parser sphinx-autodoc-typehints sphinx-copybutton sphinx-prompt sphinx-notfound-page sphinx-build -b html docs/ ./public cp -r docs/additional_resources/* ./public/ diff --git a/setup.py b/setup.py index 9dc7835..b0ebf64 100644 --- a/setup.py +++ b/setup.py @@ -7,6 +7,23 @@ with open(os.path.join("pathfinding3d", "version.txt"), encoding="utf-8") as file_handler: __version__ = file_handler.read().strip() +# Test requirements +test_requirements = [ + "pytest", + "pytest-cov", + "pytest-mock", +] +# Documentation requirements +doc_requirements = [ + "sphinx", + "sphinx_rtd_theme", + "myst-parser", + "sphinx-autodoc-typehints", + "sphinx-copybutton", + "sphinx-prompt", + "sphinx-notfound-page", +] + setup( name="pathfinding3d", description="Pathfinding algorithms in 3D grids (based on python-pathfinding)", @@ -26,25 +43,12 @@ package_data={"pathfinding3d": ["version.txt"]}, install_requires=["numpy"], extras_require={ - "dev": [ - "black", - "pytest", - "pytest-mock", - "coverage", - "sphinx<=7.2.6", - "sphinx_rtd_theme", - "myst-parser", - "sphinx-autodoc-typehints", - "sphinx-copybutton", - "sphinx-prompt", - "sphinx-notfound-page", - ], "vis": ["plotly"], + "dev": ["black"] + test_requirements + doc_requirements, + "test": test_requirements, + "doc": doc_requirements, }, - tests_require=[ - "pytest", - "coverage", - ], + tests_require=test_requirements, python_requires=">=3.8", platforms=["any"], )