Skip to content

Commit 31862e1

Browse files
committed
add project skeleton
1 parent 7d54e4f commit 31862e1

File tree

15 files changed

+303
-0
lines changed

15 files changed

+303
-0
lines changed

.clang-format

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BasedOnStyle: Google
2+
SortIncludes: Never

.github/workflows/linter.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Linter
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+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
lint:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
28+
29+
- name: Run clang-format
30+
uses: jidicula/clang-format-action@c74383674bf5f7c69f60ce562019c1c94bc1421a # v4.13.0
31+
with:
32+
clang-format-version: '17'
33+
fallback-style: 'Google'
34+
35+
- uses: chartboost/ruff-action@e18ae971ccee1b2d7bbef113930f00c670b78da4 # v1.0.0
36+
name: Lint with Ruff
37+
with:
38+
version: 0.5.1

.github/workflows/macos.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: macos CI
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+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
ubuntu-build:
25+
runs-on: macos-latest
26+
steps:
27+
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
28+
- name: Prepare
29+
run: cmake -B build
30+
- name: Build
31+
run: cmake --build build -j=2
32+
- name: Test
33+
run: ctest --output-on-failure --test-dir build

.github/workflows/ubuntu.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Ubuntu 24.04 CI
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+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
ubuntu-build:
25+
runs-on: ubuntu-24.04
26+
strategy:
27+
matrix:
28+
shared: [ON, OFF]
29+
cxx: [g++-14]
30+
steps:
31+
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
32+
- name: Setup Ninja
33+
run: sudo apt-get install ninja-build
34+
- name: Prepare
35+
run: cmake -DBUILD_SHARED_LIBS=${{matrix.shared}} -G Ninja -B build
36+
env:
37+
CXX: ${{matrix.cxx}}
38+
- name: Build
39+
run: cmake --build build -j=2
40+
- name: Test
41+
run: ctest --output-on-failure --test-dir build
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: VS17 CI
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+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
ci:
25+
name: windows-vs17
26+
runs-on: windows-latest
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
include:
31+
- {gen: Visual Studio 17 2022, arch: x64, config: Release}
32+
- {gen: Visual Studio 17 2022, arch: x64, config: Debug}
33+
steps:
34+
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
35+
- name: Configure
36+
run: |
37+
cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} -B build
38+
- name: Build
39+
run: cmake --build build --config "${{matrix.config}}" --verbose
40+
- name: Run tests
41+
working-directory: build
42+
run: ctest -C "${{matrix.config}}" --output-on-failure

.gitignore

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

.python-version

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

CMakeLists.txt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
cmake_minimum_required(VERSION 3.28)
2+
project(ncrypto)
3+
4+
set(CMAKE_CXX_STANDARD 20)
5+
set(CMAKE_CXX_STANDARD_REQUIRED True)
6+
if (NOT CMAKE_BUILD_TYPE)
7+
message(STATUS "No build type selected, default to Release")
8+
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
9+
endif()
10+
11+
option(NCRYPTO_DEVELOPMENT_CHECKS "Enable development checks" OFF)
12+
13+
include(GNUInstallDirs)
14+
include(FetchContent)
15+
16+
FetchContent_Declare(
17+
googletest
18+
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
19+
)
20+
# For Windows: Prevent overriding the parent project's compiler/linker settings
21+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
22+
FetchContent_MakeAvailable(googletest)
23+
24+
add_subdirectory(src)
25+
enable_testing()
26+
add_subdirectory(tests)
27+
28+
install(
29+
FILES include/ncrypto.h
30+
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
31+
COMPONENT ncrypto_development
32+
)
33+
34+
install(
35+
TARGETS ncrypto
36+
EXPORT ncrypto_targets
37+
RUNTIME COMPONENT ncrypto_runtime
38+
LIBRARY COMPONENT ncrypto_runtime
39+
NAMELINK_COMPONENT ncrypto_development
40+
ARCHIVE COMPONENT ncrypto_development
41+
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
42+
)

include/ncrypto.h

Whitespace-only changes.

pyproject.toml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[project]
2+
name = "ncrypto"
3+
requires-python = ">=3.12"
4+
5+
[tool.ruff]
6+
line-length = 120
7+
target-version = "py312"
8+
9+
[tool.ruff.format]
10+
quote-style = "single"
11+
indent-style = "space"
12+
docstring-code-format = true
13+
14+
[tool.ruff.lint]
15+
select = [
16+
"C90", # McCabe cyclomatic complexity
17+
"E", # pycodestyle
18+
"F", # Pyflakes
19+
"ICN", # flake8-import-conventions
20+
"INT", # flake8-gettext
21+
"PLC", # Pylint conventions
22+
"PLE", # Pylint errors
23+
"PLR09", # Pylint refactoring: max-args, max-branches, max returns, max-statements
24+
"PYI", # flake8-pyi
25+
"RSE", # flake8-raise
26+
"RUF", # Ruff-specific rules
27+
"T10", # flake8-debugger
28+
"TCH", # flake8-type-checking
29+
"TID", # flake8-tidy-imports
30+
"W", # pycodestyle
31+
"YTT", # flake8-2020
32+
"ANN" # flake8-annotations
33+
]
34+
ignore = [
35+
"E722", # Do not use bare `except`
36+
"ANN101", # Missing type annotation for self in method
37+
"TID252", # Prefer absolute imports over relative imports from parent modules
38+
]

0 commit comments

Comments
 (0)