|
| 1 | +name: Build PR(s) and master branch. |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + pull_request: |
| 7 | + branches: |
| 8 | + - master |
| 9 | + types: [opened, reopened, synchronize] |
| 10 | +jobs: |
| 11 | + build-windows: |
| 12 | + name: Build sources on amd64 for ${{ matrix.os }} |
| 13 | + runs-on: ${{ matrix.os }} |
| 14 | + strategy: |
| 15 | + fail-fast: false |
| 16 | + matrix: |
| 17 | + os: [windows-latest, windows-2019] |
| 18 | + permissions: |
| 19 | + contents: read |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + submodules: true |
| 24 | + |
| 25 | + - name: Build on ${{ matrix.os }} with vs-2019 |
| 26 | + run: | |
| 27 | + .\scripts\win_build.bat |
| 28 | +
|
| 29 | + - name: Run unit tests. |
| 30 | + run: | |
| 31 | + ctest --rerun-failed --output-on-failure -C Debug --test-dir .\tests\ |
| 32 | +
|
| 33 | + build-centos: |
| 34 | + name: CentOS 7 build to confirm no issues once used downstream |
| 35 | + runs-on: ubuntu-latest |
| 36 | + container: centos:7 |
| 37 | + permissions: |
| 38 | + contents: none |
| 39 | + steps: |
| 40 | + - name: Set up base image dependencies |
| 41 | + run: | |
| 42 | + sed -i -e "s/^mirrorlist=http:\/\/mirrorlist.centos.org/#mirrorlist=http:\/\/mirrorlist.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo |
| 43 | + sed -i -e "s/^#baseurl=http:\/\/mirror.centos.org/baseurl=http:\/\/vault.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo |
| 44 | + yum -y update && \ |
| 45 | + yum install -y ca-certificates cmake curl-devel gcc gcc-c++ git make wget && \ |
| 46 | + yum install -y epel-release |
| 47 | + yum install -y cmake3 |
| 48 | + shell: bash |
| 49 | + |
| 50 | + - name: Clone repo without submodules (1.8.3 version of Git) |
| 51 | + run: | |
| 52 | + git clone https://github.com/fluent/cprofiles.git |
| 53 | + shell: bash |
| 54 | + |
| 55 | + - name: Check out the branch (1.8.3 version of Git) |
| 56 | + env: |
| 57 | + BRANCH_NAME: ${{ github.head_ref }} |
| 58 | + run: | |
| 59 | + git checkout "$BRANCH_NAME" |
| 60 | + shell: bash |
| 61 | + working-directory: cprofiles |
| 62 | + |
| 63 | + - name: Fetch the appropriate sub modules |
| 64 | + run: | |
| 65 | + git submodule init |
| 66 | + git submodule update |
| 67 | + shell: bash |
| 68 | + working-directory: cprofiles |
| 69 | + |
| 70 | + - name: Run compilation |
| 71 | + run: | |
| 72 | + cmake3 -DCPROF_DEV=on ../ |
| 73 | + make |
| 74 | + shell: bash |
| 75 | + working-directory: cprofiles/build |
| 76 | + |
| 77 | + build-unix-arm64: |
| 78 | + name: Build sources on arm64 for ${{ matrix.os }} - ${{ matrix.compiler }} |
| 79 | + runs-on: ${{ matrix.os }} |
| 80 | + strategy: |
| 81 | + fail-fast: false |
| 82 | + matrix: |
| 83 | + os: [ubuntu-latest] |
| 84 | + compiler: [ gcc, clang ] |
| 85 | + permissions: |
| 86 | + contents: read |
| 87 | + steps: |
| 88 | + - uses: actions/checkout@v4 |
| 89 | + with: |
| 90 | + submodules: true |
| 91 | + |
| 92 | + - name: Build on ${{ matrix.os }} with ${{ matrix.compiler }} |
| 93 | + |
| 94 | + with: |
| 95 | + arch: aarch64 |
| 96 | + distro: ubuntu20.04 |
| 97 | + run: | |
| 98 | + apt-get update && \ |
| 99 | + apt-get install -y --no-install-recommends \ |
| 100 | + build-essential \ |
| 101 | + cmake \ |
| 102 | + file \ |
| 103 | + make |
| 104 | + export CC=${{ env.compiler }} |
| 105 | + cd build |
| 106 | + cmake -DCPROF_TESTS=On ../ |
| 107 | + cmake --build . |
| 108 | + CTEST_OUTPUT_ON_FAILURE=1 ctest |
| 109 | + env: |
| 110 | + CC: ${{ matrix.compiler }} |
| 111 | + |
| 112 | + build-unix-amd64: |
| 113 | + name: Build sources on amd64 for ${{ matrix.os }} - ${{ matrix.compiler }} |
| 114 | + runs-on: ${{ matrix.os }} |
| 115 | + strategy: |
| 116 | + fail-fast: false |
| 117 | + matrix: |
| 118 | + os: [ubuntu-latest, macos-latest] |
| 119 | + compiler: [ gcc, clang ] |
| 120 | + permissions: |
| 121 | + contents: read |
| 122 | + steps: |
| 123 | + - uses: actions/checkout@v4 |
| 124 | + with: |
| 125 | + submodules: true |
| 126 | + |
| 127 | + - name: Build on ${{ matrix.os }} with ${{ matrix.compiler }} |
| 128 | + run: | |
| 129 | + echo "CC = $CC, CXX = $CXX" |
| 130 | + cmake -DCPROF_TESTS=On ../ |
| 131 | + cmake --build . |
| 132 | + CTEST_OUTPUT_ON_FAILURE=1 ctest |
| 133 | + shell: bash |
| 134 | + working-directory: build |
| 135 | + env: |
| 136 | + CC: ${{ matrix.compiler }} |
| 137 | + |
| 138 | + build-analysis-tests: |
| 139 | + name: Build with various code analysis tools |
| 140 | + strategy: |
| 141 | + fail-fast: false |
| 142 | + matrix: |
| 143 | + preset: |
| 144 | + - clang-sanitize-address |
| 145 | + - clang-sanitize-memory |
| 146 | + - clang-sanitize-undefined |
| 147 | + - clang-sanitize-dataflow |
| 148 | + - clang-sanitize-safe-stack |
| 149 | + - valgrind |
| 150 | + permissions: |
| 151 | + contents: read |
| 152 | + runs-on: ubuntu-latest |
| 153 | + steps: |
| 154 | + - uses: actions/checkout@v4 |
| 155 | + with: |
| 156 | + submodules: true |
| 157 | + |
| 158 | + - uses: docker://lpenz/ghaction-cmake:0.19 |
| 159 | + with: |
| 160 | + preset: ${{ matrix.preset }} |
| 161 | + # dependencies_debian: '' |
| 162 | + cmakeflags: '-DCPROF_TESTS=On -DCPROF_DEV=on .' |
| 163 | + build_command: make all |
0 commit comments