|
| 1 | +--- |
| 2 | + |
| 3 | +name: OpenWISP Controller CI Build |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - master |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - master |
| 12 | + |
| 13 | +jobs: |
| 14 | + |
| 15 | + build: |
| 16 | + name: Python==${{ matrix.python-version }} | ${{ matrix.django-version }} |
| 17 | + runs-on: ubuntu-20.04 |
| 18 | + |
| 19 | + services: |
| 20 | + redis: |
| 21 | + image: redis |
| 22 | + ports: |
| 23 | + - 6379:6379 |
| 24 | + |
| 25 | + strategy: |
| 26 | + fail-fast: false |
| 27 | + matrix: |
| 28 | + python-version: |
| 29 | + - 3.6 |
| 30 | + - 3.7 |
| 31 | + django-version: |
| 32 | + - django~=2.2 |
| 33 | + - django~=3.0 |
| 34 | + - django~=3.1 |
| 35 | + |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v2 |
| 38 | + with: |
| 39 | + ref: ${{ github.event.pull_request.head.sha }} |
| 40 | + |
| 41 | + - name: Set up Python ${{ matrix.python-version }} |
| 42 | + uses: actions/setup-python@v2 |
| 43 | + with: |
| 44 | + python-version: ${{ matrix.python-version }} |
| 45 | + |
| 46 | + - name: Install system packages |
| 47 | + run: | |
| 48 | + sudo apt update |
| 49 | + sudo apt-get -qq -y install sqlite3 gdal-bin libproj-dev libgeos-dev libspatialite-dev spatialite-bin libsqlite3-mod-spatialite |
| 50 | +
|
| 51 | + - name: Install python dependencies |
| 52 | + run: | |
| 53 | + pip install -U pip wheel |
| 54 | + pip install -U -r requirements-test.txt |
| 55 | +
|
| 56 | + - name: Install npm dependencies |
| 57 | + run: sudo npm install -g jshint stylelint |
| 58 | + |
| 59 | + - name: Install openwisp-controller |
| 60 | + run: | |
| 61 | + pip install -e . |
| 62 | + pip install ${{ matrix.django-version }} |
| 63 | + ./install-dev.sh |
| 64 | +
|
| 65 | + - name: QA checks |
| 66 | + run: | |
| 67 | + ./run-qa-checks |
| 68 | + - name: Tests |
| 69 | + run: | |
| 70 | + coverage run --source=openwisp_controller runtests.py |
| 71 | + # SAMPLE tests do not influence coverage, so we can speed up tests with --parallel |
| 72 | + SAMPLE_APP=1 ./runtests.py --parallel --keepdb |
| 73 | +
|
| 74 | + - name: Upload Coverage |
| 75 | + run: coveralls |
| 76 | + env: |
| 77 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 78 | + COVERALLS_FLAG_NAME: python-${{ matrix.python-version }}-${{ matrix.django-version }} |
| 79 | + COVERALLS_PARALLEL: true |
| 80 | + |
| 81 | + coveralls: |
| 82 | + name: Finish Coveralls |
| 83 | + needs: build |
| 84 | + runs-on: ubuntu-latest |
| 85 | + container: python:3-slim |
| 86 | + steps: |
| 87 | + - name: Finished |
| 88 | + run: | |
| 89 | + pip3 install --upgrade coveralls |
| 90 | + coveralls --finish |
| 91 | + env: |
| 92 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments