Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add bazel #2

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build
cmake-build-debug-coverage
cmake-build-debug
cmake-build-release
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build --cxxopt="-std=c++20"
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.0.0
54 changes: 54 additions & 0 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Bazel

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths-ignore:
- '**.md'
- 'docs/**'
push:
branches:
- main
paths-ignore:
- '**.md'
- 'docs/**'

permissions:
contents: read
actions: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: bazel-contrib/setup-bazel@bbf8fe8b219f642c7f8bc673215f28eb1d9dec51 # v0.10.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}
repository-cache: true
- name: Build & Test
run: bazel test //...
ubuntu:
strategy:
fail-fast: false
matrix:
shared: [ON, OFF]
cxx: [g++-12, clang++-14]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: bazel-contrib/setup-bazel@bbf8fe8b219f642c7f8bc673215f28eb1d9dec51 # v0.10.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}
repository-cache: true
- name: Build & Test
run: bazel test //...
env:
CC: ${{matrix.cxx}}
CXX: ${{matrix.cxx}}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cmake-build-debug
build
.idea
bazel-*
7 changes: 7 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cc_library(
name = "ncrypto",
srcs = glob(["src/*.cpp"]),
hdrs = glob(["include/*.h"]),
includes = ["include"],
visibility = ["//visibility:public"],
)
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bazel_dep(name = "googletest", version = "1.15.2")
280 changes: 280 additions & 0 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions tests/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cc_test(
name = "basic",
srcs = ["basic.cpp"],
deps = [
"//:ncrypto",
"@googletest//:gtest",
"@googletest//:gtest_main",
],
)
Loading