2024-10-18 07:36:50 +00:00
|
|
|
name: PR Check
|
|
|
|
run-name: ${{ github.actor }} is testing
|
|
|
|
on: [push]
|
|
|
|
jobs:
|
|
|
|
on-push-commit-check:
|
|
|
|
runs-on: archlinux-latest
|
|
|
|
steps:
|
2024-10-18 11:17:26 +00:00
|
|
|
- name: Setup environment - Install pacman packages
|
2024-10-18 07:36:50 +00:00
|
|
|
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
|
2024-11-07 15:01:32 +00:00
|
|
|
pacman -S --noconfirm gtk4 gtkmm-4.0 boost spdlog fmt libxml++-5.0 gtest
|
2024-10-18 07:36:50 +00:00
|
|
|
|
2024-10-18 11:17:26 +00:00
|
|
|
- name: Setup environment - Install LLVM-19.1.1
|
|
|
|
run: |
|
2024-10-21 09:08:40 +00:00
|
|
|
export LLVM_VER=19.1.1
|
2024-10-18 11:17:26 +00:00
|
|
|
|
2024-10-21 09:08:40 +00:00
|
|
|
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
|
2024-10-18 11:17:26 +00:00
|
|
|
echo "::endgroup::"
|
|
|
|
|
2024-10-21 09:08:40 +00:00
|
|
|
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
|
2024-10-18 11:17:26 +00:00
|
|
|
echo "::endgroup::"
|
|
|
|
|
2024-10-21 09:08:40 +00:00
|
|
|
echo "LLVM version ${LLVM_VER}"
|
2024-10-18 11:17:26 +00:00
|
|
|
echo "Available LLVM binaries:"
|
2024-10-21 09:08:40 +00:00
|
|
|
ls -la /home/LLVM-${LLVM_VER}/bin/
|
2024-10-18 11:17:26 +00:00
|
|
|
|
2024-10-18 07:36:50 +00:00
|
|
|
- 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 }}"
|
2024-10-21 09:08:40 +00:00
|
|
|
echo "PATH: ${PATH}"
|
2024-10-18 07:36:50 +00:00
|
|
|
|
|
|
|
- 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
|
2024-11-07 14:38:17 +00:00
|
|
|
git remote add origin https://${{ github.token }}@sha512sum.xyz/git/Larra/larra
|
2024-10-18 07:36:50 +00:00
|
|
|
|
|
|
|
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 }}."
|
2024-10-18 07:38:07 +00:00
|
|
|
|
2024-10-21 11:21:26 +00:00
|
|
|
- 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
|
|
|
|
|
2024-10-18 07:38:07 +00:00
|
|
|
#- name: Delete cache
|
|
|
|
# run: |
|
|
|
|
# rm -rf ${{ runner.tool_cache }}/cache-llvm-19-restore
|
2024-10-18 11:17:26 +00:00
|
|
|
#
|
|
|
|
#- name: Try restore LLVM-19 binaries from cache
|
|
|
|
# id: cache-llvm-19-bins-restore
|
|
|
|
# uses: actions/cache@v4
|
|
|
|
# with:
|
2024-10-21 09:08:40 +00:00
|
|
|
# path: /LLVM-${LLVM_VER}-Linux-X64-small.tar.xz
|
|
|
|
# key: LLVM-${LLVM_VER}-Linux-X64-small
|
2024-10-18 11:17:26 +00:00
|
|
|
#
|
|
|
|
#- 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:
|
2024-10-21 09:08:40 +00:00
|
|
|
# path: /LLVM-${LLVM_VER}-Linux-X64-small.tar.xz
|
|
|
|
# key: LLVM-${LLVM_VER}-Linux-X64-small
|
2024-10-18 07:38:07 +00:00
|
|
|
|
2024-10-18 07:38:35 +00:00
|
|
|
- name: Check clang-format
|
|
|
|
run: |
|
2024-10-21 09:08:40 +00:00
|
|
|
export LLVM_VER=19.1.1
|
|
|
|
export PATH="/home/LLVM-${LLVM_VER}/bin:${PATH}"
|
2024-10-18 07:38:35 +00:00
|
|
|
cd ${{ github.workspace }}
|
2024-10-21 11:21:26 +00:00
|
|
|
export REPO_FILES=$(cat repo_files_to_check.txt)
|
2024-10-18 07:38:35 +00:00
|
|
|
|
|
|
|
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!"
|
|
|
|
|
2024-10-18 07:38:07 +00:00
|
|
|
- name: GCC build
|
2024-11-08 12:27:57 +00:00
|
|
|
continue-on-error: true
|
2024-10-18 07:38:07 +00:00
|
|
|
run: |
|
|
|
|
mkdir -p ${{ github.workspace }}/build_gcc
|
|
|
|
cmake -Wno-dev \
|
2024-10-21 09:08:40 +00:00
|
|
|
-DCMAKE_C_COMPILER=gcc \
|
|
|
|
-DCMAKE_CXX_COMPILER=g++ \
|
2024-10-18 07:38:07 +00:00
|
|
|
-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
|
2024-11-08 12:27:57 +00:00
|
|
|
continue-on-error: true
|
2024-10-18 07:38:07 +00:00
|
|
|
run: |
|
|
|
|
cd ${{ github.workspace }}/build_gcc
|
|
|
|
./larra_xmpp_tests
|
2024-10-21 09:08:40 +00:00
|
|
|
|
2024-11-08 12:27:57 +00:00
|
|
|
- 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
|
|
|
|
|
2024-10-21 09:08:40 +00:00
|
|
|
- name: Check clang-tidy
|
2024-11-08 12:27:57 +00:00
|
|
|
continue-on-error: true
|
2024-10-21 09:08:40 +00:00
|
|
|
run: |
|
|
|
|
export LLVM_VER=19.1.1
|
|
|
|
export PATH="/home/LLVM-${LLVM_VER}/bin:${PATH}"
|
2024-10-21 11:21:26 +00:00
|
|
|
cd ${{ github.workspace }}
|
|
|
|
|
2024-10-21 09:08:40 +00:00
|
|
|
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 \
|
2024-10-21 11:21:26 +00:00
|
|
|
-warnings-as-errors=* \
|
2024-10-21 09:08:40 +00:00
|
|
|
-use-color \
|
|
|
|
-exclude-header-filter .*build.* \
|
|
|
|
-header-filter .hpp \
|
2024-11-08 12:27:57 +00:00
|
|
|
-p ${{ github.workspace }}/build_clang/ \
|
2024-10-21 09:08:40 +00:00
|
|
|
-config-file ${{ github.workspace }}/.clang-tidy \
|
|
|
|
\
|
|
|
|
${{ github.workspace }}/examples \
|
|
|
|
${{ github.workspace }}/library/ \
|
|
|
|
${{ github.workspace }}/src/
|
|
|
|
|
|
|
|
echo "No clang-tidy violations detected!"
|
2024-10-21 11:21:26 +00:00
|
|
|
|
2024-10-21 09:08:40 +00:00
|
|
|
#- 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
|