name: build on: push: branches: [ master ] pull_request: branches: [ master ] jobs: clang-format: name: ClangFormat check runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Format code run: find src/ test/ -iname '*.c' -or -iname '*.cpp' -or -iname '*.m' -or -iname '*.mm' -or -iname '*.h' -or -iname '*.hpp' | xargs clang-format -i -style=file - name: Check diff run: git diff --exit-code build-ubuntu: name: Ubuntu (${{ matrix.os }}, ${{ matrix.portal.name }}, ${{ matrix.compiler.c }}, C++${{ matrix.cppstd }}) runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, ubuntu-18.04] portal: [ {flag: OFF, dep: libgtk-3-dev, name: GTK}, {flag: ON, dep: libdbus-1-dev, name: Portal} ] # The NFD_PORTAL setting defaults to OFF (i.e. uses GTK) compiler: [ {c: gcc, cpp: g++}, {c: clang, cpp: clang++} ] # The default compiler is gcc/g++ cppstd: [23, 11] steps: - name: Checkout uses: actions/checkout@v2 - name: Installing Dependencies run: sudo apt-get update && sudo apt-get install ${{ matrix.portal.dep }} - name: Configure run: mkdir build && mkdir install && cd build && cmake -DCMAKE_INSTALL_PREFIX="../install" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${{ matrix.compiler.c }} -DCMAKE_CXX_COMPILER=${{ matrix.compiler.cpp }} -DCMAKE_CXX_STANDARD=${{ matrix.cppstd }} -DCMAKE_CXX_FLAGS="-Wall -Wextra -Werror -pedantic" -DNFD_PORTAL=${{ matrix.portal.flag }} -DNFD_BUILD_TESTS=ON .. - name: Build run: cmake --build build --target install - name: Upload test binaries uses: actions/upload-artifact@v2 with: name: $${{ matrix.os }} - $${{ matrix.compiler.c }} path: | build/src/libnfd.a build/test/test_* build-macos-clang: name: MacOS latest - Clang runs-on: macos-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Configure run: mkdir build && mkdir install && cd build && cmake -DCMAKE_INSTALL_PREFIX="../install" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Wall -Wextra -Werror -pedantic" -DNFD_BUILD_TESTS=ON .. - name: Build run: cmake --build build --target install - name: Upload test binaries uses: actions/upload-artifact@v2 with: name: MacOS latest - Clang path: | build/src/libnfd.a build/test/test_* build-windows-msvc: name: Windows latest - MSVC runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Configure run: mkdir build && mkdir install && cd build && cmake -DCMAKE_INSTALL_PREFIX="../install" -DNFD_BUILD_TESTS=ON .. - name: Build run: cmake --build build --target install --config Release - name: Upload test binaries uses: actions/upload-artifact@v2 with: name: Windows latest - MSVC path: | build/src/Release/nfd.lib build/test/Release/test_* build-windows-clang: name: Windows latest - Clang runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Configure run: mkdir build && mkdir install && cd build && cmake -DCMAKE_INSTALL_PREFIX="../install" -T ClangCL -DNFD_BUILD_TESTS=ON .. - name: Build run: cmake --build build --target install --config Release - name: Upload test binaries uses: actions/upload-artifact@v2 with: name: Windows latest - Clang path: | build/src/Release/nfd.lib build/test/Release/test_* build-windows-mingw: name: Windows latest - MinGW runs-on: windows-latest defaults: run: shell: msys2 {0} steps: - name: Checkout uses: actions/checkout@v2 - name: Set up MinGW-w64 uses: msys2/setup-msys2@v2 with: path-type: minimal install: >- base-devel mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake - name: Configure run: mkdir build && mkdir install && cd build && cmake -DCMAKE_INSTALL_PREFIX="../install" -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ -G 'MSYS Makefiles' -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Wall -Wextra -Werror -pedantic" -DNFD_BUILD_TESTS=ON .. - name: Build run: cmake --build build --target install - name: Upload test binaries uses: actions/upload-artifact@v2 with: name: Windows latest - MinGW path: | build/src/libnfd.a build/test/test_*