larra/.forgejo/workflows/pr_check.yaml

131 lines
5.7 KiB
YAML

name: PR Check
run-name: ${{ github.actor }} is testing
on: [push]
jobs:
on-push-commit-check:
runs-on: archlinux-latest
steps:
- name: Setup environment
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
- 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 }}"
- 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 }}@helicopter.myftp.org/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: 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