save #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: SQUINT CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build-and-test: | |
name: Build and Test | |
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 | |
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 -DSQUINT_BUILD_TESTS=ON -DCMAKE_CXX_FLAGS="$CXXFLAGS" | |
else | |
cmake -B ${{github.workspace}}/build -DSQUINT_BUILD_TESTS=ON | |
fi | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
run: ctest ctest -L SQUINT --output-on-failure | |
clang-tidy: | |
name: Clang-Tidy | |
needs: build-and-test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Clang 17 and Clang-Tidy | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 17 | |
sudo apt-get install -y clang-17 libc++-17-dev libc++abi-17-dev lld-17 clang-tidy-17 | |
- name: Configure CMake | |
env: | |
CXX: clang++-17 | |
run: | | |
export CXXFLAGS="-stdlib=libc++" | |
export LDFLAGS="-stdlib=libc++ -fuse-ld=lld-17" | |
cmake -B ${{github.workspace}}/build -DSQUINT_BUILD_TESTS=ON -DCMAKE_CXX_FLAGS="$CXXFLAGS" -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS" -DCMAKE_SHARED_LINKER_FLAGS="$LDFLAGS" | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build | |
- 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 | |
build-and-test-windows: | |
name: Build and Test (Windows) | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
clang_version: [17] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install LLVM and Clang | |
uses: KyleMayes/install-llvm-action@v2 | |
with: | |
version: ${{ matrix.clang_version }} | |
- name: Configure CMake | |
env: | |
CXX: clang++ | |
run: | | |
cmake -B ${{github.workspace}}/build -DSQUINT_BUILD_TESTS=ON -DCMAKE_CXX_FLAGS="/EHsc" -T ClangCL | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build --config Release | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
run: ctest ctest -L SQUINT -C Release --output-on-failure |