name: PR Check run-name: ${{ github.actor }} is testing on: [push] jobs: on-push-commit-check: runs-on: archlinux-latest steps: - name: Setup environment - Install pacman packages shell: sh run: | pacman -Syyu --noconfirm pacman -S --noconfirm git less vim sudo python-pip wget which pkgconf nodejs-lts-iron pacman -S --noconfirm cmake make gcc ninja meson pacman -S --noconfirm gtk4 gtkmm-4.0 boost spdlog fmt libxml++-5.0 gtest - name: Setup environment - Install LLVM-19.1.1 run: | export LLVM_VER=19.1.1 echo "::group::Download LLVM-${LLVM_VER}" wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VER}/LLVM-${LLVM_VER}-Linux-X64.tar.xz -O /LLVM-${LLVM_VER}-Linux-X64.tar.xz echo "::endgroup::" echo "::group::Extracting LLVM-${LLVM_VER}" mkdir -p /home/LLVM-${LLVM_VER}/ tar -xf /LLVM-${LLVM_VER}-Linux-X64.tar.xz -C "/home/LLVM-${LLVM_VER}/" --strip-components=1 \ LLVM-${LLVM_VER}-Linux-X64/bin/clang-19 \ LLVM-${LLVM_VER}-Linux-X64/bin/clang \ LLVM-${LLVM_VER}-Linux-X64/bin/clang++ \ LLVM-${LLVM_VER}-Linux-X64/bin/clang-scan-deps \ LLVM-${LLVM_VER}-Linux-X64/bin/llvm-symbolizer \ LLVM-${LLVM_VER}-Linux-X64/bin/clang-format \ LLVM-${LLVM_VER}-Linux-X64/bin/clang-tidy \ LLVM-${LLVM_VER}-Linux-X64/include/ \ LLVM-${LLVM_VER}-Linux-X64/lib/ \ LLVM-${LLVM_VER}-Linux-X64/libexec/ \ LLVM-${LLVM_VER}-Linux-X64/local/ \ LLVM-${LLVM_VER}-Linux-X64/share/ rm /LLVM-${LLVM_VER}-Linux-X64.tar.xz echo "::endgroup::" echo "LLVM version ${LLVM_VER}" echo "Available LLVM binaries:" ls -la /home/LLVM-${LLVM_VER}/bin/ - name: List CI environment variables run: | echo "Runner OS: ${{ runner.os }}" echo "Job triggered event: ${{ github.event_name }}" echo "Repository name: ${{ github.repository }}" echo "Workspace path: ${{ github.workspace }}" echo "Actor: ${{ github.actor }}" echo "Ref: ${{ github.ref }}" echo "Ref name: ${{ github.ref_name }}" echo "SHA: ${{ github.sha }}" echo "PATH: ${PATH}" - name: Check out repository code run: | export GIT_TERMINAL_PROMPT=0 mkdir -p ${{ github.workspace }} cd ${{ github.workspace }} echo "Configure project settings and remote credentials" git init git config credential.helper store git remote add origin https://${{ github.token }}@sha512sum.xyz/git/Larra/larra echo "Fetch repo state on pushed commit" git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +${{ github.sha }}:${{ github.ref }} echo "Checkout to fetched repo state" git checkout ${{ github.ref }} - name: Show repo content run: | echo "github.workspace content" ls -la ${{ github.workspace }} echo "This job's status is ${{ job.status }}." - name: Store list of repo files run: | cd ${{ github.workspace }} find -type f \( -name "*.h" -o -name "*.hpp" -o -name "*.c" -o -name "*.cpp" \) > repo_files_to_check.txt find -type f \( -name "*.c" -o -name "*.cpp" \) > repo_sources_to_check.txt #- 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-${LLVM_VER}-Linux-X64-small.tar.xz # key: LLVM-${LLVM_VER}-Linux-X64-small # #- 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-${LLVM_VER}-Linux-X64-small.tar.xz # key: LLVM-${LLVM_VER}-Linux-X64-small - name: Check clang-format run: | export LLVM_VER=19.1.1 export PATH="/home/LLVM-${LLVM_VER}/bin:${PATH}" cd ${{ github.workspace }} export REPO_FILES=$(cat repo_files_to_check.txt) printf "\nList of files to be checked:\n" echo "::group::files to be checked" for FILE in $REPO_FILES; do printf "\t ${{ github.workspace }}/$FILE \n"; done echo "::endgroup::" for FILE in $REPO_FILES; do clang-format -i ${{ github.workspace }}/$FILE --dry-run --Werror; done echo "No clang-format violations detected!" - name: GCC build continue-on-error: true run: | mkdir -p ${{ github.workspace }}/build_gcc cmake -Wno-dev \ -DCMAKE_C_COMPILER=gcc \ -DCMAKE_CXX_COMPILER=g++ \ -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 continue-on-error: true run: | cd ${{ github.workspace }}/build_gcc ./larra_xmpp_tests - name: Clang build (only configuring) continue-on-error: true run: | export LLVM_VER=19.1.1 export PATH="/home/LLVM-${LLVM_VER}/bin:${PATH}" mkdir -p ${{ github.workspace }}/build_clang cmake -Wno-dev \ -DCMAKE_C_COMPILER=clang \ -DCMAKE_CXX_COMPILER=clang++ \ -S ${{ github.workspace }} \ -B ${{ github.workspace }}/build_clang \ -GNinja -DCMAKE_BUILD_TYPE=Release \ -DENABLE_EXAMPLES=ON \ -DENABLE_TESTS=ON \ -DCMAKE_CXX_FLAGS="-stdlib=libc++ -I/home/LLVM-${LLVM_VER}/include/c++/v1 -fno-modules" echo "::group::compile_commands.json content" cat ${{ github.workspace }}/build_clang/compile_commands.json echo "::endgroup::" sed -i 's|-fmodules-ts||' ${{ github.workspace }}/build_clang/compile_commands.json sed -i 's|-fmodule-mapper=.*\.modmap||' ${{ github.workspace }}/build_clang/compile_commands.json - name: Check clang-tidy continue-on-error: true run: | export LLVM_VER=19.1.1 export PATH="/home/LLVM-${LLVM_VER}/bin:${PATH}" cd ${{ github.workspace }} wget https://raw.githubusercontent.com/llvm/llvm-project/refs/heads/main/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py python run-clang-tidy.py \ -warnings-as-errors=* \ -use-color \ -exclude-header-filter .*build.* \ -header-filter .hpp \ -p ${{ github.workspace }}/build_clang/ \ -config-file ${{ github.workspace }}/.clang-tidy \ \ ${{ github.workspace }}/examples \ ${{ github.workspace }}/library/ \ ${{ github.workspace }}/src/ echo "No clang-tidy violations detected!" #- name: Clang unit tests with -fsanitize=address # run: | # export LLVM_VER=19.1.1 # export PATH="/home/LLVM-${LLVM_VER}/bin:${PATH}" # cd ${{ github.workspace }}/build_clang # ASAN_SYMBOLIZER_PATH=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