|
| 1 | +# Copyright (c) 2020 The University of Manchester |
| 2 | +# |
| 3 | +# This program is free software: you can redistribute it and/or modify |
| 4 | +# it under the terms of the GNU General Public License as published by |
| 5 | +# the Free Software Foundation, either version 3 of the License, or |
| 6 | +# (at your option) any later version. |
| 7 | +# |
| 8 | +# This program is distributed in the hope that it will be useful, |
| 9 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | +# GNU General Public License for more details. |
| 12 | +# |
| 13 | +# You should have received a copy of the GNU General Public License |
| 14 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | + |
| 16 | +# This workflow will install Python dependencies, run tests, lint and rat with a variety of Python versions |
| 17 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
| 18 | + |
| 19 | +name: Python Actions |
| 20 | + |
| 21 | +on: [push] |
| 22 | + |
| 23 | +jobs: |
| 24 | + build: |
| 25 | + |
| 26 | + runs-on: ubuntu-latest |
| 27 | + strategy: |
| 28 | + matrix: |
| 29 | + python-version: [2.7, 3.6, 3.7, 3.8] |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Set up Python ${{ matrix.python-version }} |
| 33 | + uses: actions/setup-python@v2 |
| 34 | + with: |
| 35 | + python-version: ${{ matrix.python-version }} |
| 36 | + |
| 37 | + - name: Checkout |
| 38 | + uses: actions/checkout@v2 |
| 39 | + - name: Checkout SupportScripts |
| 40 | + uses: actions/checkout@v2 |
| 41 | + with: |
| 42 | + repository: SpiNNakerManchester/SupportScripts |
| 43 | + path: support |
| 44 | + |
| 45 | + - name: Checkout Spinnaker Dependencies |
| 46 | + run: | |
| 47 | + support/gitclone2.sh https://github.com/SpiNNakerManchester/SpiNNUtils.git |
| 48 | + support/gitclone2.sh https://github.com/SpiNNakerManchester/SpiNNMachine.git |
| 49 | + support/gitclone2.sh https://github.com/SpiNNakerManchester/SpiNNMan.git |
| 50 | + support/gitclone2.sh https://github.com/SpiNNakerManchester/PACMAN.git |
| 51 | + support/gitclone2.sh https://github.com/SpiNNakerManchester/DataSpecification.git |
| 52 | + support/gitclone2.sh https://github.com/SpiNNakerManchester/spalloc.git |
| 53 | + support/gitclone2.sh git://github.com/SpiNNakerManchester/SpiNNFrontEndCommon.git |
| 54 | +
|
| 55 | + - name: Install -pip |
| 56 | + run: | |
| 57 | + python -m pip install --upgrade pip |
| 58 | + pip install 'pylint<2.5' python-coveralls 'coverage>=4.4,<5.0' |
| 59 | +
|
| 60 | + - name: Install SpiNNUtils |
| 61 | + run: python setup.py install |
| 62 | + working-directory: SpiNNUtils |
| 63 | + |
| 64 | + - name: Install SpiNNMachine |
| 65 | + run: python setup.py install |
| 66 | + working-directory: SpiNNMachine |
| 67 | + |
| 68 | + - name: Install SpiNNMan |
| 69 | + run: python setup.py install |
| 70 | + working-directory: SpiNNMan |
| 71 | + |
| 72 | + - name: preinstall pacman requirements (2.7 only) |
| 73 | + if: matrix.python-version == 2.7 |
| 74 | + run: pip install -r requirements.txt |
| 75 | + working-directory: PACMAN |
| 76 | + |
| 77 | + - name: Install PACMAN |
| 78 | + run: python setup.py install |
| 79 | + working-directory: PACMAN |
| 80 | + |
| 81 | + - name: Install DataSpecification |
| 82 | + run: python setup.py install |
| 83 | + working-directory: DataSpecification |
| 84 | + |
| 85 | + - name: Install spalloc |
| 86 | + run: python setup.py install |
| 87 | + working-directory: spalloc |
| 88 | + |
| 89 | + - name: preinstall SpiNNFrontEndCommon requirements (2.7 Only) |
| 90 | + if: matrix.python-version == 2.7 |
| 91 | + run: pip install -r requirements.txt |
| 92 | + working-directory: SpiNNFrontEndCommon |
| 93 | + |
| 94 | + - name: Install SpiNNFrontEndCommon |
| 95 | + run: python setup.py install |
| 96 | + working-directory: SpiNNFrontEndCommon |
| 97 | + |
| 98 | + - name: Preinstall requirements (2.7 Only) |
| 99 | + if: matrix.python-version == 2.7 |
| 100 | + run: | |
| 101 | + pip install -r requirements.txt |
| 102 | +
|
| 103 | + - name: Setup |
| 104 | + run: | |
| 105 | + python setup.py develop |
| 106 | +
|
| 107 | + - name: Install requirements-test |
| 108 | + run: | |
| 109 | + pip install -r requirements-test.txt |
| 110 | +
|
| 111 | + - name: Create a spynnaker.cfg |
| 112 | + run: | |
| 113 | + echo '[Machine]' > ~/.spynnaker.cfg |
| 114 | + echo "machineName = $SPINNAKER_BOARD_ADDRESS" >> ~/.spynnaker.cfg |
| 115 | + echo "version = ${SPINNAKER_BOARD_VERSION:-5}" >> ~/.spynnaker.cfg |
| 116 | + echo '[Database]' >> ~/.spynnaker.cfg |
| 117 | + echo '[Simulation]' >> ~/.spynnaker.cfg |
| 118 | + echo '[Buffers]' >> ~/.spynnaker.cfg |
| 119 | +
|
| 120 | + - name: Test with pytest and coverage |
| 121 | + if: matrix.python-version == 3.6 |
| 122 | + run: | |
| 123 | + pytest unittests --cov spynnaker |
| 124 | +
|
| 125 | + - name: Test with pytest |
| 126 | + if: matrix.python-version != 3.6 |
| 127 | + run: | |
| 128 | + pytest unittests |
| 129 | +
|
| 130 | + - name: Lint with flake8 |
| 131 | + run: | |
| 132 | + # run flake8 |
| 133 | + flake8 spynnaker unittests |
| 134 | +
|
| 135 | + - name: Lint with pylint |
| 136 | + # Broken in 2.7 as it can not find data_specification.exceptions |
| 137 | + if: matrix.python-version != 2.7 |
| 138 | + # Note that there's special conditioning of the return code of pylint |
| 139 | + run: | |
| 140 | + pylint --output-format=colorized --disable=R,C spynnaker || exit $(($? & 35)) |
| 141 | +
|
| 142 | + - name: Run rat copyright enforcement |
| 143 | + if: matrix.python-version == 3.6 |
| 144 | + run: | |
| 145 | + support/rat.sh download |
| 146 | + support/rat.sh run |
| 147 | +
|
| 148 | + - name: Build documentation with sphinx |
| 149 | + # TODO turn sphinx back on |
| 150 | + if: matrix.python-version == 13.6 |
| 151 | + run: | |
| 152 | + cd doc/source |
| 153 | + sphinx-build -W -T -E -b html -d _build/doctrees-readthedocsdirhtml -D language=en . _build/html |
| 154 | + sphinx-build -W -T -b json -d _build/doctrees-json -D language=en . _build/json |
| 155 | + sphinx-build -W -T -b singlehtml -d _build/doctrees-readthedocssinglehtmllocalmedia -D language=en . _build/localmedia |
| 156 | +
|
| 157 | + - name: Run coveralls and report coverage |
| 158 | + if: matrix.python-version == 3.6 |
| 159 | + env: |
| 160 | + COVERALLS_SERVICE_NAME: 'GitHub CI' |
| 161 | + COVERALLS_REPO_TOKEN : ${{ secrets.COVERALLS_REPO_TOKEN }} |
| 162 | + NODE_COVERALLS_DEBUG: 1 |
| 163 | + run: coveralls |
0 commit comments