-
Notifications
You must be signed in to change notification settings - Fork 136
193 lines (171 loc) · 6.85 KB
/
linux.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
181
182
183
184
185
186
187
188
189
190
191
192
193
---
name: Linux CI
on: [push, pull_request]
jobs:
build64:
name: Ubuntu 64-bit
strategy:
fail-fast: false
matrix:
include:
# Linux with GCC
- {os: ubuntu-18.04, llvm: '3.9', compiler: gcc}
- {os: ubuntu-18.04, llvm: '4.0', compiler: gcc}
- {os: ubuntu-18.04, llvm: '5.0', compiler: gcc}
- {os: ubuntu-18.04, llvm: '6.0', compiler: gcc}
- {os: ubuntu-18.04, llvm: 7, compiler: gcc}
- {os: ubuntu-18.04, llvm: 8, compiler: gcc}
- {os: ubuntu-18.04, llvm: 9, compiler: gcc}
- {os: ubuntu-20.04, llvm: 10, compiler: gcc}
- {os: ubuntu-20.04, llvm: 11, compiler: gcc}
- {os: ubuntu-20.04, llvm: 12, compiler: gcc}
- {os: ubuntu-22.04, llvm: 13, compiler: gcc}
- {os: ubuntu-22.04, llvm: 14, compiler: gcc}
- {os: ubuntu-22.04, llvm: 14, compiler: gcc, type: Debug}
# Linux with Clang
- {os: ubuntu-18.04, llvm: '3.9', compiler: clang}
- {os: ubuntu-18.04, llvm: '4.0', compiler: clang}
- {os: ubuntu-18.04, llvm: '5.0', compiler: clang}
- {os: ubuntu-18.04, llvm: '6.0', compiler: clang}
- {os: ubuntu-18.04, llvm: 7, compiler: clang}
- {os: ubuntu-18.04, llvm: 8, compiler: clang}
- {os: ubuntu-18.04, llvm: 9, compiler: clang}
- {os: ubuntu-20.04, llvm: 10, compiler: clang}
- {os: ubuntu-20.04, llvm: 11, compiler: clang}
- {os: ubuntu-20.04, llvm: 12, compiler: clang}
- {os: ubuntu-22.04, llvm: 13, compiler: clang}
- {os: ubuntu-22.04, llvm: 14, compiler: clang}
- {os: ubuntu-22.04, llvm: 14, compiler: clang, type: Debug}
runs-on: ${{matrix.os}}
env:
# for colours in ninja
CLICOLOR_FORCE: 1
steps:
- name: Checkout DG
uses: actions/checkout@v3
- name: '[LLVM ${{matrix.llvm}}] Add repositories'
if: matrix.llvm >= 15
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy-${{matrix.llvm}} main"
- name: Install dependencies
run: |
sudo apt update
sudo apt install ccache cmake ninja-build clang-${{matrix.llvm}} \
llvm-${{matrix.llvm}}-dev
- name: Set environment
id: env
run: |
if [[ "${{matrix.compiler}}" = "clang" ]]; then
echo "CC=clang-${{matrix.llvm}}" >> $GITHUB_ENV
echo "CXX=clang++-${{matrix.llvm}}" >> $GITHUB_ENV
# force coloured output
echo "CFLAGS=$CFLAGS -fcolor-diagnostics" >> $GITHUB_ENV
echo "CXXFLAGS=$CXXFLAGS -fcolor-diagnostics" >> $GITHUB_ENV
else
echo "CC=gcc" >> $GITHUB_ENV
echo "CXX=g++" >> $GITHUB_ENV
# force coloured output
echo "CFLAGS=$CFLAGS -fdiagnostics-color=always" >> $GITHUB_ENV
echo "CXXFLAGS=$CXXFLAGS -fdiagnostics-color=always" >> $GITHUB_ENV
fi
# set up ccache
sudo /usr/sbin/update-ccache-symlinks
echo "/usr/lib/ccache" >> $GITHUB_PATH
# Bionic does not create symlinks to versioned clang
sudo ln -sfr /usr/bin/ccache /usr/lib/ccache/clang-${{matrix.llvm}}
sudo ln -sfr /usr/bin/ccache /usr/lib/ccache/clang++-${{matrix.llvm}}
echo "CCACHE_BASEDIR=$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "CCACHE_DIR=$GITHUB_WORKSPACE/.ccache" >> $GITHUB_ENV
echo "CCACHE_COMPRESS=true" >> $GITHUB_ENV
echo "CCACHE_COMPRESSLEVEL=6" >> $GITHUB_ENV
echo "CCACHE_MAXSIZE=400M" >> $GITHUB_ENV
echo "::set-output name=timestamp::$(date -u -Iseconds)"
- name: Set up ccache
uses: actions/cache@v3
with:
path: .ccache
key: ${{matrix.os}}-${{matrix.llvm}}-${{matrix.compiler}}-${{matrix.type}}-${{steps.env.outputs.timestamp}}
restore-keys: ${{matrix.os}}-${{matrix.llvm}}-${{matrix.compiler}}-${{matrix.type}}
- name: '[Dynamic LLVM] Configure CMake project'
run: |
cmake -S. \
-B_build \
-GNinja \
-DCMAKE_BUILD_TYPE:STRING="${{matrix.type}}" \
-DUSE_SANITIZERS:BOOL=ON \
-DLLVM_DIR:PATH="/usr/lib/llvm-${{matrix.llvm}}/lib/cmake/llvm"
# llvm-config-3.9 does not take --cmakedir yet!
- name: '[Dynamic LLVM] Build'
run: cmake --build _build
- name: '[Dynamic LLVM] Run tests'
# TODO: turn off the detection of leaks, we're working on it
run: ASAN_OPTIONS=detect_leaks=0 cmake --build _build --target check
- name: '[Static LLVM] Re-configure CMake project'
run: |
cmake -S. \
-B_build \
-DLLVM_LINK_DYLIB:BOOL=OFF
cmake --build _build --target clean
- name: '[Static LLVM] Build'
run: cmake --build _build
- name: '[Static LLVM] Run tests'
# TODO: turn off the detection of leaks, we're working on it
run: ASAN_OPTIONS=detect_leaks=0 cmake --build _build --target check
- name: ccache statistics
run: ccache -s
# Warning: untested and incomplete
#
# build32:
# name: Ubuntu 32-bit
# runs-on: ubuntu-20.04
# container: ubuntu:latest
#
# strategy:
# fail-fast: false
# matrix:
# compiler: [gcc, clang]
# build_type: [Debug, Release]
#
# steps:
# - uses: actions/checkout@v2
# - name: Install dependencies
# run: |
# dpkg --add-architecture i386
# apt update
# apt install -y cmake ninja-build clang:i386 llvm-dev:i386 libc-dev:i386
#
# - name: Set environment
# run: |
# CFLAGS="$CFLAGS -m32"
# CXXFLAGS="$CXXFLAGS -m32"
#
# if [[ "${{matrix.compiler}}" = "clang" ]]; then
# echo "CC=clang" >> $GITHUB_ENV
# echo "CXX=clang++" >> $GITHUB_ENV
#
# # force coloured output
# echo "CFLAGS=$CFLAGS -fcolor-diagnostics" >> $GITHUB_ENV
# echo "CXXFLAGS=$CXXFLAGS -fcolor-diagnostics" >> $GITHUB_ENV
# else
# echo "CC=gcc" >> $GITHUB_ENV
# echo "CXX=g++" >> $GITHUB_ENV
#
# # force coloured output
# echo "CFLAGS=$CFLAGS -fdiagnostics-color" >> $GITHUB_ENV
# echo "CXXFLAGS=$CXXFLAGS -fdiagnostics-color" >> $GITHUB_ENV
# fi
#
# - name: Configure CMake project
# run: |
# cmake -Bbuild -S. \
# -GNinja \
# -DUSE_SANITIZERS=ON \
# -DCMAKE_BUILD_TYPE='${{matrix.build_type}}'
#
# - name: Build
# run: ninja -C build
#
# - name: Run tests
# # TODO: turn off the detection of leaks, we're working on it
# run: ASAN_OPTIONS=detect_leaks=0 ninja check -C build