|
| 1 | +# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions |
| 2 | +# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners |
| 3 | +name: CI-unixish-docker |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - 'main' |
| 9 | + - 'releases/**' |
| 10 | + - '2.*' |
| 11 | + tags: |
| 12 | + - '2.*' |
| 13 | + pull_request: |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + |
| 18 | +env: |
| 19 | + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true |
| 20 | + |
| 21 | +jobs: |
| 22 | + build_cmake: |
| 23 | + |
| 24 | + strategy: |
| 25 | + matrix: |
| 26 | + image: ["ubuntu:16.04", "ubuntu:18.04", "ubuntu:24.04", "ubuntu:24.10"] |
| 27 | + include: |
| 28 | + - build_gui: false |
| 29 | + - image: "ubuntu:24.04" |
| 30 | + build_gui: true |
| 31 | + - image: "ubuntu:24.10" |
| 32 | + build_gui: true |
| 33 | + fail-fast: false # Prefer quick result |
| 34 | + |
| 35 | + runs-on: ubuntu-22.04 |
| 36 | + |
| 37 | + # TODO: is this actually applied to the guest? |
| 38 | + env: |
| 39 | + # TODO: figure out why there are cache misses with PCH enabled |
| 40 | + CCACHE_SLOPPINESS: pch_defines,time_macros |
| 41 | + |
| 42 | + container: |
| 43 | + image: ${{ matrix.image }} |
| 44 | + |
| 45 | + steps: |
| 46 | + # we need to stay at v3 for now because Node 20 does not support the older distros |
| 47 | + # /__e/node20/bin/node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /__e/node20/bin/node) |
| 48 | + - uses: actions/checkout@v3 |
| 49 | + if: matrix.image == 'ubuntu:16.04' || matrix.image == 'ubuntu:18.04' |
| 50 | + |
| 51 | + - uses: actions/checkout@v4 |
| 52 | + if: matrix.image != 'ubuntu:16.04' && matrix.image != 'ubuntu:18.04' |
| 53 | + |
| 54 | + - name: Install missing software on ubuntu |
| 55 | + if: contains(matrix.image, 'ubuntu') |
| 56 | + run: | |
| 57 | + apt-get update |
| 58 | + apt-get install -y cmake g++ make libxml2-utils libpcre3-dev |
| 59 | +
|
| 60 | + - name: Install missing software (gui) on latest ubuntu |
| 61 | + if: matrix.build_gui |
| 62 | + run: | |
| 63 | + apt-get install -y qt6-base-dev qt6-charts-dev qt6-tools-dev |
| 64 | +
|
| 65 | + # needs to be called after the package installation since |
| 66 | + # - it doesn't call "apt-get update" |
| 67 | + # |
| 68 | + # needs to be to fixated on 1.2.11 so it works with older images - see https://github.com/hendrikmuhs/ccache-action/issues/178. |
| 69 | + # using the older version will cause a two minute hang in its post-run step. |
| 70 | + - name: ccache |
| 71 | + uses: hendrikmuhs/ccache-action@v1.2.11 |
| 72 | + if: matrix.image == 'ubuntu:16.04' || matrix.image == 'ubuntu:18.04' |
| 73 | + with: |
| 74 | + key: ${{ github.workflow }}-${{ matrix.image }} |
| 75 | + |
| 76 | + # needs to be called after the package installation since |
| 77 | + # - it doesn't call "apt-get update" |
| 78 | + - name: ccache |
| 79 | + uses: hendrikmuhs/ccache-action@v1.2 |
| 80 | + if: matrix.image != 'ubuntu:16.04' && matrix.image != 'ubuntu:18.04' |
| 81 | + with: |
| 82 | + key: ${{ github.workflow }}-${{ matrix.image }} |
| 83 | + |
| 84 | + # tests require CMake 3.9 - ccache available |
| 85 | + - name: CMake build (no tests) |
| 86 | + if: matrix.image == 'ubuntu:16.04' |
| 87 | + run: | |
| 88 | + mkdir cmake.output |
| 89 | + cd cmake.output |
| 90 | + cmake -G "Unix Makefiles" -DHAVE_RULES=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache .. |
| 91 | + cmake --build . -- -j$(nproc) |
| 92 | +
|
| 93 | + - name: CMake build |
| 94 | + if: ${{ !matrix.build_gui && matrix.image != 'ubuntu:16.04' }} |
| 95 | + run: | |
| 96 | + mkdir cmake.output |
| 97 | + cd cmake.output |
| 98 | + cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache .. |
| 99 | + cmake --build . -- -j$(nproc) |
| 100 | +
|
| 101 | + - name: CMake build (with GUI) |
| 102 | + if: matrix.build_gui |
| 103 | + run: | |
| 104 | + cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DUSE_QT6=On -DWITH_QCHART=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache |
| 105 | + cmake --build cmake.output -- -j$(nproc) |
| 106 | +
|
| 107 | + - name: Run CMake test |
| 108 | + if: matrix.image != 'ubuntu:16.04' |
| 109 | + run: | |
| 110 | + cmake --build cmake.output --target check -- -j$(nproc) |
| 111 | +
|
| 112 | + build_make: |
| 113 | + |
| 114 | + strategy: |
| 115 | + matrix: |
| 116 | + image: ["ubuntu:16.04", "ubuntu:18.04", "ubuntu:24.04", "ubuntu:24.10"] |
| 117 | + fail-fast: false # Prefer quick result |
| 118 | + |
| 119 | + runs-on: ubuntu-22.04 |
| 120 | + |
| 121 | + container: |
| 122 | + image: ${{ matrix.image }} |
| 123 | + |
| 124 | + steps: |
| 125 | + # we need to stay at v3 for now because Node 20 does not support the older distros |
| 126 | + # /__e/node20/bin/node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /__e/node20/bin/node) |
| 127 | + - uses: actions/checkout@v3 |
| 128 | + if: matrix.image == 'ubuntu:16.04' || matrix.image == 'ubuntu:18.04' |
| 129 | + |
| 130 | + - uses: actions/checkout@v4 |
| 131 | + if: matrix.image != 'ubuntu:16.04' && matrix.image != 'ubuntu:18.04' |
| 132 | + |
| 133 | + - name: Install missing software on ubuntu |
| 134 | + if: contains(matrix.image, 'ubuntu') |
| 135 | + run: | |
| 136 | + apt-get update |
| 137 | + apt-get install -y g++ make python3 libxml2-utils libpcre3-dev |
| 138 | +
|
| 139 | + # needs to be called after the package installation since |
| 140 | + # - it doesn't call "apt-get update" |
| 141 | + # |
| 142 | + # needs to be to fixated on 1.2.11 so it works with older images - see https://github.com/hendrikmuhs/ccache-action/issues/178. |
| 143 | + # using the older version will cause a two minute hang in its post-run step. |
| 144 | + - name: ccache |
| 145 | + uses: hendrikmuhs/ccache-action@v1.2.11 |
| 146 | + if: matrix.image == 'ubuntu:16.04' || matrix.image == 'ubuntu:18.04' |
| 147 | + with: |
| 148 | + key: ${{ github.workflow }}-${{ matrix.image }} |
| 149 | + |
| 150 | + # needs to be called after the package installation since |
| 151 | + # - it doesn't call "apt-get update" |
| 152 | + - name: ccache |
| 153 | + uses: hendrikmuhs/ccache-action@v1.2 |
| 154 | + if: matrix.image != 'ubuntu:16.04' && matrix.image != 'ubuntu:18.04' |
| 155 | + with: |
| 156 | + key: ${{ github.workflow }}-${{ matrix.image }} |
| 157 | + |
| 158 | + - name: Build cppcheck |
| 159 | + run: | |
| 160 | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" |
| 161 | + make -j$(nproc) HAVE_RULES=yes CXXFLAGS="-w" |
| 162 | +
|
| 163 | + - name: Build test |
| 164 | + run: | |
| 165 | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" |
| 166 | + make -j$(nproc) testrunner HAVE_RULES=yes CXXFLAGS="-w" |
| 167 | +
|
| 168 | + - name: Run test |
| 169 | + run: | |
| 170 | + make -j$(nproc) check HAVE_RULES=yes |
| 171 | +
|
| 172 | + # requires python3 |
| 173 | + - name: Run extra tests |
| 174 | + run: | |
| 175 | + tools/generate_and_run_more_tests.sh |
| 176 | +
|
| 177 | + # requires which |
| 178 | + - name: Validate |
| 179 | + run: | |
| 180 | + make -j$(nproc) checkCWEEntries validateXML |
| 181 | +
|
| 182 | + - name: Test addons |
| 183 | + run: | |
| 184 | + ./cppcheck --addon=threadsafety addons/test/threadsafety |
| 185 | + ./cppcheck --addon=threadsafety --std=c++03 addons/test/threadsafety |
| 186 | +
|
| 187 | + - name: Generate Qt help file on ubuntu 18.04 |
| 188 | + if: false # matrix.os == 'ubuntu-18.04' |
| 189 | + run: | |
| 190 | + pushd gui/help |
| 191 | + qcollectiongenerator online-help.qhcp -o online-help.qhc |
| 192 | +
|
0 commit comments