From f5ab7bef2e5b5440eda0a916d2506d2ff83cd89d Mon Sep 17 00:00:00 2001 From: Joschka Thurner Date: Wed, 11 Dec 2024 10:36:07 +0100 Subject: [PATCH] cleanup github action workflows --- .../workflows/relying_test_on_dev_merge.yml | 34 +++++ .github/workflows/run_tests_develop.yml | 129 +++++------------- .github/workflows/run_tests_master.yml | 76 ++++------- .readthedocs.yml | 5 +- doc/requirements.txt | 5 - pyproject.toml | 13 +- 6 files changed, 100 insertions(+), 162 deletions(-) create mode 100644 .github/workflows/relying_test_on_dev_merge.yml delete mode 100644 doc/requirements.txt diff --git a/.github/workflows/relying_test_on_dev_merge.yml b/.github/workflows/relying_test_on_dev_merge.yml new file mode 100644 index 00000000..84a69436 --- /dev/null +++ b/.github/workflows/relying_test_on_dev_merge.yml @@ -0,0 +1,34 @@ +# pandapipes-develop branch is designed to work with pandapower-master branch, but checks the ability to +# work with pandapower-develop branch (relying tests, usually not required for merges) in order to avoid +# problems in future releases + +name: ppipes_relying +on: + pull_request: + types: + - closed + workflow_dispatch: + +jobs: + relying: + name: Relying tests + runs-on: ${{ matrix.os }} + strategy: + matrix: + python-version: ['3.9', '3.10', '3.11', '3.12'] + os: [ ubuntu-latest, windows-latest ] + steps: + - uses: actions/checkout@v4 + - name: Install uv + uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a #v4.2.0 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + uv sync --extra test + uv pip install git+https://github.com/e2nIEE/pandapower@develop#egg=pandapower + - name: List all installed packages + run: | + uv pip list + - name: Test with pytest + run: uv run pytest -n auto \ No newline at end of file diff --git a/.github/workflows/run_tests_develop.yml b/.github/workflows/run_tests_develop.yml index 00a7ba94..465f2148 100644 --- a/.github/workflows/run_tests_develop.yml +++ b/.github/workflows/run_tests_develop.yml @@ -2,10 +2,6 @@ # A coverage report will be created for the Python 3.9 version # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -# pandapipes-develop branch is designed to work with pandapower-master branch, but checks the ability to -# work with pandapower-develop branch (relying tests, usually not required for merges) in order to avoid -# problems in future releases - name: ppipes_dev on: @@ -15,47 +11,8 @@ on: branches-ignore: [ master ] jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - matrix: - python-version: ['3.9', '3.10', '3.11', '3.12'] - os: [ ubuntu-latest, windows-latest ] - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install .["all"] - shell: bash - - name: List all installed packages - run: | - python -m pip list - - name: Test with pytest - if: ${{ matrix.python-version != '3.11' }} - run: | - python -m pytest - - name: Test without numba - if: ${{ matrix.python-version == '3.11' }} - run: | - python -m pip uninstall numba -y - python -m pytest -n=auto - - name: Test with pytest and Codecov - if: ${{ matrix.python-version == '3.11' }} - run: | - python -m pip install pytest-cov - python -m pytest --cov=./ --cov-report=xml - - name: Upload coverage to Codecov - if: ${{ matrix.python-version == '3.11' }} - uses: codecov/codecov-action@v1 - with: - verbose: true - - relying: + tests: + name: Tests runs-on: ${{ matrix.os }} strategy: matrix: @@ -63,28 +20,24 @@ jobs: os: [ ubuntu-latest, windows-latest ] steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + - name: Install uv + uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a #v4.2.0 with: python-version: ${{ matrix.python-version }} - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install git+https://github.com/e2nIEE/pandapower@develop#egg=pandapower - python -m pip install .["all"] - shell: bash + run: uv sync --extra test - name: List all installed packages run: | - python -m pip list + uv pip list - name: Test with pytest if: ${{ matrix.python-version != '3.11' }} run: | - python -m pytest + uv run pytest -n auto - name: Test with pytest and Codecov if: ${{ matrix.python-version == '3.11' }} run: | - python -m pip install pytest-cov - python -m pytest -n=auto --cov=./ --cov-report=xml + uv pip install pytest-cov + uv run pytest -n auto --cov=./ --cov-report=xml - name: Upload coverage to Codecov if: ${{ matrix.python-version == '3.11' }} uses: codecov/codecov-action@v4 @@ -100,43 +53,34 @@ jobs: 'pandapipes/networks/network_files/**' '**.yml' '**.rst' - - name: Test without numba - if: ${{ matrix.python-version == '3.11' }} - run: | - python -m pip uninstall numba -y - python -m pytest -n=auto linting: - runs-on: ${{ matrix.os }} - strategy: - matrix: - python-version: ['3.11'] - os: [ ubuntu-latest, windows-latest ] + name: Linting + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + - name: Install uv + uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a #v4.2.0 with: - python-version: ${{ matrix.python-version }} + python-version: 3.11 - name: Install dependencies run: | - python -m pip install --upgrade pip - python -m pip install flake8 - python -m pip install .["all"] - shell: bash + uv sync + uv pip install flake8 - name: List all installed packages run: | - python -m pip list + uv pip list - name: Lint with flake8 (syntax errors and undefinded names) run: | # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + uv run flake8 . --exclude .venv --count --select=E9,F63,F7,F82 --show-source --statistics - name: Lint with flake8 (all errors/warnings) run: | # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + uv run flake8 . --exclude .venv --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics tutorial_tests: + name: Tutorial tests runs-on: ${{ matrix.os }} strategy: matrix: @@ -144,43 +88,34 @@ jobs: os: [ ubuntu-latest, windows-latest ] steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + - name: Install uv + uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a #v4.2.0 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade pip - python -m pip install .["all"] - shell: bash + uv sync --extra test --extra plotting - name: List all installed packages run: | - python -m pip list + uv pip list - name: Test with pytest run: | - python -m pytest --nbmake -n=auto "./tutorials" + uv sync --extra test --extra plotting + uv run pytest --nbmake -n auto "./tutorials" - name: Test without numba if: ${{ matrix.python-version == '3.11' }} run: | - python -m pip uninstall numba -y - python -m pytest --nbmake -n=auto "./tutorials" + uv pip uninstall numba + uv run pytest --nbmake -n auto "./tutorials" docs_check: + name: Sphinx docs check runs-on: ubuntu-latest - strategy: - matrix: - python-version: [ '3.11' ] steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Check docs for Python ${{ matrix.python-version }} - uses: e2nIEE/sphinx-action@master + - name: Check sphinx build + uses: ammaraskar/sphinx-action@7.4.7 with: - pre-build-command: "apt update && apt upgrade -y && apt install -y build-essential gfortran cmake pkg-config libopenblas-dev; - python -m pip install --upgrade pip; - python -m pip install .[docs];" + pre-build-command: "python -m pip install uv && uv pip install .[docs] --system --link-mode=copy" build-command: "sphinx-build -b html source _build -W" docs-folder: "doc/" diff --git a/.github/workflows/run_tests_master.yml b/.github/workflows/run_tests_master.yml index 7d4d5c7e..48687cca 100644 --- a/.github/workflows/run_tests_master.yml +++ b/.github/workflows/run_tests_master.yml @@ -20,27 +20,24 @@ jobs: os: [ ubuntu-latest, windows-latest ] steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + - name: Install uv + uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a #v4.2.0 with: python-version: ${{ matrix.python-version }} - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install .["all"] - shell: bash + run: uv sync --extra test - name: List all installed packages run: | - python -m pip list + uv pip list - name: Test with pytest if: ${{ matrix.python-version != '3.11' }} run: | - python -m pytest + uv run pytest -n auto - name: Test with pytest, Codecov and Coverage if: ${{ matrix.python-version == '3.11' }} run: | - python -m pip install pytest-cov - python -m pytest --nbmake -n=auto --cov=./ --cov-report=xml + uv pip install pytest-cov + uv run pytest --nbmake -n auto --cov=./ --cov-report=xml cp ./coverage.xml ./codecov_coverage.xml - name: Upload coverage to Codacy if: ${{ matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'}} @@ -63,12 +60,6 @@ jobs: 'pandapipes/networks/network_files/**' '**.yml' '**.rst' - - name: Test without numba - if: ${{ matrix.python-version == '3.11' }} - run: | - python -m pip uninstall numba -y - python -m pytest -n=auto - relying: runs-on: ${{ matrix.os }} @@ -78,29 +69,24 @@ jobs: os: [ ubuntu-latest, windows-latest ] steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + - name: Install uv + uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a #v4.2.0 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade pip - python -m pip install .["all"] - shell: bash + uv sync --extra test + uv pip install git+https://github.com/e2nIEE/pandapower@develop#egg=pandapower - name: List all installed packages run: | - python -m pip list + uv pip list - name: Test with pytest - # if: ${{ matrix.python-version != '3.11' }} - run: | - python -m pytest -n=auto - - name: Test without numba - if: ${{ matrix.python-version == '3.11' }} + if: ${{ matrix.python-version != '3.11' }} run: | - python -m pip uninstall numba -y - python -m pytest -n=auto + uv run pytest -n auto tutorial_tests: + name: Tutorial tests runs-on: ${{ matrix.os }} strategy: matrix: @@ -108,44 +94,34 @@ jobs: os: [ ubuntu-latest, windows-latest ] steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + - name: Install uv + uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a #v4.2.0 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade pip - python -m pip install .["all"] - shell: bash + uv sync --extra test --extra plotting - name: List all installed packages run: | - python -m pip list + uv pip list - name: Test with pytest run: | - python -m pytest --nbmake -n=auto "./tutorials" + uv run pytest --nbmake -n auto "./tutorials" - name: Test without numba if: ${{ matrix.python-version == '3.11' }} run: | - python -m pip uninstall numba -y - python -m pytest --nbmake -n=auto "./tutorials" + uv pip uninstall numba + uv run pytest --nbmake -n auto "./tutorials" docs_check: + name: Sphinx docs check runs-on: ubuntu-latest - strategy: - matrix: - python-version: [ '3.11' ] steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Check docs for Python ${{ matrix.python-version }} - uses: e2nIEE/sphinx-action@master + - name: Check sphinx build + uses: ammaraskar/sphinx-action@7.4.7 with: - pre-build-command: "apt update && apt upgrade -y && apt install -y build-essential gfortran cmake pkg-config libopenblas-dev; - python -m pip install --upgrade pip; - python -m pip install .[docs];" + pre-build-command: "python -m pip install uv && uv pip install .[docs] --system --link-mode=copy" build-command: "sphinx-build -b html source _build -W" docs-folder: "doc/" diff --git a/.readthedocs.yml b/.readthedocs.yml index 202694c8..d213e628 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -3,10 +3,11 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.9" + python: "3.11" python: install: - method: pip path: . - - requirements: doc/requirements.txt \ No newline at end of file + extra_requirements: + - docs diff --git a/doc/requirements.txt b/doc/requirements.txt deleted file mode 100644 index 88d2ee07..00000000 --- a/doc/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -sphinx>=5.3.0 -sphinx_rtd_theme>=1.1.1 -numpydoc>=1.5.0 -sphinxcontrib.bibtex>=2.5.0 -sphinx-pyproject \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index efebbda0..8bf7e951 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,16 +51,13 @@ Download = "https://pypi.org/project/pandapipes/#files" Changelog = "https://github.com/e2nIEE/pandapipes/blob/develop/CHANGELOG.rst" [project.optional-dependencies] -docs = ["numpydoc", "sphinx", "sphinx_rtd_theme", "sphinxcontrib.bibtex", "sphinx-pyproject"] +docs = ["numpydoc>=1.5.0", "sphinx>=5.3.0", "sphinx_rtd_theme>=1.1.1", "sphinxcontrib.bibtex>=2.5.0", "sphinx-pyproject"] plotting = ["plotly", "igraph"] -test = [ - "pytest", "pytest-xdist", "pytest-split", "nbmake", "numba", - "setuptools; python_version >= '3.12'" -] +test = ["pytest", "pytest-xdist", "pytest-split", "nbmake", "numba", "setuptools; python_version >= '3.12'"] all = [ - "numpydoc", "sphinx", "sphinx_rtd_theme", "sphinxcontrib.bibtex", - "plotly", "igraph", "pytest", "pytest-xdist", "pytest-split", "nbmake", "numba", - "setuptools; python_version >= '3.12'" + "numpydoc>=1.5.0", "sphinx>=5.3.0", "sphinx_rtd_theme>=1.1.1", "sphinxcontrib.bibtex>=2.5.0", "sphinx-pyproject", + "plotly", "igraph", + "pytest", "pytest-xdist", "pytest-split", "nbmake", "numba","setuptools; python_version >= '3.12'" ] [tool.setuptools.packages.find]