-
Notifications
You must be signed in to change notification settings - Fork 12
129 lines (113 loc) · 4.28 KB
/
ci.yml
File metadata and controls
129 lines (113 loc) · 4.28 KB
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
name: CI
on:
push:
branches: [master]
tags: ['v*']
pull_request:
branches: [master]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
cc: gcc-14
cxx: g++-14
name: Linux GCC
release_only: true
- os: ubuntu-24.04
cc: clang-22
cxx: clang++-22
name: Linux Clang
release_only: false
- os: macos-15
cc: clang
cxx: clang++
name: macOS
release_only: true
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
if: ${{ !matrix.release_only || startsWith(github.ref, 'refs/tags/v') }}
with:
persist-credentials: false
- name: Install dependencies (Linux)
if: runner.os == 'Linux' && (!matrix.release_only || startsWith(github.ref, 'refs/tags/v'))
run: |
wget -qO llvm.sh https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 22 all
sudo apt-get install -y -qq libz3-dev ninja-build
echo "LLVM_DIR=/usr/lib/llvm-22/lib/cmake/llvm" >> "$GITHUB_ENV"
- name: Install dependencies (macOS)
if: runner.os == 'macOS' && (!matrix.release_only || startsWith(github.ref, 'refs/tags/v'))
run: |
brew install llvm z3 ninja
LLVM_PREFIX="$(brew --prefix llvm)"
echo "${LLVM_PREFIX}/bin" >> "$GITHUB_PATH"
{
echo "LLVM_DIR=${LLVM_PREFIX}/lib/cmake/llvm"
echo "CC=${LLVM_PREFIX}/bin/clang"
echo "CXX=${LLVM_PREFIX}/bin/clang++"
echo "LDFLAGS=-L${LLVM_PREFIX}/lib/c++ -Wl,-rpath,${LLVM_PREFIX}/lib/c++"
} >> "$GITHUB_ENV"
- name: Log tool versions
if: ${{ !matrix.release_only || startsWith(github.ref, 'refs/tags/v') }}
run: |
"${CC:-${{ matrix.cc }}}" --version
cmake --version
ninja --version
- name: Cache dependencies
if: ${{ !matrix.release_only || startsWith(github.ref, 'refs/tags/v') }}
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: build-deps/install
key: deps-${{ matrix.os }}-${{ matrix.cc }}-${{ hashFiles('dependencies/*.cmake') }}
- name: Build dependencies
if: ${{ !matrix.release_only || startsWith(github.ref, 'refs/tags/v') }}
run: |
cmake -S dependencies -B build-deps -G Ninja \
-DCMAKE_C_COMPILER="${CC:-${{ matrix.cc }}}" \
-DCMAKE_CXX_COMPILER="${CXX:-${{ matrix.cxx }}}" \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_EXTERNAL_LLVM=ON \
-DCOBRA_BUILD_TESTS=ON
cmake --build build-deps
- name: Build CoBRA
if: ${{ !matrix.release_only || startsWith(github.ref, 'refs/tags/v') }}
run: |
cmake -S . -B build -G Ninja \
-DCMAKE_C_COMPILER="${CC:-${{ matrix.cc }}}" \
-DCMAKE_CXX_COMPILER="${CXX:-${{ matrix.cxx }}}" \
-DCMAKE_PREFIX_PATH="$(pwd)/build-deps/install" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS_INIT="-march=native" \
-DCOBRA_BUILD_TESTS=ON \
-DCOBRA_BUILD_LLVM_PASS=ON
cmake --build build
- name: Run tests
if: ${{ !matrix.release_only || startsWith(github.ref, 'refs/tags/v') }}
run: ctest --test-dir build -j "$(nproc 2>/dev/null || sysctl -n hw.ncpu)" --output-on-failure -E "DatasetBenchmark|SiMBADataset|GAMBADataset|OSESDataset|ObfuscatorXDataset"
lint:
name: Lint
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install clang-format
run: |
wget -qO llvm.sh https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 22 all
- name: clang-format check
run: |
find include lib tools \( -name '*.h' -o -name '*.cpp' \) -print0 \
| xargs -0 clang-format-22 --dry-run --Werror