Skip to content

Extend

Extend #4408

Workflow file for this run

# C++ CI
name: C++ CI
on:
push:
paths-ignore:
- 'docs/**'
- 'media/**'
- '**.md'
pull_request:
branches:
- main
- dev
- feature/**
paths:
- 'docs/**'
- 'media/**'
- '**.md'
jobs:
build-linux:
name: C++ CI
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 11
- name: Setup latest GCC and build dependencies
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
sudo apt update
sudo apt install gcc-13 g++-13 gdb
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 110 --slave /usr/bin/g++ g++ /usr/bin/g++-13 --slave /usr/bin/gcov gcov /usr/bin/gcov-13 --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-13 --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-13
- name: Setup Ninja
run: sudo apt-get install ninja-build
- name: Setup Valgrind
if: github.event_name == 'pull_request'
run: sudo apt-get install valgrind
- name: Setup Mold
uses: rui314/setup-mold@v1
- name: Setup CCache
uses: hendrikmuhs/ccache-action@v1
- name: Setup Gcovr
run: sudo pip install gcovr
- name: Cache LLVM
id: cache-llvm
uses: actions/cache@v4
with:
path: /home/runner/work/spice/llvm
key: llvm-18.1.0-rc3
- name: Setup LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: |
cd ..
rm -rf llvm
git clone --depth 1 --branch llvmorg-18.1.0-rc3 https://github.com/llvm/llvm-project llvm
mkdir ./llvm/build
cd ./llvm/build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CXX_FLAGS_RELEASE="-O2" -DLLVM_ENABLE_RTTI=ON -GNinja ../llvm
cmake --build . -j$(nproc)
- name: Download Libs
run: |
chmod +x setup-libs.sh
./setup-libs.sh
- name: Build Test target
# if: github.event_name != 'pull_request'
env:
LLVM_DIR: /home/runner/work/spice/llvm/build/lib/cmake/llvm
run: |
echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH
mkdir ./bin
cd ./bin
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DSPICE_BUILT_BY="ghactions" -DSPICE_LINK_STATIC=OFF -DSPICE_LTO=ON -DSPICE_RUN_COVERAGE=ON -GNinja -Wattributes ..
cmake --build . --target spicetest -j$(nproc)
# - name: Build Test target
# if: github.event_name == 'pull_request'
# env:
# LLVM_DIR: /home/runner/work/spice/llvm/build/lib/cmake/llvm
# run: |
# echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH
# mkdir ./bin
# cd ./bin
# cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DSPICE_BUILT_BY="ghactions" -DSPICE_PROF_COMPILE=ON -DSPICE_LINK_STATIC=OFF -DSPICE_RUN_COVERAGE=ON -GNinja -Wattributes ..
# cmake --build . --target spicetest -j$(nproc)
- name: Run Test target
# if: github.event_name != 'pull_request'
env:
LLVM_LIB_DIR: /home/runner/work/spice/llvm/build/lib
LLVM_INCLUDE_DIR: /home/runner/work/spice/llvm/llvm/include
LLVM_BUILD_INCLUDE_DIR: /home/runner/work/spice/llvm/build/include
SPICE_STD_DIR: /home/runner/work/spice/spice/std
SPICE_BOOTSTRAP_DIR: /home/runner/work/spice/spice/src-bootstrap
run: |
cd ./bin/test
./spicetest --skip-github-tests
# - name: Run Test target with Valgrind
# if: github.event_name == 'pull_request'
# env:
# LLVM_LIB_DIR: /home/runner/work/spice/llvm/build/lib
# LLVM_INCLUDE_DIR: /home/runner/work/spice/llvm/llvm/include
# LLVM_BUILD_INCLUDE_DIR: /home/runner/work/spice/llvm/build/include
# SPICE_STD_DIR: /home/runner/work/spice/spice/std
# SPICE_BOOTSTRAP_DIR: /home/runner/work/spice/spice/src-bootstrap
# run: |
# cd ./bin/test
# valgrind -q --leak-check=full ./spicetest --skip-github-tests --leak-detection
- name: Generate coverage report
run: |
cd ./bin
sudo chmod +x coverage.sh
sudo ./coverage.sh
- name: Upload coverage report - coverage.spicelang.com
uses: sebastianpopp/ftp-action@releases/v2
with:
host: ${{ secrets.FTP_SERVER }}
user: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
localDir: ./bin/coverage
remoteDir: chillibits.com/spice/coverage