Skip to content

Commit d779257

Browse files
authored
add bazel (#2)
1 parent 1fd7fa5 commit d779257

File tree

9 files changed

+358
-0
lines changed

9 files changed

+358
-0
lines changed

.bazelignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build
2+
cmake-build-debug-coverage
3+
cmake-build-debug
4+
cmake-build-release

.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build --cxxopt="-std=c++20"

.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8.0.0

.github/workflows/bazel.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Bazel
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
paths-ignore:
7+
- '**.md'
8+
- 'docs/**'
9+
push:
10+
branches:
11+
- main
12+
paths-ignore:
13+
- '**.md'
14+
- 'docs/**'
15+
16+
permissions:
17+
contents: read
18+
actions: write
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true
23+
24+
jobs:
25+
macos:
26+
runs-on: macos-latest
27+
steps:
28+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
29+
- uses: bazel-contrib/setup-bazel@bbf8fe8b219f642c7f8bc673215f28eb1d9dec51 # v0.10.0
30+
with:
31+
bazelisk-cache: true
32+
disk-cache: ${{ github.workflow }}
33+
repository-cache: true
34+
- name: Build & Test
35+
run: bazel test //...
36+
ubuntu:
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
shared: [ON, OFF]
41+
cxx: [g++-12, clang++-14]
42+
runs-on: ubuntu-22.04
43+
steps:
44+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
45+
- uses: bazel-contrib/setup-bazel@bbf8fe8b219f642c7f8bc673215f28eb1d9dec51 # v0.10.0
46+
with:
47+
bazelisk-cache: true
48+
disk-cache: ${{ github.workflow }}
49+
repository-cache: true
50+
- name: Build & Test
51+
run: bazel test //...
52+
env:
53+
CC: ${{matrix.cxx}}
54+
CXX: ${{matrix.cxx}}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
cmake-build-debug
22
build
33
.idea
4+
bazel-*

BUILD.bazel

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cc_library(
2+
name = "ncrypto",
3+
srcs = glob(["src/*.cpp"]),
4+
hdrs = glob(["include/*.h"]),
5+
includes = ["include"],
6+
visibility = ["//visibility:public"],
7+
)

MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bazel_dep(name = "googletest", version = "1.15.2")

MODULE.bazel.lock

Lines changed: 280 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/BUILD.bazel

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
cc_test(
2+
name = "basic",
3+
srcs = ["basic.cpp"],
4+
deps = [
5+
"//:ncrypto",
6+
"@googletest//:gtest",
7+
"@googletest//:gtest_main",
8+
],
9+
)

0 commit comments

Comments
 (0)