Skip to content

Commit

Permalink
feat: Prepare repository (part 2) (#4)
Browse files Browse the repository at this point in the history
## Describe your changes

Closes #2

## Checklist before requesting a review

- [x] I've followed Contributions guidelines
- [x] I have performed a self-review of my code
- [x] If it's a new feature, I've added tests that covers 100% of it
- [x] If it's a bug fix, I've added test case to reproduce the bug
  • Loading branch information
Gashmob authored Jul 24, 2024
2 parents 4eaa17a + 6457eb0 commit 12739e3
Show file tree
Hide file tree
Showing 25 changed files with 2,023 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Enable Bzlmod for every Bazel command
common --enable_bzlmod
7 changes: 7 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
BasedOnStyle: LLVM
IndentWidth: 4
---
Language: Cpp
Standard: c++17
UseTab: Never
33 changes: 33 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
FormatStyle: llvm
CheckOptions:
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.ClassConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.ClassMemberCase
value: lower_case
- key: readability-identifier-naming.ClassMethodCase
value: camelBack
- key: readability-identifier-naming.ConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.EnumCase
value: CamelCase
- key: readability-identifier-naming.EnumConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.FunctionCase
value: camelBack
- key: readability-identifier-naming.LocalVariableCase
value: lower_case
- key: readability-identifier-naming.MemberCase
value: lower_case
- key: readability-identifier-naming.MethodCase
value: camelBack
- key: readability-identifier-naming.NamespaceCase
value: lower_case
- key: readability-identifier-naming.ParameterCase
value: lower_case
- key: readability-identifier-naming.StructCase
value: CamelCase
- key: readability-identifier-naming.VariableCase
value: lower_case
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[*]
indent_style = space

[*.nix]
indent_size = 2

[*.bazel]
indent_size = 4
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
1 change: 0 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

...


## Checklist before requesting a review

- [ ] I've followed Contributions guidelines
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Package

on:
push:
branches:
- master
- dev-workflow
pull_request:

jobs:
build:
name: Build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7

- name: Install Nix
uses: cachix/install-nix-action@ba0dd844c9180cbf77aa72a116d6fbc515d0e87b # v27
- name: Build
run: nix-shell --pure --run 'bazel build //:filc'

- name: Archive binary
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: filc
path: ${{ github.workspace }}/bazel-bin/filc
30 changes: 30 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Tests

on:
push:
branches:
- master
pull_request:

jobs:
build:
name: "Build & Run"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7

- name: Install Nix
uses: cachix/install-nix-action@ba0dd844c9180cbf77aa72a116d6fbc515d0e87b # v27
- name: Build then run
run: nix-shell --pure --run 'bazel run //:filc'

unit-tests:
name: "Unit tests"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7

- name: Install Nix
uses: cachix/install-nix-action@ba0dd844c9180cbf77aa72a116d6fbc515d0e87b # v27
- name: Run tests
run: nix-shell --pure --run 'bazel test //:unit-tests'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bazel-*
.clwb
31 changes: 31 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
cc_library(
name = "filc_lib",
srcs = glob([
"src/*.cpp",
"src/**/*.cpp",
]),
hdrs = glob([
"include/filc/*.h",
"include/filc/**/*.h",
]),
includes = ["include"],
)

cc_binary(
name = "filc",
srcs = ["main.cpp"],
deps = ["//:filc_lib"],
)

cc_test(
name = "unit-tests",
srcs = glob([
"tests/unit/*.cpp",
"tests/unit/**/*.cpp",
]),
deps = [
"//:filc_lib",
"@googletest//:gtest",
"@googletest//:gtest_main",
],
)
3 changes: 3 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module(name = "filc")

bazel_dep(name = "googletest", version = "1.14.0", dev_dependency=True)
Loading

0 comments on commit 12739e3

Please sign in to comment.