Skip to content

Commit

Permalink
cleanup github action workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
jthurner committed Dec 11, 2024
1 parent 81cbe7b commit f5ab7be
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 162 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/relying_test_on_dev_merge.yml
Original file line number Diff line number Diff line change
@@ -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
129 changes: 32 additions & 97 deletions .github/workflows/run_tests_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -15,76 +11,33 @@ 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:
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
- 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
Expand All @@ -100,87 +53,69 @@ 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:
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
- 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/"
76 changes: 26 additions & 50 deletions .github/workflows/run_tests_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'}}
Expand All @@ -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 }}
Expand All @@ -78,74 +69,59 @@ 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:
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
- 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/"
Loading

0 comments on commit f5ab7be

Please sign in to comment.