Subversion Repositories rld.domoticz

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download

name: Domoticz PR Check

on:
  pull_request:
    branches:
      - development
      - master

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0

      # Prepare environment
      - name: prepare environment
        run: |
          sudo timedatectl set-timezone Europe/Amsterdam
          if [ "${GITHUB_EVENT_NAME}" == 'pull_request' ]; then
            echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
            echo "PRNUMBER=$(echo ${GITHUB_EVENT_ISSUE_NUMBER})" >> $GITHUB_ENV
          else
            echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
            echo "PRNUMBER=$(echo ${GITHUB_SHA})" >> $GITHUB_ENV
          fi
          buildnr=$(git rev-list HEAD --count)
          echo "BUILDNR=$(($buildnr + 2107))" >> $GITHUB_ENV

      # install dependencies
      - name: dependencies
        run: |
          sudo apt-get update && sudo apt-get --autoremove upgrade
          sudo apt-get install make gcc g++ libssl-dev git libcurl4-gnutls-dev libusb-dev python3-dev zlib1g-dev libcereal-dev liblua5.3-dev uthash-dev
          sudo apt-get install python3-pytest python3-pytest-bdd
          sudo apt-get install lua5.3 luarocks
          sudo luarocks install busted
          sudo luarocks install luacov
          sudo luarocks install lodash

      # get CMake
      - name: cmake-compile
        run: |
          curl -sSL https://github.com/Kitware/CMake/releases/download/v3.19.3/cmake-3.19.3-Linux-x86_64.tar.gz -o cmake.tar.gz;
          sudo tar xf cmake.tar.gz --strip 1 -C /usr/local;
          export PATH=/usr/local/bin:$PATH;

      # Boost
      - name: build boost libraries
        run: |
          wget https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz >> /dev/null 2>&1
          tar xfz boost_1_76_0.tar.gz
          cd boost_1_76_0/
          ./bootstrap.sh
          ./b2 stage threading=multi link=static --with-thread --with-system --with-chrono >> /dev/null 2>&1
          sudo ./b2 install threading=multi link=static --with-thread --with-system --with-chrono >> /dev/null 2>&1

      # OpenZWave
      - name: openzwave
        run: |
          cd $GITHUB_WORKSPACE
          cd ..
          git clone https://github.com/domoticz/open-zwave.git open-zwave-read-only
          cd open-zwave-read-only
          make
          sudo make install >> /dev/null 2>&1

      # Domoticz
      - name: build domoticz
        run: |
          cd $GITHUB_WORKSPACE
          cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_LIBRARY_PATH=open-zwave-read-only CMakeLists.txt
          make

      # Run automated tests
      - name: unit-tests domoticz-dzVents
        run: |
          cd $GITHUB_WORKSPACE/dzVents/runtime/tests
          busted --coverage -o TAP *
          luacov
          tail -19 luacov.report.out
        continue-on-error: true

      - name: functional-tests domoticz
        run: |
          cd $GITHUB_WORKSPACE
          ln -s ../test/gherkin/resources/testwebcontent www/test
          sudo ./domoticz -sslwww 0 -wwwroot www -pidfile /var/run/domoticz.pid -daemon
          pytest-3 -rA --tb=no test/gherkin/
          sudo kill -s TERM `sudo cat /var/run/domoticz.pid`
        continue-on-error: true

      # Upload artifacts
      #- uses: actions/upload-artifact@v2
      #  with:
      #    name: Domoticz-${{ env.BUILDNR }}-${{ env.BRANCH_NAME }}
      #    path: |
      #      domoticz
      #      appversion.h.txt
      #      www/
      #      lib/
      #      !**/*.tar.gz
      #    retention-days: 7