|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - develop |
| 7 | + - release/** |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - master |
| 11 | + - develop |
| 12 | + - release/** |
| 13 | + |
| 14 | +env: |
| 15 | + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) |
| 16 | + BUILD_TYPE: RelWithDebInfo |
| 17 | + |
| 18 | +jobs: |
| 19 | + build: |
| 20 | + # The CMake configure and build commands are platform agnostic and should work equally |
| 21 | + # well on Windows or Mac. You can convert this to a matrix build if you need |
| 22 | + # cross-platform coverage. |
| 23 | + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix |
| 24 | + strategy: |
| 25 | + matrix: |
| 26 | + os: [ ubuntu-latest, macos-latest ] |
| 27 | + runs-on: ${{ matrix.os }} |
| 28 | + |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v2 |
| 31 | + |
| 32 | + - name: Create Build Environment |
| 33 | + # Some projects don't allow in-source building, so create a separate build directory |
| 34 | + # We'll use this as our working directory for all subsequent commands |
| 35 | + run: cmake -E make_directory ${{github.workspace}}/build |
| 36 | + |
| 37 | + - name: Get Conan |
| 38 | + # You may pin to the exact commit or the version. |
| 39 | + # uses: turtlebrowser/get-conan@4dc7e6dd45c8b1e02e909979d7cfc5ebba6ddbe2 |
| 40 | + uses: turtlebrowser/[email protected] |
| 41 | + |
| 42 | + - name: Conan profile |
| 43 | + run: | |
| 44 | + conan profile new --detect default |
| 45 | +
|
| 46 | + - name: Conan profile (linux) |
| 47 | + if: matrix.os == 'ubuntu-latest' |
| 48 | + run: |
| 49 | + conan profile update settings.compiler.libcxx=libstdc++11 default |
| 50 | + |
| 51 | + - name: Conan install |
| 52 | + working-directory: ${{github.workspace}}/build |
| 53 | + run: conan install .. |
| 54 | + |
| 55 | + - name: linux package install |
| 56 | + if: matrix.os == 'ubuntu-latest' |
| 57 | + run: | |
| 58 | + sudo apt-get update |
| 59 | + sudo apt-get install --yes --no-install-recommends libpcap-dev pkgconf golang ca-certificates libmaxminddb-dev jq |
| 60 | +
|
| 61 | + - name: osx package install |
| 62 | + if: matrix.os == 'macos-latest' |
| 63 | + run: | |
| 64 | + brew update |
| 65 | + brew install libmaxminddb |
| 66 | +
|
| 67 | + - name: PcapPlusPlus checkout |
| 68 | + run: | |
| 69 | + git clone https://github.com/ns1/PcapPlusPlus.git |
| 70 | + cd PcapPlusPlus |
| 71 | + mkdir ${{github.workspace}}/local |
| 72 | +
|
| 73 | + - name: PcapPlusPlus config (linux) |
| 74 | + if: matrix.os == 'ubuntu-latest' |
| 75 | + working-directory: ${{github.workspace}}/PcapPlusPlus |
| 76 | + run: | |
| 77 | + ./configure-linux.sh --install-dir ${{github.workspace}}/local |
| 78 | +
|
| 79 | + - name: PcapPlusPlus config (macos) |
| 80 | + if: matrix.os == 'macos-latest' |
| 81 | + working-directory: ${{github.workspace}}/PcapPlusPlus |
| 82 | + run: | |
| 83 | + ./configure-mac_os_x.sh --install-dir ${{github.workspace}}/local |
| 84 | +
|
| 85 | + - name: PcapPlusPlus install |
| 86 | + working-directory: ${{github.workspace}}/PcapPlusPlus |
| 87 | + run: | |
| 88 | + make libs |
| 89 | + make install -j 2 |
| 90 | +
|
| 91 | + - name: Configure CMake |
| 92 | + # Use a bash shell so we can use the same syntax for environment variable |
| 93 | + # access regardless of the host operating system |
| 94 | + shell: bash |
| 95 | + working-directory: ${{github.workspace}}/build |
| 96 | + # Note the current convention is to use the -S and -B options here to specify source |
| 97 | + # and build directories, but this is only available with CMake 3.13 and higher. |
| 98 | + # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 |
| 99 | + run: PKG_CONFIG_PATH=${{github.workspace}}/local/lib/pkgconfig cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE |
| 100 | + |
| 101 | + - name: Build |
| 102 | + working-directory: ${{github.workspace}}/build |
| 103 | + shell: bash |
| 104 | + # Execute the build. You can specify a specific target with "--target <NAME>" |
| 105 | + run: cmake --build . --config $BUILD_TYPE -- -j 2 |
| 106 | + |
| 107 | + - name: Test |
| 108 | + working-directory: ${{github.workspace}}/build |
| 109 | + shell: bash |
| 110 | + # Execute tests defined by the CMake configuration. |
| 111 | + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail |
| 112 | + run: ctest -C $BUILD_TYPE |
0 commit comments