-
Notifications
You must be signed in to change notification settings - Fork 0
180 lines (158 loc) · 5.46 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
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: [gcc, clang]
version: [12, 17]
blas: [MKL, OpenBLAS, NONE]
include:
- compiler: gcc
version: 12
dockerfile: Dockerfile.gcc-dev
- compiler: clang
version: 17
dockerfile: Dockerfile.llvm-dev
exclude:
- compiler: gcc
version: 17
- compiler: clang
version: 12
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.compiler }}-${{ matrix.version }}-${{ hashFiles(format('{0}/{1}', github.workspace, matrix.dockerfile)) }}
restore-keys: |
${{ runner.os }}-buildx-${{ matrix.compiler }}-${{ matrix.version }}-
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ${{ github.workspace }}/${{ matrix.dockerfile }}
build-args: |
COMPILER_VERSION=${{ matrix.version }}
tags: ${{ matrix.compiler }}-${{ matrix.version }}:latest
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Build and Test in Docker
run: |
docker run --rm -v ${{ github.workspace }}:/src ${{ matrix.compiler }}-${{ matrix.version }}:latest bash -c "
cd /src &&
mkdir build &&
cd build &&
source /opt/intel/oneapi/setvars.sh &&
cmake .. -G Ninja \
-DSQUINT_BUILD_TESTS=ON \
-DBLAS_BACKEND=${{ matrix.blas }} \
-DCMAKE_CXX_COMPILER=${{ matrix.compiler == 'gcc' && 'g++' || 'clang++' }}-${{ matrix.version }} &&
cmake --build . &&
ctest -L SQUINT --output-on-failure
"
build-and-test-windows:
name: Build and Test (Windows)
runs-on: windows-2022
strategy:
matrix:
compiler: [msvc]
version: [2022]
blas: [MKL, OpenBLAS, NONE]
include:
- compiler: msvc
version: 2022
dockerfile: Dockerfile.msvc-dev
steps:
- uses: actions/checkout@v4
- name: Cache Docker image
uses: actions/cache@v4
with:
path: ${{ github.workspace }}\docker-image.tar
key: ${{ runner.os }}-docker-${{ matrix.compiler }}-${{ matrix.version }}-${{ hashFiles(format('{0}\{1}', github.workspace, matrix.dockerfile)) }}
- name: Load cached Docker image
if: steps.cache-docker-image.outputs.cache-hit == 'true'
run: |
docker load -i ${{ github.workspace }}\docker-image.tar
shell: pwsh
- name: Build Docker image
if: steps.cache-docker-image.outputs.cache-hit != 'true'
run: |
docker build -t ${{ matrix.compiler }}-${{ matrix.version }}:latest `
--build-arg COMPILER_VERSION=${{ matrix.version }} `
-f ${{ github.workspace }}\${{ matrix.dockerfile }} .
docker save -o ${{ github.workspace }}\docker-image.tar ${{ matrix.compiler }}-${{ matrix.version }}:latest
shell: pwsh
- name: Build and Test in Docker
run: |
docker run --rm -v ${PWD}:C:\src ${{ matrix.compiler }}-${{ matrix.version }}:latest powershell -Command "
cd C:\src;
mkdir build;
cd build;
cmake .. -G Ninja `
-DSQUINT_BUILD_TESTS=ON `
-DBLAS_BACKEND=${{ matrix.blas }};
cmake --build .;
ctest -L SQUINT --output-on-failure
"
shell: pwsh
clang-tidy:
name: Clang-Tidy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-llvm-dev-${{ hashFiles('**/Dockerfile.llvm-dev') }}
restore-keys: |
${{ runner.os }}-buildx-llvm-dev-
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ${{ github.workspace }}/Dockerfile.llvm-dev
build-args: |
COMPILER_VERSION=17
tags: llvm-dev:latest
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Run Clang-Tidy in Docker
run: |
docker run --rm -v ${{ github.workspace }}:/src llvm-dev:latest bash -c "
cd /src &&
mkdir build &&
cd build &&
cmake -G Ninja -DSQUINT_BUILD_TESTS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBLAS_BACKEND=NONE .. &&
cd .. &&
find ./include -name '*.cpp' -or -name '*.hpp' |
xargs -P $(nproc) clang-tidy -p build
"
- name: Check Clang-Tidy result
run: |
if [ $? -ne 0 ]; then
echo "Clang-Tidy found issues. Please fix them before merging."
exit 1
fi