|
| 1 | +name: Tests |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [ master ] |
| 5 | + pull_request: |
| 6 | + branches: [ master ] |
| 7 | +jobs: |
| 8 | + |
| 9 | + tests: |
| 10 | + runs-on: ${{ matrix.os }} |
| 11 | + |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + os: [ ubuntu-latest ] # , macos-latest, windows-latest ] |
| 15 | + python-version: [ "3.6", "3.7", "3.8" ] |
| 16 | + include: |
| 17 | + - os: ubuntu-latest |
| 18 | + path: ~/.cache/pip |
| 19 | + #- os: macos-latest |
| 20 | + # path: ~/Library/Caches/pip |
| 21 | + #- os: windows-latest |
| 22 | + # path: ~\AppData\Local\pip\Cache |
| 23 | + |
| 24 | + # https://docs.github.com/en/free-pro-team@latest/actions/guides/about-service-containers |
| 25 | + services: |
| 26 | + |
| 27 | + # TODO: Maybe use https://github.com/marketplace/actions/mosquitto-mqtt-broker-in-github-actions |
| 28 | + mosquitto: |
| 29 | + image: eclipse-mosquitto:1.6.12 |
| 30 | + ports: |
| 31 | + - 1883:1883 |
| 32 | + - 9001:9001 |
| 33 | + |
| 34 | + influxdb: |
| 35 | + image: influxdb:1.8.3 |
| 36 | + ports: |
| 37 | + - 8083:8083 |
| 38 | + - 8086:8086 |
| 39 | + |
| 40 | + grafana: |
| 41 | + image: grafana/grafana:7.3.3 |
| 42 | + ports: |
| 43 | + - 3000:3000 |
| 44 | + env: |
| 45 | + GF_SECURITY_ADMIN_PASSWORD: admin |
| 46 | + |
| 47 | + mongodb: |
| 48 | + image: mongo:4.4.3 |
| 49 | + ports: |
| 50 | + - 27017:27017 |
| 51 | + |
| 52 | + env: |
| 53 | + OS: ${{ matrix.os }} |
| 54 | + PYTHON: ${{ matrix.python-version }} |
| 55 | + |
| 56 | + name: Python ${{ matrix.python-version }} on OS ${{ matrix.os }} |
| 57 | + steps: |
| 58 | + |
| 59 | + - name: Acquire sources |
| 60 | + uses: actions/checkout@v2 |
| 61 | + |
| 62 | + - name: Setup Python |
| 63 | + uses: actions/setup-python@v2 |
| 64 | + with: |
| 65 | + python-version: ${{ matrix.python-version }} |
| 66 | + architecture: x64 |
| 67 | + |
| 68 | + - name: Apply caching of dependencies |
| 69 | + uses: actions/cache@v2 |
| 70 | + with: |
| 71 | + path: ${{ matrix.path }} |
| 72 | + key: ${{ runner.os }}-pip-${{ hashFiles('setup.py', 'requirements-dev.txt', 'requirements-test.txt', 'requirements-docs.txt') }} |
| 73 | + restore-keys: | |
| 74 | + ${{ runner.os }}-pip- |
| 75 | +
|
| 76 | + - name: Install program |
| 77 | + run: | |
| 78 | + pip install --requirement=requirements-dev.txt |
| 79 | + pip install --requirement=requirements-test.txt |
| 80 | + pip install --editable=.[daq,daq_geospatial,export,scientific,firmware] |
| 81 | +
|
| 82 | + - name: Run tests |
| 83 | + run: | |
| 84 | +
|
| 85 | + # Run unit- and integration-tests |
| 86 | + pytest kotori test |
| 87 | +
|
| 88 | + # Run doctests |
| 89 | + export NOSE_IGNORE_FILES="test_.*\.py" |
| 90 | + nosetests \ |
| 91 | + --with-doctest --doctest-tests --doctest-extension=rst \ |
| 92 | + kotori/*.py \ |
| 93 | + kotori/daq/{application,graphing,services,storage,strategy} \ |
| 94 | + kotori/daq/intercom/{mqtt/paho.py,udp.py,wamp.py} \ |
| 95 | + kotori/firmware kotori/io kotori/vendor/hiveeyes |
| 96 | +
|
| 97 | + - name: Setup Graphviz |
| 98 | + uses: ts-graphviz/setup-graphviz@v1 |
| 99 | + |
| 100 | + - name: Build documentation |
| 101 | + run: | |
| 102 | + pip install --requirement=requirements-docs.txt |
| 103 | + SPHINXOPTS="-j auto" make --directory=doc html |
0 commit comments