Skip to content

Commit c6e919f

Browse files
Add CI workflow, Dependabot, and pin GoogleTest SHA
- CI workflow: 3-job matrix (Linux GCC, Linux Clang, macOS AppleClang) with system LLVM 19, Z3, clang-format and clang-tidy checks - Dependabot: weekly grouped updates for GitHub Actions - Pin GoogleTest GIT_TAG to commit SHA for v1.16.0 - Actions pinned to full SHAs (checkout v6.0.2, cache v5.0.1) - Fix AuxVarEliminator.cpp: rename compact_signature_soft and compact_signature_hw to PascalCase to match project conventions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b177cfd commit c6e919f

6 files changed

Lines changed: 126 additions & 5 deletions

File tree

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Checks: "*,\
2222
-readability-identifier-length, \
2323
-readability-function-cognitive-complexity, \
2424
-bugprone-easily-swappable-parameters "
25+
HeaderFilterRegex: 'cobra/'
2526
WarningsAsErrors: ''
2627
CheckOptions:
2728
- key: 'bugprone-argument-comment.StrictMode'

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
groups:
8+
actions:
9+
patterns:
10+
- "*"
11+
open-pull-requests-limit: 5

.github/workflows/ci.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build:
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- os: ubuntu-24.04
23+
cc: gcc-14
24+
cxx: g++-14
25+
name: Linux GCC
26+
lint: false
27+
- os: ubuntu-24.04
28+
cc: clang-19
29+
cxx: clang++-19
30+
name: Linux Clang
31+
lint: true
32+
- os: macos-14
33+
cc: clang
34+
cxx: clang++
35+
name: macOS
36+
lint: false
37+
38+
name: ${{ matrix.name }}
39+
runs-on: ${{ matrix.os }}
40+
41+
steps:
42+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
43+
with:
44+
persist-credentials: false
45+
46+
- name: Install dependencies (Linux)
47+
if: runner.os == 'Linux'
48+
run: |
49+
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key \
50+
| sudo apt-key add -
51+
echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main" \
52+
| sudo tee /etc/apt/sources.list.d/llvm.list
53+
sudo apt-get update -qq
54+
sudo apt-get install -y -qq \
55+
llvm-19-dev clang-19 clang-format-19 clang-tidy-19 \
56+
libz3-dev
57+
echo "LLVM_DIR=/usr/lib/llvm-19/lib/cmake/llvm" >> "$GITHUB_ENV"
58+
59+
- name: Install dependencies (macOS)
60+
if: runner.os == 'macOS'
61+
run: |
62+
brew install llvm@19 z3
63+
LLVM_PREFIX="$(brew --prefix llvm@19)"
64+
echo "${LLVM_PREFIX}/bin" >> "$GITHUB_PATH"
65+
{
66+
echo "LLVM_DIR=${LLVM_PREFIX}/lib/cmake/llvm"
67+
echo "CC=${LLVM_PREFIX}/bin/clang"
68+
echo "CXX=${LLVM_PREFIX}/bin/clang++"
69+
echo "LDFLAGS=-L${LLVM_PREFIX}/lib/c++ -Wl,-rpath,${LLVM_PREFIX}/lib/c++"
70+
} >> "$GITHUB_ENV"
71+
72+
- name: Cache GoogleTest
73+
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
74+
with:
75+
path: build-deps/install
76+
key: gtest-${{ matrix.os }}-${{ matrix.cc }}-v1.16.0
77+
78+
- name: Build dependencies
79+
run: |
80+
cmake -S dependencies -B build-deps \
81+
-DCMAKE_C_COMPILER="${CC:-${{ matrix.cc }}}" \
82+
-DCMAKE_CXX_COMPILER="${CXX:-${{ matrix.cxx }}}" \
83+
-DCMAKE_BUILD_TYPE=Release \
84+
-DUSE_EXTERNAL_LLVM=ON
85+
cmake --build build-deps
86+
87+
- name: Build CoBRA
88+
run: |
89+
cmake -S . -B build \
90+
-DCMAKE_C_COMPILER="${CC:-${{ matrix.cc }}}" \
91+
-DCMAKE_CXX_COMPILER="${CXX:-${{ matrix.cxx }}}" \
92+
-DCMAKE_PREFIX_PATH="$(pwd)/build-deps/install" \
93+
-DCMAKE_BUILD_TYPE=Release
94+
cmake --build build
95+
96+
- name: Run tests
97+
run: ctest --test-dir build --output-on-failure
98+
99+
- name: clang-format check
100+
if: matrix.lint
101+
run: |
102+
find include lib tools \( -name '*.h' -o -name '*.cpp' \) -print0 \
103+
| xargs -0 clang-format-19 --dry-run --Werror
104+
105+
- name: clang-tidy
106+
if: matrix.lint
107+
run: |
108+
find lib tools -name '*.cpp' -print0 \
109+
| xargs -0 clang-tidy-19 -p build --warnings-as-errors='*'

dependencies/googletest.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ else()
1919
message(STATUS "Building GoogleTest from source (v1.16.0)")
2020
cobra_add_dependency(googletest
2121
GIT_REPOSITORY https://github.com/google/googletest.git
22-
GIT_TAG v1.16.0
22+
GIT_TAG 6910c9d9165801d8827d628cb72eb7ea9dd538c5 # v1.16.0
2323
GIT_SHALLOW ON
2424
GIT_PROGRESS ON
2525
CMAKE_ARGS

lib/core/AuxVarEliminator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ namespace cobra {
8585
return supported;
8686
}
8787

88-
__attribute__((target("bmi2"))) std::vector< uint64_t > compact_signature_hw(
88+
__attribute__((target("bmi2"))) std::vector< uint64_t > CompactSignatureHw(
8989
const std::vector< uint64_t > &sig, uint64_t live_mask, uint32_t num_vars
9090
) {
9191
uint32_t new_count = static_cast< uint32_t >(std::popcount(live_mask));
@@ -122,9 +122,9 @@ namespace cobra {
122122
std::vector< uint64_t > reduced;
123123
#if COBRA_X86
124124
if (has_bmi2()) {
125-
reduced = compact_signature_hw(sig, live_mask, num_vars);
125+
reduced = CompactSignatureHw(sig, live_mask, num_vars);
126126
} else {
127-
reduced = compact_signature_soft(sig, live_mask, num_vars);
127+
reduced = CompactSignatureSoft(sig, live_mask, num_vars);
128128
}
129129
#else
130130
reduced = CompactSignatureSoft(sig, live_mask, num_vars);

lib/core/ProductIdentityRecoverer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace cobra {
3939
const size_t sig_len = 1ULL << num_vars;
4040

4141
// Compute boolean signatures for all 4 factors
42-
const const Expr *factors[4] = {
42+
const Expr *factors[4] = {
4343
add_node.children[0]->children[0].get(),
4444
add_node.children[0]->children[1].get(),
4545
add_node.children[1]->children[0].get(),

0 commit comments

Comments
 (0)