-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (110 loc) · 3.76 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
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"
else
cmake -B ${{github.workspace}}/build -G Ninja -DSQUINT_BUILD_TESTS=ON
fi
- name: Build
run: cmake --build ${{github.workspace}}/build
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -L SQUINT --output-on-failure
build-and-test-windows:
name: Build and Test (Windows)
runs-on: windows-latest
defaults:
run:
shell: pwsh
steps:
- uses: actions/checkout@v4
- name: Install Ninja
run: choco install ninja
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v2
with:
version: "17.0"
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.11"
channels: conda-forge
- name: Install MKL
run: |
conda install -c https://software.repos.intel.com/python/conda/ -c conda-forge mkl mkl-devel
- name: Configure CMake
run: |
$env:PATH = "$env:CONDA\Scripts;$env:PATH"
cmake -B ${{github.workspace}}/build -G Ninja -DSQUINT_BUILD_TESTS=ON -DBLAS_BACKEND=MKL -DCMAKE_CXX_COMPILER=clang++
- name: Build
run: |
$env:PATH = "$env:CONDA\Scripts;$env:PATH"
cmake --build ${{github.workspace}}/build
- name: Test
working-directory: ${{github.workspace}}/build
run: |
$env:PATH = "$env:CONDA\Scripts;$env:PATH"
ctest -L SQUINT --output-on-failure
clang-tidy:
name: Clang-Tidy
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 ninja-build
- name: Configure CMake
env:
CXX: clang++-17
run: |
export CXXFLAGS="-stdlib=libc++"
cmake -B ${{github.workspace}}/build -G Ninja -DSQUINT_BUILD_TESTS=ON -DCMAKE_CXX_FLAGS="$CXXFLAGS" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Build
run: cmake --build ${{github.workspace}}/build
- name: Run Clang-Tidy
run: |
find include -name '*.cpp' -or -name '*.hpp' | \
xargs -P $(nproc) 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