| 1 |
# Continuous integration and pull request validation builds for the |
| 2 |
# main and maintenance branches. |
| 3 |
name: CI Build |
| 4 |
|
| 5 |
on: |
| 6 |
push: |
| 7 |
branches: [ main, maint/* ] |
| 8 |
pull_request: |
| 9 |
branches: [ main, maint/* ] |
| 10 |
workflow_dispatch: |
| 11 |
|
| 12 |
env: |
| 13 |
docker-registry: ghcr.io |
| 14 |
docker-config-path: ci/docker |
| 15 |
|
| 16 |
permissions: |
| 17 |
contents: write |
| 18 |
packages: write |
| 19 |
|
| 20 |
jobs: |
| 21 |
# Run our CI/CD builds. We build a matrix with the various build targets |
| 22 |
# and their details. Then we build either in a docker container (Linux) |
| 23 |
# or on the actual hosts (macOS, Windows). |
| 24 |
build: |
| 25 |
strategy: |
| 26 |
matrix: |
| 27 |
platform: |
| 28 |
# All builds: core platforms |
| 29 |
- name: "Linux (Noble, GCC, OpenSSL, libssh2)" |
| 30 |
id: noble-gcc-openssl |
| 31 |
os: ubuntu-latest |
| 32 |
container: |
| 33 |
name: noble |
| 34 |
env: |
| 35 |
CC: gcc |
| 36 |
CMAKE_GENERATOR: Ninja |
| 37 |
CMAKE_OPTIONS: -DUSE_HTTPS=OpenSSL -DREGEX_BACKEND=builtin -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=libssh2 -DDEBUG_STRICT_ALLOC=ON -DDEBUG_STRICT_OPEN=ON |
| 38 |
- name: "Linux (Noble, Clang, mbedTLS, OpenSSH)" |
| 39 |
id: noble-clang-mbedtls |
| 40 |
os: ubuntu-latest |
| 41 |
container: |
| 42 |
name: noble |
| 43 |
env: |
| 44 |
CC: clang |
| 45 |
CMAKE_OPTIONS: -DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=exec -DUSE_HTTP_PARSER=http-parser |
| 46 |
CMAKE_GENERATOR: Ninja |
| 47 |
- name: "Linux (Xenial, GCC, OpenSSL, OpenSSH)" |
| 48 |
id: xenial-gcc-openssl |
| 49 |
os: ubuntu-latest |
| 50 |
container: |
| 51 |
name: xenial |
| 52 |
env: |
| 53 |
CC: gcc |
| 54 |
CMAKE_GENERATOR: Ninja |
| 55 |
CMAKE_OPTIONS: -DUSE_HTTPS=OpenSSL -DREGEX_BACKEND=builtin -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=exec -DDEBUG_STRICT_ALLOC=ON -DDEBUG_STRICT_OPEN=ON |
| 56 |
- name: "Linux (Xenial, Clang, mbedTLS, libssh2)" |
| 57 |
id: xenial-gcc-mbedtls |
| 58 |
os: ubuntu-latest |
| 59 |
container: |
| 60 |
name: xenial |
| 61 |
env: |
| 62 |
CC: clang |
| 63 |
CMAKE_GENERATOR: Ninja |
| 64 |
CMAKE_OPTIONS: -DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=libssh2 |
| 65 |
- name: "macOS" |
| 66 |
id: macos |
| 67 |
os: macos-14 |
| 68 |
setup-script: osx |
| 69 |
env: |
| 70 |
CC: clang |
| 71 |
CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON |
| 72 |
CMAKE_GENERATOR: Ninja |
| 73 |
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig |
| 74 |
SKIP_SSH_TESTS: true |
| 75 |
SKIP_NEGOTIATE_TESTS: true |
| 76 |
- name: "Windows (amd64, Visual Studio, Schannel)" |
| 77 |
id: windows-amd64-vs |
| 78 |
os: windows-2022 |
| 79 |
setup-script: win32 |
| 80 |
env: |
| 81 |
ARCH: amd64 |
| 82 |
CMAKE_GENERATOR: Visual Studio 17 2022 |
| 83 |
CMAKE_OPTIONS: -A x64 -DWIN32_LEAKCHECK=ON -DDEPRECATE_HARD=ON -DUSE_HTTPS=Schannel -DUSE_SSH=ON -DCMAKE_PREFIX_PATH=D:\Temp\libssh2 |
| 84 |
BUILD_PATH: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CMake\bin;D:\Temp\libssh2\bin |
| 85 |
BUILD_TEMP: D:\Temp |
| 86 |
SKIP_SSH_TESTS: true |
| 87 |
SKIP_NEGOTIATE_TESTS: true |
| 88 |
- name: "Windows (x86, Visual Studio, WinHTTP)" |
| 89 |
id: windows-x86-vs |
| 90 |
os: windows-2022 |
| 91 |
setup-script: win32 |
| 92 |
env: |
| 93 |
ARCH: x86 |
| 94 |
CMAKE_GENERATOR: Visual Studio 17 2022 |
| 95 |
CMAKE_OPTIONS: -A Win32 -DWIN32_LEAKCHECK=ON -DDEPRECATE_HARD=ON -DUSE_SHA1=HTTPS -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON -DCMAKE_PREFIX_PATH=D:\Temp\libssh2 |
| 96 |
BUILD_PATH: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CMake\bin;D:\Temp\libssh2\bin |
| 97 |
BUILD_TEMP: D:\Temp |
| 98 |
SKIP_SSH_TESTS: true |
| 99 |
SKIP_NEGOTIATE_TESTS: true |
| 100 |
- name: "Windows (amd64, mingw, WinHTTP)" |
| 101 |
id: windows-amd64-mingw |
| 102 |
os: windows-2022 |
| 103 |
setup-script: mingw |
| 104 |
env: |
| 105 |
ARCH: amd64 |
| 106 |
CMAKE_GENERATOR: MinGW Makefiles |
| 107 |
CMAKE_OPTIONS: -DDEPRECATE_HARD=ON |
| 108 |
BUILD_TEMP: D:\Temp |
| 109 |
BUILD_PATH: D:\Temp\mingw64\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CMake\bin |
| 110 |
SKIP_SSH_TESTS: true |
| 111 |
SKIP_NEGOTIATE_TESTS: true |
| 112 |
- name: "Windows (x86, mingw, Schannel)" |
| 113 |
id: windows-x86-mingw |
| 114 |
os: windows-2022 |
| 115 |
setup-script: mingw |
| 116 |
env: |
| 117 |
ARCH: x86 |
| 118 |
CMAKE_GENERATOR: MinGW Makefiles |
| 119 |
CMAKE_OPTIONS: -DDEPRECATE_HARD=ON -DUSE_HTTPS=Schannel |
| 120 |
BUILD_TEMP: D:\Temp |
| 121 |
BUILD_PATH: D:\Temp\mingw32\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CMake\bin |
| 122 |
SKIP_SSH_TESTS: true |
| 123 |
SKIP_NEGOTIATE_TESTS: true |
| 124 |
|
| 125 |
# All builds: sanitizers |
| 126 |
- name: "Sanitizer (Memory)" |
| 127 |
id: sanitizer-memory |
| 128 |
os: ubuntu-latest |
| 129 |
setup-script: sanitizer |
| 130 |
container: |
| 131 |
name: noble |
| 132 |
env: |
| 133 |
CC: clang |
| 134 |
CFLAGS: -fsanitize=memory -fsanitize-memory-track-origins=2 -fsanitize-blacklist=/home/libgit2/source/script/sanitizers.supp -fno-optimize-sibling-calls -fno-omit-frame-pointer |
| 135 |
CMAKE_OPTIONS: -DCMAKE_C_EXTENSIONS=ON -DCMAKE_PREFIX_PATH=/usr/local/msan -DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON |
| 136 |
CMAKE_GENERATOR: Ninja |
| 137 |
SKIP_SSH_TESTS: true |
| 138 |
SKIP_NEGOTIATE_TESTS: true |
| 139 |
ASAN_SYMBOLIZER_PATH: /usr/bin/llvm-symbolizer-10 |
| 140 |
UBSAN_OPTIONS: print_stacktrace=1 |
| 141 |
- name: "Sanitizer (Address)" |
| 142 |
id: sanitizer-address |
| 143 |
os: ubuntu-latest |
| 144 |
setup-script: sanitizer |
| 145 |
container: |
| 146 |
name: noble |
| 147 |
env: |
| 148 |
CC: clang |
| 149 |
CFLAGS: -fsanitize=address -ggdb -fsanitize-blacklist=/home/libgit2/source/script/sanitizers.supp -fno-optimize-sibling-calls -fno-omit-frame-pointer |
| 150 |
CMAKE_OPTIONS: -DCMAKE_PREFIX_PATH=/usr/local -DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON |
| 151 |
CMAKE_GENERATOR: Ninja |
| 152 |
SKIP_SSH_TESTS: true |
| 153 |
SKIP_NEGOTIATE_TESTS: true |
| 154 |
ASAN_SYMBOLIZER_PATH: /usr/bin/llvm-symbolizer-10 |
| 155 |
UBSAN_OPTIONS: print_stacktrace=1 |
| 156 |
- name: "Sanitizer (UndefinedBehavior)" |
| 157 |
id: sanitizer-ub |
| 158 |
os: ubuntu-latest |
| 159 |
setup-script: sanitizer |
| 160 |
container: |
| 161 |
name: noble |
| 162 |
env: |
| 163 |
CC: clang |
| 164 |
CFLAGS: -fsanitize=undefined,nullability -fno-sanitize-recover=undefined,nullability -fsanitize-blacklist=/home/libgit2/source/script/sanitizers.supp -fno-optimize-sibling-calls -fno-omit-frame-pointer |
| 165 |
CMAKE_OPTIONS: -DCMAKE_PREFIX_PATH=/usr/local -DUSE_HTTPS=OpenSSL -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON |
| 166 |
CMAKE_GENERATOR: Ninja |
| 167 |
SKIP_SSH_TESTS: true |
| 168 |
SKIP_NEGOTIATE_TESTS: true |
| 169 |
ASAN_SYMBOLIZER_PATH: /usr/bin/llvm-symbolizer-10 |
| 170 |
UBSAN_OPTIONS: print_stacktrace=1 |
| 171 |
- name: "Sanitizer (Thread)" |
| 172 |
id: sanitizer-thread |
| 173 |
os: ubuntu-latest |
| 174 |
setup-script: sanitizer |
| 175 |
container: |
| 176 |
name: noble |
| 177 |
env: |
| 178 |
CC: clang |
| 179 |
CFLAGS: -fsanitize=thread -fno-optimize-sibling-calls -fno-omit-frame-pointer |
| 180 |
CMAKE_OPTIONS: -DCMAKE_PREFIX_PATH=/usr/local -DUSE_HTTPS=OpenSSL -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON |
| 181 |
CMAKE_GENERATOR: Ninja |
| 182 |
SKIP_SSH_TESTS: true |
| 183 |
SKIP_NEGOTIATE_TESTS: true |
| 184 |
ASAN_SYMBOLIZER_PATH: /usr/bin/llvm-symbolizer-10 |
| 185 |
UBSAN_OPTIONS: print_stacktrace=1 |
| 186 |
TSAN_OPTIONS: suppressions=/home/libgit2/source/script/thread-sanitizer.supp second_deadlock_stack=1 |
| 187 |
fail-fast: false |
| 188 |
env: ${{ matrix.platform.env }} |
| 189 |
runs-on: ${{ matrix.platform.os }} |
| 190 |
name: "Build: ${{ matrix.platform.name }}" |
| 191 |
steps: |
| 192 |
- name: Check out repository |
| 193 |
uses: actions/checkout@v4 |
| 194 |
with: |
| 195 |
path: source |
| 196 |
fetch-depth: 0 |
| 197 |
- name: Set up build environment |
| 198 |
run: source/ci/setup-${{ matrix.platform.setup-script }}-build.sh |
| 199 |
shell: bash |
| 200 |
if: matrix.platform.setup-script != '' |
| 201 |
- name: Setup QEMU |
| 202 |
run: docker run --rm --privileged multiarch/qemu-user-static:register --reset |
| 203 |
if: matrix.platform.container.qemu == true |
| 204 |
- name: Set up container |
| 205 |
uses: ./source/.github/actions/download-or-build-container |
| 206 |
with: |
| 207 |
registry: ${{ env.docker-registry }} |
| 208 |
config-path: ${{ env.docker-config-path }} |
| 209 |
container: ${{ matrix.platform.container.name }} |
| 210 |
github_token: ${{ secrets.github_token }} |
| 211 |
dockerfile: ${{ matrix.platform.container.dockerfile }} |
| 212 |
if: matrix.platform.container.name != '' |
| 213 |
- name: Prepare build |
| 214 |
run: mkdir build |
| 215 |
- name: Build |
| 216 |
uses: ./source/.github/actions/run-build |
| 217 |
with: |
| 218 |
command: cd ${BUILD_WORKSPACE:-.}/build && ../source/ci/build.sh |
| 219 |
container: ${{ matrix.platform.container.name }} |
| 220 |
container-version: ${{ env.docker-registry-container-sha }} |
| 221 |
shell: ${{ matrix.platform.shell }} |
| 222 |
- name: Test |
| 223 |
uses: ./source/.github/actions/run-build |
| 224 |
with: |
| 225 |
command: cd ${BUILD_WORKSPACE:-.}/build && ../source/ci/test.sh |
| 226 |
container: ${{ matrix.platform.container.name }} |
| 227 |
container-version: ${{ env.docker-registry-container-sha }} |
| 228 |
shell: ${{ matrix.platform.shell }} |
| 229 |
- name: Upload test results |
| 230 |
uses: actions/upload-artifact@v4 |
| 231 |
if: success() || failure() |
| 232 |
with: |
| 233 |
name: test-results-${{ matrix.platform.id }} |
| 234 |
path: build/results_*.xml |
| 235 |
|
| 236 |
documentation: |
| 237 |
name: Validate documentation |
| 238 |
runs-on: ubuntu-latest |
| 239 |
steps: |
| 240 |
- name: Check out repository |
| 241 |
uses: actions/checkout@v4 |
| 242 |
- name: Validate documentation |
| 243 |
run: | |
| 244 |
(cd script/api-docs && npm install) |
| 245 |
script/api-docs/api-generator.js --validate-only --strict --deprecate-hard . |
| 246 |
|
| 247 |
test_results: |
| 248 |
name: Test results |
| 249 |
needs: [ build ] |
| 250 |
if: always() |
| 251 |
runs-on: ubuntu-latest |
| 252 |
steps: |
| 253 |
- name: Download test results |
| 254 |
uses: actions/download-artifact@v4 |
| 255 |
- name: Generate test summary |
| 256 |
uses: test-summary/action@v2 |
| 257 |
with: |
| 258 |
paths: 'test-results-*/*.xml' |