Skip to content

save

save #32

Workflow file for this run

name: SQUINT CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-and-test-linux:
name: Build and Test (Linux)
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [g++-12, clang++-17]
steps:
- uses: actions/checkout@v4
- name: Install compiler and libraries
run: |
sudo apt-get update
sudo apt-get install -y ninja-build
if [[ "${{ matrix.compiler }}" == clang++* ]]; then
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
CLANG_VERSION=$(echo "${{ matrix.compiler }}" | sed 's/clang++-//')
sudo ./llvm.sh $CLANG_VERSION
sudo apt-get install -y clang-$CLANG_VERSION libc++-$CLANG_VERSION-dev libc++abi-$CLANG_VERSION-dev lld-$CLANG_VERSION gfortran gcc
else
sudo apt-get install -y ${{ matrix.compiler }} gfortran gcc
fi
- name: Configure CMake
env:
CXX: ${{ matrix.compiler }}
run: |
if [[ "${{ matrix.compiler }}" == clang++* ]]; then
CLANG_VERSION=$(echo "${{ matrix.compiler }}" | sed 's/clang++-//')
export CXXFLAGS="-stdlib=libc++"
cmake -B ${{github.workspace}}/build -G Ninja -DSQUINT_BUILD_TESTS=ON -DCMAKE_CXX_FLAGS="$CXXFLAGS" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
else
cmake -B ${{github.workspace}}/build -G Ninja -DSQUINT_BUILD_TESTS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
fi
- name: Build
run: cmake --build ${{github.workspace}}/build
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -L SQUINT --output-on-failure
- name: Upload build artifacts
if: matrix.compiler == 'clang++-17'
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: |
${{github.workspace}}/build
${{github.workspace}}/include
clang-tidy:
name: Clang-Tidy
needs: build-and-test-linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Clang-Tidy
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
sudo apt-get install -y clang-tidy-17
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build-artifacts
path: ${{github.workspace}}
- name: Run Clang-Tidy
run: |
find include -name '*.cpp' -or -name '*.hpp' | \
xargs clang-tidy-17 -p build \
--config-file=.clang-tidy
- name: Check Clang-Tidy result
run: |
if [ $? -ne 0 ]; then
echo "Clang-Tidy found issues. Please fix them before merging."
exit 1
fi