diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml new file mode 100644 index 0000000000..90f49ecca3 --- /dev/null +++ b/.github/workflows/test_on_push.yml @@ -0,0 +1,106 @@ +name: PyBaMM + +on: + push: + + # everyday at 3 am UTC + schedule: + - cron: '* 3 * * *' + +jobs: + + style: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Check style + uses: actions/setup-python@v1 + with: + python-version: 3.7 + + - name: Install package + run: | + python -m pip install --upgrade pip wheel setuptools + pip install -e .[dev] + + - name: Check style + run: python -m flake8 + + build: + needs: style + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: [3.6, 3.7] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Linux system dependencies + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt install gfortran gcc libopenblas-dev liblapack-dev graphviz + sudo apt install python${{ matrix.python-version }}.dev + + - name: Install MacOS system dependencies + if: matrix.os == 'macos-latest' + run: | + brew update + brew install graphviz + brew install openblas + + - name: Install Windows system dependencies + if: matrix.os == 'windows-latest' + run: choco install graphviz + + - name: Install standard python dependencies + run: | + python -m pip install --upgrade pip wheel setuptools + pip install -e . + + - name: Install SUNDIALS and SuiteSparse + if: matrix.os != 'windows-latest' + run: | + pip install wget + git clone https://github.com/pybind/pybind11.git + python scripts/setup_KLU_module_build.py + export SUNDIALS_INST=$HOME/.local + pip install scikits.odes + pip install -e . + + - name: Run unit tests Windows + if: matrix.os == 'windows-latest' + run: | + python run-tests.py --unit --folder all + + - name: Run unit tests + if: matrix.os != 'windows-latest' + run: | + export LD_LIBRARY_PATH=$HOME/.local/lib:scikits.odes/sundials5/lib:$LD_LIBRARY_PATH + python run-tests.py --unit --folder all + + - name: Install docs dependencies and run doctests + if: matrix.os != 'windows-latest' + run: | + export LD_LIBRARY_PATH=$HOME/.local/lib:scikits.odes/sundials5/lib:$LD_LIBRARY_PATH + pip install -e .[docs] + python run-tests.py --doctest + + - name: Install dev dependencies and run example tests + if: matrix.os != 'windows-latest' + run: | + export LD_LIBRARY_PATH=$HOME/.local/lib:scikits.odes/sundials5/lib:$LD_LIBRARY_PATH + pip install -e .[dev] + python run-tests.py --examples + + - name: Instal and run coverage + if: success() && (matrix.os == 'unbuntu-latest' && matrix.python-version == 3.7) + run: | + pip install coverage codecov + codecov diff --git a/CHANGELOG.md b/CHANGELOG.md index 54454dfd6d..c3d3e72b7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ ## Optimizations +- Implementing the use of GitHub Actions for CI ([#855](https://github.com/pybamm-team/PyBaMM/pull/855)) - Changed default solver for DAE models to `CasadiSolver` ([#978](https://github.com/pybamm-team/PyBaMM/pull/978)) - Added some extra simplifications to the expression tree ([#971](https://github.com/pybamm-team/PyBaMM/pull/971)) - Changed the behaviour of "safe" mode in `CasadiSolver` ([#956](https://github.com/pybamm-team/PyBaMM/pull/956)) @@ -20,6 +21,7 @@ ## Bug fixes +- Fix doctests failing due to mismatch in unsorted output.([#990](https://github.com/pybamm-team/PyBaMM/pull/990)) - Added extra checks when creating a model, for clearer errors ([#971](https://github.com/pybamm-team/PyBaMM/pull/971)) - Fixed `Interpolant` ids to allow processing ([#962](https://github.com/pybamm-team/PyBaMM/pull/962)) - Fixed a bug in the initial conditions of the potential pair model ([#954](https://github.com/pybamm-team/PyBaMM/pull/954)) diff --git a/pybamm/parameters_cli.py b/pybamm/parameters_cli.py index a9a69194fc..e5e45a17a7 100644 --- a/pybamm/parameters_cli.py +++ b/pybamm/parameters_cli.py @@ -148,11 +148,11 @@ def list_parameters(arguments=None): >>> from pybamm.parameters_cli import list_parameters >>> list_parameters(["lithium-ion", "anodes"]) Available package parameters: - * graphite_Ecker2015 * graphite_Chen2020 - * graphite_mcmb2528_Marquis2019 - * graphite_UMBL_Mohtat2020 + * graphite_Ecker2015 * graphite_Kim2011 + * graphite_UMBL_Mohtat2020 + * graphite_mcmb2528_Marquis2019 Available local parameters: """ parser = argparse.ArgumentParser( @@ -179,7 +179,7 @@ def list_parameters(arguments=None): root, package_dirs, files = next(os.walk(package_dir)) print("Available package parameters:") - for dirname in package_dirs: + for dirname in sorted(package_dirs): print(" * {}".format(dirname)) local_dir = os.path.join("input", "parameters", args.battery_type, args.component) @@ -188,5 +188,5 @@ def list_parameters(arguments=None): else: local_dirs = [] print("Available local parameters:") - for dirname in local_dirs: + for dirname in sorted(local_dirs): print(" * {}".format(dirname))