From 2414375a2c3acfb467acac6fb224e69948e98491 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Thu, 3 Aug 2023 23:34:59 +0530 Subject: [PATCH 01/17] Add caches for `pip` and restore keys for `nox` --- .github/workflows/test_on_push.yml | 38 +++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index 3a1142c939..8907a6444a 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -111,18 +111,40 @@ jobs: ${{ env.HOME }}/.local/lib/ ${{ env.HOME }}/.local/include/ ${{ env.HOME }}/.local/examples/ - key: nox-pybamm-requires-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/noxfile.py', '**/install_KLU_Sundials.py') }} + key: nox-pybamm-requires-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/install_KLU_Sundials.py') }} - name: Install SuiteSparse and SUNDIALS on GNU/Linux if: matrix.os == 'ubuntu-latest' run: nox -s pybamm-requires + - name: Restore pip cache on GNU/Linux + uses: actions/cache@v3 + if: matrix.os == 'ubuntu-latest' + with: + path: ${{ env.HOME }}/.cache/pip + key: pip-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/setup.py') }} + + - name: Restore pip cache on macOS + uses: actions/cache@v3 + if: matrix.os == 'macos-latest' + with: + path: ${{ env.HOME }}/Library/Caches/pip + key: pip-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/setup.py') }} + + - name: Restore pip cache on Windows + uses: actions/cache@v3 + if: matrix.os == 'windows-latest' + with: + path: ${{ env.HOME }}\AppData\Local\pip\Cache + key: pip-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/setup.py') }} + - name: Cache unit tests nox environment for GNU/Linux with Python 3.8, 3.9, and 3.10, and for macOS and Windows with all Python versions uses: actions/cache@v3 if: (matrix.os == 'ubuntu-latest' && matrix.python-version != 3.11) || (matrix.os != 'ubuntu-latest') with: path: ${{ github.workspace }}/.nox/unit/ - key: ${{ runner.os }}-nox-unit-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/noxfile.py', '**/setup.py') }} + key: ${{ runner.os }}-nox-unit-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/setup.py') }} + restore-keys: ${{ runner.os }}-nox-unit-${{ steps.setup-python.outputs.python-version }}- - name: Run unit tests for GNU/Linux with Python 3.8, 3.9, and 3.10 and for macOS and Windows with all Python versions if: (matrix.os == 'ubuntu-latest' && matrix.python-version != 3.11) || (matrix.os != 'ubuntu-latest') @@ -133,7 +155,8 @@ jobs: if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 with: path: ${{ github.workspace }}/.nox/coverage/ - key: ${{ runner.os }}-nox-coverage-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/noxfile.py', '**/setup.py', '**/.coveragerc') }} + key: ${{ runner.os }}-nox-coverage-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/setup.py') }} + restore-keys: ${{ runner.os }}-nox-coverage-${{ steps.setup-python.outputs.python-version }}- - name: Run unit tests for GNU/Linux with Python 3.11 and generate coverage report if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 @@ -148,7 +171,8 @@ jobs: if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 with: path: ${{ github.workspace }}/.nox/integration/ - key: ${{ runner.os }}-nox-integration-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/noxfile.py', '**/setup.py') }} + key: ${{ runner.os }}-nox-integration-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/setup.py') }} + restore-keys: ${{ runner.os }}-nox-integration-${{ steps.setup-python.outputs.python-version }}- - name: Run integration tests for GNU/Linux with Python 3.11 if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 @@ -159,7 +183,8 @@ jobs: if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 with: path: ${{ github.workspace }}/.nox/doctests/ - key: ${{ runner.os }}-nox-doctests-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/noxfile.py', '**/setup.py', '**/docs/requirements.txt') }} + key: ${{ runner.os }}-nox-doctests-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/setup.py') }} + restore-keys: ${{ runner.os }}-nox-doctests-${{ steps.setup-python.outputs.python-version }}- - name: Install docs dependencies and run doctests for GNU/Linux with Python 3.11 if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 @@ -170,7 +195,8 @@ jobs: if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 with: path: ${{ github.workspace }}/.nox/examples/ - key: ${{ runner.os }}-nox-examples-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/noxfile.py', '**/setup.py') }} + key: ${{ runner.os }}-nox-examples-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/setup.py') }} + restore-keys: ${{ runner.os }}-nox-examples-${{ steps.setup-python.outputs.python-version }}- - name: Install dev dependencies and run example tests for GNU/Linux with Python 3.11 if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 From 153608047a9666c7bc29741eebb9dcf79c816795 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 4 Aug 2023 00:01:24 +0530 Subject: [PATCH 02/17] Update `pip` cache keys, test `nox` keys --- .github/workflows/test_on_push.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index 8907a6444a..b198fc58aa 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -76,8 +76,6 @@ jobs: env: # Homebrew environment variables HOMEBREW_NO_INSTALL_CLEANUP: 1 - HOMEBREW_NO_ANALYTICS: 1 - HOMEBREW_NO_GOOGLE_ANALYTICS: 1 HOMEBREW_NO_AUTO_UPDATE: 1 # Speed up CI NONINTERACTIVE: 1 @@ -86,6 +84,7 @@ jobs: rm -f /usr/local/bin/idle3* rm -f /usr/local/bin/pydoc3* rm -f /usr/local/bin/python3* + brew analytics off brew update brew install graphviz openblas @@ -121,21 +120,21 @@ jobs: uses: actions/cache@v3 if: matrix.os == 'ubuntu-latest' with: - path: ${{ env.HOME }}/.cache/pip + path: ~/.cache/pip key: pip-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/setup.py') }} - name: Restore pip cache on macOS uses: actions/cache@v3 if: matrix.os == 'macos-latest' with: - path: ${{ env.HOME }}/Library/Caches/pip + path: ~/Library/Caches/pip key: pip-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/setup.py') }} - name: Restore pip cache on Windows uses: actions/cache@v3 if: matrix.os == 'windows-latest' with: - path: ${{ env.HOME }}\AppData\Local\pip\Cache + path: ~\AppData\Local\pip\Cache key: pip-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/setup.py') }} - name: Cache unit tests nox environment for GNU/Linux with Python 3.8, 3.9, and 3.10, and for macOS and Windows with all Python versions From 98a42fb0371cd764bb0111325645c1bae61f80a7 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 4 Aug 2023 00:22:47 +0530 Subject: [PATCH 03/17] Remove `pip` cache and `requirements.txt` --- .github/workflows/test_on_push.yml | 21 --------------------- requirements.txt | 19 ------------------- 2 files changed, 40 deletions(-) delete mode 100644 requirements.txt diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index b198fc58aa..4c0aa76c77 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -116,27 +116,6 @@ jobs: if: matrix.os == 'ubuntu-latest' run: nox -s pybamm-requires - - name: Restore pip cache on GNU/Linux - uses: actions/cache@v3 - if: matrix.os == 'ubuntu-latest' - with: - path: ~/.cache/pip - key: pip-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/setup.py') }} - - - name: Restore pip cache on macOS - uses: actions/cache@v3 - if: matrix.os == 'macos-latest' - with: - path: ~/Library/Caches/pip - key: pip-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/setup.py') }} - - - name: Restore pip cache on Windows - uses: actions/cache@v3 - if: matrix.os == 'windows-latest' - with: - path: ~\AppData\Local\pip\Cache - key: pip-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/setup.py') }} - - name: Cache unit tests nox environment for GNU/Linux with Python 3.8, 3.9, and 3.10, and for macOS and Windows with all Python versions uses: actions/cache@v3 if: (matrix.os == 'ubuntu-latest' && matrix.python-version != 3.11) || (matrix.os != 'ubuntu-latest') diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index d33b212a2e..0000000000 --- a/requirements.txt +++ /dev/null @@ -1,19 +0,0 @@ -numpy >= 1.16 -scipy >= 1.3 -pandas >= 0.24 -anytree >= 2.4.3 -autograd >= 1.2 -scikit-fem >= 0.2.0 -casadi >= 3.6.0 -imageio>=2.9.0 -pybtex>=0.24.0 -sympy >= 1.8 -xarray -bpx -tqdm -# Note: Matplotlib is loaded for debug plots but to ensure pybamm runs -# on systems without an attached display it should never be imported -# outside of plot() methods. -# Should not be imported -matplotlib >= 2.0 -# From c6a77570b5dc8d6a866e7ded5a41774e289c7411 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 5 Aug 2023 11:43:36 +0530 Subject: [PATCH 04/17] Cache `pip` with `setup-python` --- .github/workflows/test_on_push.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index 4c0aa76c77..c2f2f91127 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -45,12 +45,10 @@ jobs: python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - - uses: actions/checkout@v3 - - id: setup-python - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + - name: Check out PyBaMM repository + uses: actions/checkout@v3 with: - python-version: ${{ matrix.python-version }} + fetch-depth: 0 # Install and cache apt packages - name: Install Linux system dependencies @@ -92,10 +90,16 @@ jobs: if: matrix.os == 'windows-latest' run: choco install graphviz --version=8.0.5 - - name: Install standard Python dependencies - run: | - python -m pip install --upgrade pip wheel setuptools - python -m pip install nox + - name: Set up Python ${{ matrix.python-version }} and install standard Python dependencies + id: setup-python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + cache-dependency-path: setup.py + - run: | + pip install --upgrade pip wheel setuptools nox + pip install -e .'[all,docs]' - name: Cache pybamm-requires nox environment for GNU/Linux uses: actions/cache@v3 From 0fe74804111e18dc029cc5ba131b4f3e220f5c3c Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 5 Aug 2023 12:05:06 +0530 Subject: [PATCH 05/17] Use `session.run_always` instead of `session.install` --- noxfile.py | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/noxfile.py b/noxfile.py index 0c4cea7e2c..6ab24c34b4 100644 --- a/noxfile.py +++ b/noxfile.py @@ -19,6 +19,10 @@ # Do not stdout ANSI colours on GitHub Actions if os.getenv("CI") == "true": os.environ["NO_COLOR"] = "1" + # The setup-python action installs and caches dependencies by default, so we skip + # installing them again in nox environments. The dev and docs sessions will still + # require a virtual environment, but we don't run them in the CI + nox.options.default_venv_backend = "none" def set_environment_variables(env_dict, session): @@ -42,7 +46,7 @@ def run_pybamm_requires(session): """Download, compile, and install the build-time requirements for Linux and macOS: the SuiteSparse and SUNDIALS libraries.""" # noqa: E501 set_environment_variables(PYBAMM_ENV, session=session) if sys.platform != "win32": - session.install("wget", "cmake") + session.run_always("pip", "install", "wget", "cmake") session.run("python", "scripts/install_KLU_Sundials.py") if not os.path.exists("./pybind11"): session.run( @@ -60,11 +64,11 @@ def run_pybamm_requires(session): def run_coverage(session): """Run the coverage tests and generate an XML report.""" set_environment_variables(PYBAMM_ENV, session=session) - session.install("coverage") - session.install("-e", ".[all]") + session.run_always("pip", "install", "coverage") + session.run_always("pip", "install", "-e", ".[all]") if sys.platform != "win32": - session.install("-e", ".[odes]") - session.install("-e", ".[jax]") + session.run_always("pip", "install", "-e", ".[odes]") + session.run_always("pip", "install", "-e", ".[jax]") session.run("coverage", "run", "--rcfile=.coveragerc", "run-tests.py", "--nosub") session.run("coverage", "combine") session.run("coverage", "xml") @@ -74,16 +78,16 @@ def run_coverage(session): def run_integration(session): """Run the integration tests.""" set_environment_variables(PYBAMM_ENV, session=session) - session.install("-e", ".[all]") + session.run_always("pip", "install", "-e", ".[all]") if sys.platform == "linux": - session.install("-e", ".[odes]") + session.run_always("pip", "install", "-e", ".[odes]") session.run("python", "run-tests.py", "--integration") @nox.session(name="doctests") def run_doctests(session): """Run the doctests and generate the output(s) in the docs/build/ directory.""" - session.install("-e", ".[all,docs]") + session.run_always("pip", "install", "-e", ".[all,docs]") session.run("python", "run-tests.py", "--doctest") @@ -91,17 +95,17 @@ def run_doctests(session): def run_unit(session): """Run the unit tests.""" set_environment_variables(PYBAMM_ENV, session=session) - session.install("-e", ".[all]") + session.run_always("pip", "install", "-e", ".[all]") if sys.platform == "linux": - session.install("-e", ".[odes]") - session.install("-e", ".[jax]") + session.run_always("pip", "install", "-e", ".[odes]") + session.run_always("pip", "install", "-e", ".[jax]") session.run("python", "run-tests.py", "--unit") @nox.session(name="examples") def run_examples(session): """Run the examples tests for Jupyter notebooks and Python scripts.""" - session.install("-e", ".[all]") + session.run_always("pip", "install", "-e", ".[all]") session.run("python", "run-tests.py", "--examples") @@ -127,10 +131,10 @@ def set_dev(session): def run_tests(session): """Run the unit tests and integration tests sequentially.""" set_environment_variables(PYBAMM_ENV, session=session) - session.install("-e", ".[all]") + session.run_always("pip", "install", "-e", ".[all]") if sys.platform == "linux" or sys.platform == "darwin": - session.install("-e", ".[odes]") - session.install("-e", ".[jax]") + session.run_always("pip", "install", "-e", ".[odes]") + session.run_always("pip", "install", "-e", ".[jax]") session.run("python", "run-tests.py", "--all") From d361902ace405bc75b37b18f0aaa58c6c83022a8 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 5 Aug 2023 12:10:02 +0530 Subject: [PATCH 06/17] Remove old `brew` Python symlink fixes Not needed anymore after the issue was resolved --- .github/workflows/test_on_push.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index c2f2f91127..6a7e774752 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -66,22 +66,16 @@ jobs: sudo dot -c sudo apt-get install libopenblas-dev texlive-latex-extra dvipng - # Added fixes to homebrew installs: - # rm -f /usr/local/bin/2to3 - # (see https://github.com/actions/virtual-environments/issues/2322) - name: Install macOS system dependencies if: matrix.os == 'macos-latest' env: # Homebrew environment variables HOMEBREW_NO_INSTALL_CLEANUP: 1 HOMEBREW_NO_AUTO_UPDATE: 1 + HOMEBREW_NO_COLOR: 1 # Speed up CI NONINTERACTIVE: 1 run: | - rm -f /usr/local/bin/2to3* - rm -f /usr/local/bin/idle3* - rm -f /usr/local/bin/pydoc3* - rm -f /usr/local/bin/python3* brew analytics off brew update brew install graphviz openblas From 9e1fc784881512f4f2b8305b31fff38a593f9d28 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 5 Aug 2023 12:24:50 +0530 Subject: [PATCH 07/17] Fix Windows build error and add separate job --- .github/workflows/test_on_push.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index 6a7e774752..15dda8ba29 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -84,16 +84,18 @@ jobs: if: matrix.os == 'windows-latest' run: choco install graphviz --version=8.0.5 - - name: Set up Python ${{ matrix.python-version }} and install standard Python dependencies + - name: Set up Python ${{ matrix.python-version }} id: setup-python uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} cache: 'pip' cache-dependency-path: setup.py + + - name: Install PyBaMM dependencies - run: | pip install --upgrade pip wheel setuptools nox - pip install -e .'[all,docs]' + pip install -e .[all,docs] - name: Cache pybamm-requires nox environment for GNU/Linux uses: actions/cache@v3 From a6b3c080bb047185e03c53d0ccadd948ebd76d00 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 5 Aug 2023 12:26:03 +0530 Subject: [PATCH 08/17] Lint --- .github/workflows/test_on_push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index 15dda8ba29..b79994c833 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -91,7 +91,7 @@ jobs: python-version: ${{ matrix.python-version }} cache: 'pip' cache-dependency-path: setup.py - + - name: Install PyBaMM dependencies - run: | pip install --upgrade pip wheel setuptools nox From e30c34d948d852fad6248557b1dac309ace6c504 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 5 Aug 2023 13:01:45 +0530 Subject: [PATCH 09/17] Remove inessential `nox` environment caches --- .github/workflows/test_on_push.yml | 42 +----------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index b79994c833..be461711dd 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -93,7 +93,7 @@ jobs: cache-dependency-path: setup.py - name: Install PyBaMM dependencies - - run: | + run: | pip install --upgrade pip wheel setuptools nox pip install -e .[all,docs] @@ -116,26 +116,10 @@ jobs: if: matrix.os == 'ubuntu-latest' run: nox -s pybamm-requires - - name: Cache unit tests nox environment for GNU/Linux with Python 3.8, 3.9, and 3.10, and for macOS and Windows with all Python versions - uses: actions/cache@v3 - if: (matrix.os == 'ubuntu-latest' && matrix.python-version != 3.11) || (matrix.os != 'ubuntu-latest') - with: - path: ${{ github.workspace }}/.nox/unit/ - key: ${{ runner.os }}-nox-unit-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/setup.py') }} - restore-keys: ${{ runner.os }}-nox-unit-${{ steps.setup-python.outputs.python-version }}- - - name: Run unit tests for GNU/Linux with Python 3.8, 3.9, and 3.10 and for macOS and Windows with all Python versions if: (matrix.os == 'ubuntu-latest' && matrix.python-version != 3.11) || (matrix.os != 'ubuntu-latest') run: nox -s unit - - name: Cache coverage nox environment for GNU/Linux with Python 3.11 - uses: actions/cache@v3 - if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 - with: - path: ${{ github.workspace }}/.nox/coverage/ - key: ${{ runner.os }}-nox-coverage-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/setup.py') }} - restore-keys: ${{ runner.os }}-nox-coverage-${{ steps.setup-python.outputs.python-version }}- - - name: Run unit tests for GNU/Linux with Python 3.11 and generate coverage report if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 run: nox -s coverage @@ -144,38 +128,14 @@ jobs: if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 uses: codecov/codecov-action@v2.1.0 - - name: Cache integration tests nox environment for GNU/Linux with Python 3.11 - uses: actions/cache@v3 - if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 - with: - path: ${{ github.workspace }}/.nox/integration/ - key: ${{ runner.os }}-nox-integration-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/setup.py') }} - restore-keys: ${{ runner.os }}-nox-integration-${{ steps.setup-python.outputs.python-version }}- - - name: Run integration tests for GNU/Linux with Python 3.11 if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 run: nox -s integration - - name: Cache doctests nox environment for GNU/Linux with Python 3.11 - uses: actions/cache@v3 - if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 - with: - path: ${{ github.workspace }}/.nox/doctests/ - key: ${{ runner.os }}-nox-doctests-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/setup.py') }} - restore-keys: ${{ runner.os }}-nox-doctests-${{ steps.setup-python.outputs.python-version }}- - - name: Install docs dependencies and run doctests for GNU/Linux with Python 3.11 if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 run: nox -s doctests - - name: Cache examples nox environment for GNU/Linux with Python 3.11 - uses: actions/cache@v3 - if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 - with: - path: ${{ github.workspace }}/.nox/examples/ - key: ${{ runner.os }}-nox-examples-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/setup.py') }} - restore-keys: ${{ runner.os }}-nox-examples-${{ steps.setup-python.outputs.python-version }}- - - name: Install dev dependencies and run example tests for GNU/Linux with Python 3.11 if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 run: nox -s examples From 23af9f0d22e5ed1bc8d54db91c5b757aadc40bc8 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 5 Aug 2023 13:42:33 +0530 Subject: [PATCH 10/17] Update `pybamm-requires` cache --- .github/workflows/test_on_push.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index be461711dd..fcd29d6273 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -103,7 +103,6 @@ jobs: with: path: | # Repository files - ${{ github.workspace }}/.nox/pybamm-requires/ ${{ github.workspace }}/pybind11/ ${{ github.workspace }}/install_KLU_Sundials/ # Headers and dynamic library files for SuiteSparse and SUNDIALS From 2194023171545ccc4dfae7d607d34e3cba28e5b5 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 5 Aug 2023 17:10:14 +0530 Subject: [PATCH 11/17] Try installing `scikits.odes` with other extras --- .github/workflows/test_on_push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index fcd29d6273..cf696f5cbf 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -95,7 +95,7 @@ jobs: - name: Install PyBaMM dependencies run: | pip install --upgrade pip wheel setuptools nox - pip install -e .[all,docs] + pip install -e .[all,docs,odes] - name: Cache pybamm-requires nox environment for GNU/Linux uses: actions/cache@v3 From a8ea890e9a78f270529753bac67612817d047db6 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 5 Aug 2023 17:14:55 +0530 Subject: [PATCH 12/17] Move Python dependencies step below `pybamm-requires` --- .github/workflows/test_on_push.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index cf696f5cbf..8d3ec4f6e0 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -92,11 +92,6 @@ jobs: cache: 'pip' cache-dependency-path: setup.py - - name: Install PyBaMM dependencies - run: | - pip install --upgrade pip wheel setuptools nox - pip install -e .[all,docs,odes] - - name: Cache pybamm-requires nox environment for GNU/Linux uses: actions/cache@v3 if: matrix.os == 'ubuntu-latest' @@ -115,6 +110,11 @@ jobs: if: matrix.os == 'ubuntu-latest' run: nox -s pybamm-requires + - name: Install PyBaMM dependencies + run: | + pip install --upgrade pip wheel setuptools nox + pip install -e .[all,docs,odes] + - name: Run unit tests for GNU/Linux with Python 3.8, 3.9, and 3.10 and for macOS and Windows with all Python versions if: (matrix.os == 'ubuntu-latest' && matrix.python-version != 3.11) || (matrix.os != 'ubuntu-latest') run: nox -s unit From e283248cf37a9e4d329dec6ef890df66fcc0ce13 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 5 Aug 2023 17:16:18 +0530 Subject: [PATCH 13/17] Remove `odes` extra --- .github/workflows/test_on_push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index 8d3ec4f6e0..329f83b9c0 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -113,7 +113,7 @@ jobs: - name: Install PyBaMM dependencies run: | pip install --upgrade pip wheel setuptools nox - pip install -e .[all,docs,odes] + pip install -e .[all,docs] - name: Run unit tests for GNU/Linux with Python 3.8, 3.9, and 3.10 and for macOS and Windows with all Python versions if: (matrix.os == 'ubuntu-latest' && matrix.python-version != 3.11) || (matrix.os != 'ubuntu-latest') From a7bd94bb87f7237c500d5d77315d6bb7b412d187 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 5 Aug 2023 17:21:17 +0530 Subject: [PATCH 14/17] Revert Python dependencies step --- .github/workflows/test_on_push.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index 329f83b9c0..cf696f5cbf 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -92,6 +92,11 @@ jobs: cache: 'pip' cache-dependency-path: setup.py + - name: Install PyBaMM dependencies + run: | + pip install --upgrade pip wheel setuptools nox + pip install -e .[all,docs,odes] + - name: Cache pybamm-requires nox environment for GNU/Linux uses: actions/cache@v3 if: matrix.os == 'ubuntu-latest' @@ -110,11 +115,6 @@ jobs: if: matrix.os == 'ubuntu-latest' run: nox -s pybamm-requires - - name: Install PyBaMM dependencies - run: | - pip install --upgrade pip wheel setuptools nox - pip install -e .[all,docs] - - name: Run unit tests for GNU/Linux with Python 3.8, 3.9, and 3.10 and for macOS and Windows with all Python versions if: (matrix.os == 'ubuntu-latest' && matrix.python-version != 3.11) || (matrix.os != 'ubuntu-latest') run: nox -s unit From 4235fa8102abb8b486aa0faa26c0f94d8fe71eb3 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 5 Aug 2023 17:28:01 +0530 Subject: [PATCH 15/17] Remove `odes` extra again --- .github/workflows/test_on_push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index cf696f5cbf..fcd29d6273 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -95,7 +95,7 @@ jobs: - name: Install PyBaMM dependencies run: | pip install --upgrade pip wheel setuptools nox - pip install -e .[all,docs,odes] + pip install -e .[all,docs] - name: Cache pybamm-requires nox environment for GNU/Linux uses: actions/cache@v3 From 22615ffc6c8d1bf13ccdab6013087e079466b7a1 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 5 Aug 2023 19:20:06 +0530 Subject: [PATCH 16/17] Set environment variables in the `examples` session --- noxfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/noxfile.py b/noxfile.py index 6ab24c34b4..2a08865037 100644 --- a/noxfile.py +++ b/noxfile.py @@ -105,6 +105,7 @@ def run_unit(session): @nox.session(name="examples") def run_examples(session): """Run the examples tests for Jupyter notebooks and Python scripts.""" + set_environment_variables(PYBAMM_ENV, session=session) session.run_always("pip", "install", "-e", ".[all]") session.run("python", "run-tests.py", "--examples") From 72038ec72fc7cd0e0ed24df80131909f2058f0f3 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 5 Aug 2023 23:33:02 +0530 Subject: [PATCH 17/17] Remove `fetch-depth` value --- .github/workflows/test_on_push.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index fcd29d6273..8fb1aae588 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -47,8 +47,6 @@ jobs: steps: - name: Check out PyBaMM repository uses: actions/checkout@v3 - with: - fetch-depth: 0 # Install and cache apt packages - name: Install Linux system dependencies