|
| 1 | +--- |
| 2 | +name: Ubuntu Clang20 |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + push: |
| 7 | + paths: |
| 8 | + - '**.h' |
| 9 | + - '**.c' |
| 10 | + - '**.hpp' |
| 11 | + - '**.cpp' |
| 12 | + - '**.y' |
| 13 | + - '**.l' |
| 14 | + - '**CMakeLists.txt' |
| 15 | + - 'cmake/*.cmake' |
| 16 | + - 'cmake/toolchain/*linux*.cmake' |
| 17 | + - 'examples/cmake/*.cmake' |
| 18 | + pull_request: |
| 19 | + paths: |
| 20 | + - '**.h' |
| 21 | + - '**.c' |
| 22 | + - '**.hpp' |
| 23 | + - '**.cpp' |
| 24 | + - '**.y' |
| 25 | + - '**.l' |
| 26 | + - '**CMakeLists.txt' |
| 27 | + - 'cmake/*.cmake' |
| 28 | + - 'cmake/toolchain/*linux*.cmake' |
| 29 | + - 'examples/cmake/*.cmake' |
| 30 | + |
| 31 | +jobs: |
| 32 | + build: |
| 33 | + runs-on: ubuntu-latest |
| 34 | + env: |
| 35 | + CCACHE_DIR: ${{ github.workspace }}/CCACHE |
| 36 | + BUILD_DIR: build-x86_64-linux64-clang20 |
| 37 | + CTEST_OUTPUT_ON_FAILURE: 1 |
| 38 | + CMAKE_TOOLCHAIN_FILE: ${{ github.workspace }}/cmake/toolchain/x86_64-linux-clang20.cmake |
| 39 | + CMAKE_PREFIX_PATH: ${{ github.workspace }}/local/x86_64-linux-clang20 |
| 40 | + CMAKE_INSTALL_PREFIX: ${{ github.workspace }}/local/x86_64-linux-clang20 |
| 41 | + CMAKE_GENERATOR: Ninja |
| 42 | + CMAKE_BUILD_TYPE: Debug |
| 43 | + CFLAGS: "-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstrict-flex-arrays=2 -fno-omit-frame-pointer -fsanitize=undefined -fsanitize=address -fsanitize=leak -fstack-protector-strong" |
| 44 | + CXXFLAGS: "-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -fstrict-flex-arrays=2 -fno-omit-frame-pointer -fsanitize=undefined -fsanitize=address -fsanitize=leak -fstack-protector-strong" |
| 45 | + LDFLAGS: "-fno-omit-frame-pointer -fsanitize=undefined -fsanitize=address -fsanitize=leak -fstack-protector-strong" |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v4 |
| 48 | + - name: Get Ubuntu dependencies |
| 49 | + run: | |
| 50 | + sudo apt-get -qq update |
| 51 | + sudo apt-get -qq install clang-format curl wget unzip xz-utils bison flex cmake ninja-build ccache clang-20 |
| 52 | +
|
| 53 | + - name: Check Formatting |
| 54 | + run: | |
| 55 | + clang-format --version |
| 56 | + find src include test -iregex '.*\.\(c\|h\|cpp\|hpp\|cc\|hh\|cxx\|hxx\)$' -exec clang-format -n -Werror {} \; |
| 57 | +
|
| 58 | + - name: Compute CCache keys |
| 59 | + id: x86_64-linux-clang20-keys |
| 60 | + run: | |
| 61 | + key2=ccache-x86_64-linux-clang20- |
| 62 | + key1="${key2}$(date +%W)" |
| 63 | + echo "key1=${key1}" >> $GITHUB_OUTPUT |
| 64 | + echo "key2=${key2}" >> $GITHUB_OUTPUT |
| 65 | +
|
| 66 | + - name: Restore CCache |
| 67 | + id: ccache-restore |
| 68 | + uses: actions/cache@v4 |
| 69 | + with: |
| 70 | + path: ${{ env.CCACHE_DIR }} |
| 71 | + key: ${{ steps.x86_64-linux-clang20-keys.outputs.key1 }} |
| 72 | + restore-keys: ${{ steps.x86_64-linux-clang20-keys.outputs.key2 }} |
| 73 | + - name: CCache limits and stats |
| 74 | + run: | |
| 75 | + ccache -M120M |
| 76 | + ccache --show-stats |
| 77 | +
|
| 78 | + - name: Restore Libs |
| 79 | + id: restore-libs |
| 80 | + uses: actions/cache/restore@v4 |
| 81 | + with: |
| 82 | + path: local/x86_64-linux-clang20 |
| 83 | + key: libs-x86_64-linux-clang20-${{ hashFiles('getlibs.sh') }} |
| 84 | + restore-keys: libs-x86_64-linux-clang20- |
| 85 | + - name: Get library dependencies |
| 86 | + if: steps.restore-libs.outputs.cache-hit != 'true' |
| 87 | + run: ./getlibs.sh x86_64-linux-clang20 |
| 88 | + - name: Save Libs |
| 89 | + if: steps.restore-libs.outputs.cache-hit != 'true' |
| 90 | + id: save-libs |
| 91 | + uses: actions/cache/save@v4 |
| 92 | + with: |
| 93 | + path: local/x86_64-linux-clang20 |
| 94 | + key: ${{ steps.restore-libs.outputs.cache-primary-key }} |
| 95 | + - name: Configure UTAP |
| 96 | + run: cmake -B "$BUILD_DIR" -DUTAP_CLANG_TIDY=OFF |
| 97 | + - name: Build UTAP |
| 98 | + run: cmake --build "$BUILD_DIR" --config $CMAKE_BUILD_TYPE |
| 99 | + - name: Test UTAP |
| 100 | + run: ctest --test-dir "$BUILD_DIR" -C $CMAKE_BUILD_TYPE |
| 101 | + - name: Install UTAP |
| 102 | + run: cmake --install "$BUILD_DIR" --config $CMAKE_BUILD_TYPE --prefix "$CMAKE_INSTALL_PREFIX" |
| 103 | + - name: CCache Statistics |
| 104 | + run: ccache --show-stats |
| 105 | + - name: Configure Examples |
| 106 | + run: cmake -B examples/build -S examples |
| 107 | + - name: Build Examples |
| 108 | + run: cmake --build examples/build |
| 109 | + - name: Test Examples |
| 110 | + run: ctest --test-dir examples/build |
0 commit comments