From 65cae2727f26a0b2e70c3a1829ed7dcd3b3dce4b Mon Sep 17 00:00:00 2001 From: Ivan-lis Date: Fri, 18 Oct 2024 07:38:07 +0000 Subject: [PATCH] CI: Added LLVM bins and clang&gcc build --- .forgejo/workflows/pr_check.yaml | 83 ++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/.forgejo/workflows/pr_check.yaml b/.forgejo/workflows/pr_check.yaml index 3489167..2df7053 100644 --- a/.forgejo/workflows/pr_check.yaml +++ b/.forgejo/workflows/pr_check.yaml @@ -46,3 +46,86 @@ jobs: echo "github.workspace content" ls -la ${{ github.workspace }} echo "This job's status is ${{ job.status }}." + + #- name: Delete cache + # run: | + # rm -rf ${{ runner.tool_cache }}/cache-llvm-19-restore + + - name: Try restore LLVM-19 binaries from cache + id: cache-llvm-19-bins-restore + uses: actions/cache@v4 + with: + path: /LLVM-19.1.0-Linux-X64-small.tar.xz + key: LLVM-19.1.0-Linux-X64-small + + - name: Download and unzip LLVM-19 if not in cache + if: steps.cache-llvm-19-bins-restore.outputs.cache-hit != 'true' + run: | + echo "::group::Download LLVM-19.1.0" + wget https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.0/LLVM-19.1.0-Linux-X64.tar.xz -O /LLVM-19.1.0-Linux-X64.tar.xz + echo "::endgroup::" + + echo "::group::Extracting LLVM-19.1.0" + mkdir -p /home/LLVM-19.1.0/ + tar -xf /LLVM-19.1.0-Linux-X64.tar.xz -C "/home/LLVM-19.1.0/" --strip-components=1 LLVM-19.1.0-Linux-X64/bin/clang-19 LLVM-19.1.0-Linux-X64/bin/clang LLVM-19.1.0-Linux-X64/bin/clang++ LLVM-19.1.0-Linux-X64/bin/clang-scan-deps LLVM-19.1.0-Linux-X64/bin/clang-format LLVM-19.1.0-Linux-X64/bin/clang-tidy LLVM-19.1.0-Linux-X64/include/ LLVM-19.1.0-Linux-X64/lib/ LLVM-19.1.0-Linux-X64/libexec/ LLVM-19.1.0-Linux-X64/local/ LLVM-19.1.0-Linux-X64/share/ + rm /LLVM-19.1.0-Linux-X64.tar.xz + echo "::endgroup::" + + tar -cf /LLVM-19.1.0-Linux-X64-small.tar.xz /home/LLVM-19.1.0/ + + - name: Save LLVM-19 to cache + if: steps.cache-llvm-19-bins-restore.outputs.cache-hit != 'true' + id: cache-llvm-19-save + uses: actions/cache/save@v4 + with: + path: /LLVM-19.1.0-Linux-X64-small.tar.xz + key: LLVM-19.1.0-Linux-X64-small + + - name: Install LLVM + run: | + mkdir -p /home/LLVM-19.1.0 + tar -xf /LLVM-19.1.0-Linux-X64-small.tar.xz -C "/home/LLVM-19.1.0/" --strip-components=2 + ls -la /home/LLVM-19.1.0/bin/ + export PATH="/home/LLVM-19.1.0/bin:${PATH}" + + - name: Clang build with -fsanitize=address + environment: + CC: /home/LLVM-19.1.0/bin/clang + CXX: /home/LLVM-19.1.0/bin/clang++ + run: | + mkdir -p ${{ github.workspace }}/build_clang + cmake -Wno-dev \ + -DCMAKE_C_COMPILER=/home/LLVM-19.1.0/bin/clang \ + -DCMAKE_CXX_COMPILER=/home/LLVM-19.1.0/bin/clang++ \ + -S ${{ github.workspace }} \ + -B ${{ github.workspace }}/build_clang \ + -GNinja -DCMAKE_BUILD_TYPE=Release \ + -DENABLE_EXAMPLES=ON \ + -DENABLE_TESTS=ON \ + -DCMAKE_CXX_FLAGS="-stdlib=libstdc++ -fno-omit-frame-pointer -g -fsanitize=address,undefined,leak,function,nullability,vptr" \ + -DCMAKE_EXE_LINKER_FLAGS="-L/usr/lib/x86_64-linux-gnu -lstdc++ -fno-omit-frame-pointer -g -fsanitize=address,undefined,leak,function,nullability,vptr" + cmake --build ${{ github.workspace }}/build_clang --parallel `nproc` + + - name: Clang unit tests with -fsanitize=address + run: | + cd ${{ github.workspace }}/build_clang + ASAN_SYMBOLIZER_PATH=/home/LLVM-19.1.0/bin/llvm-symbolizer ASAN_OPTIONS=detect_stack_use_after_return=1:check_initialization_order=1:detect_leaks=1:atexit=1:abort_on_error=1 ./larra_xmpp_tests + + - name: GCC build + environment: + CC: /usr/sbin/gcc + CXX: /usr/sbin/g++ + run: | + mkdir -p ${{ github.workspace }}/build_gcc + cmake -Wno-dev \ + -S ${{ github.workspace }} \ + -B ${{ github.workspace }}/build_gcc \ + -GNinja -DCMAKE_BUILD_TYPE=Release \ + -DENABLE_EXAMPLES=ON \ + -DENABLE_TESTS=ON + cmake --build ${{ github.workspace }}/build_gcc --parallel `nproc` + + - name: GCC unit tests + run: | + cd ${{ github.workspace }}/build_gcc + ./larra_xmpp_tests