| name: "MiNiFi-CPP CI" |
| on: [push, pull_request, workflow_dispatch] |
| jobs: |
| macos_xcode_12_0: |
| name: "macos-xcode12.0" |
| runs-on: macos-10.15 |
| timeout-minutes: 90 |
| env: |
| CCACHE_BASEDIR: ${{ GITHUB.WORKSPACE }} |
| CCACHE_DIR: ${{ GITHUB.WORKSPACE }}/.ccache |
| steps: |
| - id: checkout |
| uses: actions/checkout@v2 |
| - id: cache |
| uses: actions/cache@v2 |
| with: |
| path: ${{ env.CCACHE_DIR }} |
| key: macos-xcode12.0-ccache-${{github.ref}}-${{github.sha}} |
| restore-keys: | |
| macos-xcode12.0-ccache-${{github.ref}}- |
| macos-xcode12.0-ccache-refs/heads/main- |
| - id: install_dependencies |
| run: | |
| brew update |
| brew install ossp-uuid boost flex lua ccache sqliteodbc automake autoconf |
| - id: setup_env |
| name: setup enviroment |
| run: | |
| echo "PATH=/usr/lib/ccache:/usr/local/opt/ccache/bin:/usr/local/opt/ccache/libexec:$PATH" >> $GITHUB_ENV |
| echo -e "127.0.0.1\t$HOSTNAME" | sudo tee -a /etc/hosts > /dev/null |
| sudo xcode-select -switch /Applications/Xcode_12.app |
| - name: build |
| run: | |
| export PATH="/usr/local/opt/flex/bin:$PATH" |
| export LDFLAGS="-L/usr/local/opt/flex/lib" |
| export CPPFLAGS="-I/usr/local/opt/flex/include" |
| # CPPFLAGS are not recognized by cmake, so we have to force them to CFLAGS and CXXFLAGS to have flex 2.6 working |
| ./bootstrap.sh -e -t && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="${CPPFLAGS} ${CFLAGS}" -DCMAKE_CXX_FLAGS="${CPPFLAGS} ${CXXFLAGS}" -DENABLE_SCRIPTING=ON -DENABLE_LUA_SCRIPTING=ON -DENABLE_SQL=ON -DUSE_REAL_ODBC_TEST_DRIVER=ON -DENABLE_AZURE=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES=OFF -DSTRICT_GSL_CHECKS=AUDIT -DFAIL_ON_WARNINGS=ON .. && cmake --build . --parallel 4 |
| - name: test |
| run: cd build && make test ARGS="--timeout 300 -j4 --output-on-failure" |
| - name: linter |
| run: cd build && make linter |
| windows_VS2019: |
| name: "windows-vs2019" |
| runs-on: windows-2019 |
| timeout-minutes: 180 |
| env: |
| CLCACHE_DIR: ${{ GITHUB.WORKSPACE }}\clcache |
| steps: |
| - name: Support longpaths |
| run: git config --system core.longpaths true |
| - id: checkout |
| uses: actions/checkout@v2 |
| - id: cache |
| uses: actions/cache@v2 |
| with: |
| path: ${{ env.CLCACHE_DIR }} |
| key: windows-vs2019-clcache-${{github.ref}}-${{github.sha}} |
| restore-keys: | |
| windows-vs2019-clcache-${{github.ref}}- |
| windows-vs2019-clcache-refs/heads/main- |
| - name: Setup PATH |
| uses: microsoft/setup-msbuild@v1.0.2 |
| - id: install-sqliteodbc-driver |
| run: | |
| Invoke-WebRequest -Uri "http://www.ch-werner.de/sqliteodbc/sqliteodbc_w64.exe" -OutFile "sqliteodbc_w64.exe" |
| ./sqliteodbc_w64.exe /S |
| shell: powershell |
| - name: Setup clcache |
| run: | |
| (New-Object System.Net.WebClient).DownloadFile('https://github.com/frerich/clcache/releases/download/v4.2.0/clcache-4.2.0.zip', "$pwd\clcache.zip") |
| $cl_exe_dir = Split-Path -parent $(vswhere -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -find VC\Tools\MSVC\**\bin\Hostx64\x64\cl.exe | select-object -last 1) |
| Expand-Archive -Force -Path clcache.zip -DestinationPath "$cl_exe_dir"; |
| move "$cl_exe_dir\cl.exe" "$cl_exe_dir\cl_original.exe" |
| move "$cl_exe_dir\cl.exe.config" "$cl_exe_dir\cl_original.exe.config" |
| move "$cl_exe_dir\clcache.exe" "$cl_exe_dir\cl.exe" |
| echo "CLCACHE_CL=$cl_exe_dir\cl_original.exe" >> $env:GITHUB_ENV |
| echo "CLCACHE_NODIRECT=1" >> $env:GITHUB_ENV |
| - name: build |
| run: | |
| PATH %PATH%;C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64 |
| PATH %PATH%;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Roslyn |
| win_build_vs.bat ..\b /64 /CI /S /A /PDH /K /L /R /Z /N /RO |
| shell: cmd |
| - name: test |
| run: cd ..\b && ctest --timeout 300 --parallel 8 -C Release --output-on-failure |
| shell: cmd |
| - name: linter |
| run: cd ..\b && msbuild linter.vcxproj |
| shell: cmd |
| ubuntu_20_04: |
| name: "ubuntu-20.04" |
| runs-on: ubuntu-20.04 |
| timeout-minutes: 120 |
| steps: |
| - id: checkout |
| uses: actions/checkout@v2 |
| - id: cache |
| uses: actions/cache@v2 |
| with: |
| path: ~/.ccache |
| key: ubuntu-20.04-ccache-${{github.ref}}-${{github.sha}} |
| restore-keys: | |
| ubuntu-20.04-ccache-${{github.ref}}- |
| ubuntu-20.04-ccache-refs/heads/main- |
| - id: install_deps |
| run: | |
| sudo apt update |
| sudo apt install -y ccache libfl-dev libpcap-dev libboost-all-dev openjdk-8-jdk maven libusb-1.0-0-dev libpng-dev libgps-dev libsqliteodbc flake8 lua5.3 liblua5.3-dev |
| echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV |
| echo -e "127.0.0.1\t$HOSTNAME" | sudo tee -a /etc/hosts > /dev/null |
| - name: build |
| run: | |
| ./bootstrap.sh -e -t |
| cd build |
| export CC=gcc-11 |
| export CXX=g++-11 |
| cmake -DUSE_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DSTRICT_GSL_CHECKS=AUDIT -DFAIL_ON_WARNINGS=ON -DENABLE_AWS=ON -DENABLE_AZURE=ON -DENABLE_BUSTACHE=ON -DENABLE_COAP=ON \ |
| -DENABLE_ENCRYPT_CONFIG=ON -DENABLE_GPS=ON -DENABLE_JNI=ON -DENABLE_LIBRDKAFKA=ON -DENABLE_LINTER=ON -DENABLE_MQTT=ON -DENABLE_NANOFI=ON -DENABLE_OPC=ON -DENABLE_OPENCV=ON \ |
| -DENABLE_OPENWSMAN=ON -DENABLE_OPS=ON -DENABLE_PCAP=ON -DENABLE_PYTHON=ON -DENABLE_SENSORS=ON -DENABLE_SFTP=ON -DENABLE_SQL=ON -DENABLE_SYSTEMD=ON -DENABLE_TENSORFLOW=OFF \ |
| -DENABLE_USB_CAMERA=ON -DENABLE_SCRIPTING=ON -DENABLE_LUA_SCRIPTING=ON .. |
| make -j$(nproc) VERBOSE=1 |
| - name: test |
| run: cd build && make test ARGS="--timeout 300 -j2 --output-on-failure" |
| - name: linter |
| run: cd build && make linter |
| - name: shellcheck |
| run: cd build && make shellcheck |
| - id: flake8_check |
| run: cd build && make flake8 |
| ubuntu_20_04_clang: |
| name: "ubuntu-20.04-clang" |
| runs-on: ubuntu-20.04 |
| timeout-minutes: 120 |
| steps: |
| - id: checkout |
| uses: actions/checkout@v2 |
| - id: cache |
| uses: actions/cache@v2 |
| with: |
| path: ~/.ccache |
| key: ubuntu-20.04-all-clang-ccache-${{github.ref}}-${{github.sha}} |
| restore-keys: | |
| ubuntu-20.04-all-clang-ccache-${{github.ref}}- |
| ubuntu-20.04-all-clang-ccache-refs/heads/main- |
| - id: install_deps |
| run: | |
| sudo apt update |
| sudo apt install -y ccache libfl-dev libpcap-dev libboost-all-dev openjdk-8-jdk maven libusb-1.0-0-dev libpng-dev libgps-dev |
| echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV |
| echo -e "127.0.0.1\t$HOSTNAME" | sudo tee -a /etc/hosts > /dev/null |
| - name: build |
| run: | |
| ./bootstrap.sh -e -t |
| cd build |
| export CC=clang |
| export CXX=clang++ |
| cmake -DUSE_SHARED_LIBS= -DCMAKE_BUILD_TYPE=Release -DENABLE_MQTT=ON -DENABLE_LIBRDKAFKA=ON -DENABLE_AWS=ON -DENABLE_AZURE=ON -DFAIL_ON_WARNINGS=ON .. |
| cmake --build . --parallel $(nproc) |
| - name: test |
| run: cd build && make test ARGS="--timeout 300 -j8 --output-on-failure" |
| centos: |
| name: "centos" |
| runs-on: ubuntu-20.04 |
| timeout-minutes: 60 |
| steps: |
| - id: checkout |
| uses: actions/checkout@v2 |
| - id: cache |
| uses: actions/cache@v2 |
| with: |
| path: ~/.ccache |
| key: centos-ccache-${{github.ref}}-${{github.sha}} |
| restore-keys: | |
| centos-ccache-${{github.ref}}- |
| centos-ccache-refs/heads/main- |
| - id: install_deps |
| run: | |
| sudo apt update |
| sudo apt install -y ccache |
| echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV |
| - id: build |
| run: mkdir build && cd build && cmake -DSTRICT_GSL_CHECKS=AUDIT .. && make centos |
| docker_integration_tests: |
| name: "Docker integration tests" |
| runs-on: ubuntu-20.04 |
| timeout-minutes: 120 |
| steps: |
| - id: checkout |
| uses: actions/checkout@v2 |
| - id: cache |
| uses: actions/cache@v2 |
| with: |
| path: ~/.ccache |
| key: docker-ccache-${{github.ref}}-${{github.sha}} |
| restore-keys: | |
| docker-ccache-${{github.ref}}- |
| docker-ccache-refs/heads/main |
| - id: build |
| run: | |
| if [ -d ~/.ccache ]; then mv ~/.ccache .; fi |
| mkdir build |
| cd build |
| cmake -DUSE_SHARED_LIBS= -DSTRICT_GSL_CHECKS=AUDIT -DENABLE_JNI=OFF -DDISABLE_JEMALLOC=ON -DENABLE_AWS=ON -DENABLE_LIBRDKAFKA=ON -DENABLE_MQTT=ON -DENABLE_AZURE=ON -DENABLE_SQL=ON -DDOCKER_BUILD_ONLY=ON -DDOCKER_CCACHE_DUMP_LOCATION=$HOME/.ccache .. |
| make docker |
| - id: install_deps |
| run: | |
| sudo apt update |
| sudo apt install -y python3-virtualenv |
| - id: test |
| run: cd build && make docker-verify |