From 6fc5944fa12658bdcffc49cf5a988529b29c1417 Mon Sep 17 00:00:00 2001 From: Diego Date: Mon, 24 Feb 2020 16:45:24 +0000 Subject: [PATCH] Add GitHub CI. --- .github/workflows/test_on_push.yml | 95 ++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 .github/workflows/test_on_push.yml diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml new file mode 100644 index 0000000000..ba9d724656 --- /dev/null +++ b/.github/workflows/test_on_push.yml @@ -0,0 +1,95 @@ +name: PyBaMM + +on: [push] + +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 + 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] + + env: + LD_LIBRARY_PATH: 'SuiteSparse-5.6.0/lib:sundials/lib' + + 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 libsuitesparse-dev + sudo apt install python${{ matrix.python-version }}.dev + + - name: Install MacOS system dependencies + if: matrix.os == 'macos-latest' + run: | + brew update + brew install graphviz openssl readline + brew install gcc cmake openblas suitesparse + + - 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 + pip install . + + - name: Install SUNDIALS and SuiteSparse + if: matrix.os != 'windows-latest' + run: | + pip install wget + python setup.py install_odes -f + mkdir -p third-party/pybind11 + git clone https://github.com/pybind/pybind11.git third-party/pybind11 + python setup.py install_klu -f + + - name: Run unit tests + run: | + echo Sundials library path: $LD_LIBRARY_PATH + python run-tests.py --unit --folder all + + - name: Install docs dependencies and run doctests + if: matrix.os != 'windows-latest' + run: | + pip install -e .[docs] + python run-tests.py --doctest + + - name: Install dev python dependencies and run style and example tests + if: matrix.os != 'windows-latest' + run: | + 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