Skip to content

Commit 523db7f

Browse files
authored
Merge pull request #9 from ClausKlein/feature/add_workflow
add CI and cmake workflow presets for all common platform and toolchains
2 parents bb35eca + 672324a commit 523db7f

71 files changed

Lines changed: 4843 additions & 527 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bumpversion.cfg

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[bumpversion]
2+
current_version = 0.2.0-rc2
3+
commit = False
4+
message = Bump version: {current_version} → {new_version}
5+
tag_message = Release v{new_version}
6+
tag_name = v{new_version}
7+
tag = True
8+
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)([-](?P<release>(dev|rc))(?P<build>\d+))?
9+
serialize =
10+
{major}.{minor}.{patch}-{release}{build}
11+
{major}.{minor}.{patch}
12+
13+
[bumpversion:part:release]
14+
first_value = dev
15+
optional_value = ga
16+
values =
17+
dev
18+
rc
19+
ga
20+
21+
[bumpversion:part:build]
22+
first_value = 0
23+
24+
[bumpversion:file:CMakeLists.txt]
25+
search = {current_version}
26+
replace = {new_version}
27+
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<build>\d+))?
28+
serialize =
29+
{major}.{minor}.{patch}.{build}
30+
{major}.{minor}.{patch}

.clang-format

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1+
---
12
BasedOnStyle: Google
2-
Standard: Auto
3+
IndentWidth: 2
4+
UseTab: Never
5+
---
6+
Language: Cpp
7+
Standard: c++17
8+
# Standard: Auto
39
AlignAfterOpenBracket: false
410
AlignEscapedNewlinesLeft: true
511
AlwaysBreakAfterDefinitionReturnType: None

.clang-tidy

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,37 @@
11
---
22
Checks: "-*,\
33
bugprone-*,\
4-
-bugprone-reserved-identifier,\
4+
bugprone-reserved-identifier,\
5+
-bugprone-exception-escape,\
6+
-bugprone-unused-return-value,\
57
boost-*,\
8+
-boost-use-ranges,\
69
cert-*,\
10+
-cert-err33-c,\
11+
-cert-err58-cpp,\
712
clang-analyzer-*,\
813
-clang-analyzer-unix.BlockInCriticalSection,\
914
cppcoreguidelines-*,\
1015
-cppcoreguidelines-avoid-*,\
1116
-cppcoreguidelines-init-variables,\
1217
-cppcoreguidelines-macro-*,\
18+
-cppcoreguidelines-narrowing-conversions,\
1319
-cppcoreguidelines-owning-memory,\
1420
-cppcoreguidelines-prefer-member-initializer,\
1521
-cppcoreguidelines-pro-bounds-pointer-arithmetic,\
22+
-cppcoreguidelines-pro-type-reinterpret-cast,\
1623
hicpp-*,\
1724
misc-*,\
1825
-misc-const-correctness,\
1926
-misc-include-cleaner,\
2027
-misc-no-recursion,\
2128
modernize-*,\
22-
-modernize-avoid-bind,\
2329
-modernize-macro-to-enum,\
30+
-modernize-use-designated-initializers,\
2431
performance-*,\
2532
-performance-enum-size,\
2633
portability-*,\
34+
-portability-avoid-pragma-once,\
2735
readability-*,\
2836
readability-identifier-length,\
2937
readability-identifier-naming,\
@@ -46,4 +54,3 @@ CheckOptions:
4654
- { key: readability-identifier-length.MinimumParameterNameLength, value: 1 }
4755
- { key: hicpp-signed-bitwise.IgnorePositiveIntegerLiterals, value: true }
4856
...
49-

.codespellignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
QUE
2+
UInt
3+
WRONLY
4+
WS
5+
cancelled
6+
cancelling
7+
claus
8+
copyable
9+
deque
10+
fo
11+
pullrequest
12+
statics

.codespellrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[codespell]
2+
builtin = clear,rare,en-GB_to_en-US,names,informal,code
3+
check-hidden =
4+
skip = ./.git,./.direnv,./build/*,./prefix/*,./coverage/*,./stagedir/*,*.html,*.xsd,*.xsl,*.pdf,*.log,.*.swp,*~,*.bak,./tags
5+
quiet-level = 2
6+
ignore-words = .codespellignore

.devcontainer/Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2+
3+
# We use ubuntu-24.04 (noble)
4+
FROM mcr.microsoft.com/devcontainers/cpp:1-ubuntu-24.04
5+
6+
USER vscode
7+
8+
# -------------------------------
9+
# Install latest CMake and Boost
10+
# -------------------------------
11+
RUN sudo apt-get update -qq \
12+
&& sudo apt-get install -y -qq wget gpg software-properties-common \
13+
&& wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc \
14+
| gpg --dearmor \
15+
| sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null \
16+
&& echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ noble main" \
17+
| sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null \
18+
&& sudo apt-get update -qq \
19+
&& sudo apt-get install -y -qq cmake libboost-all-dev python3-pip \
20+
&& sudo rm -rf /var/lib/apt/lists/*
21+
22+
# -------------------------------
23+
# Install pre-commit, gcovr, ninja
24+
# -------------------------------
25+
RUN pip3 install --no-cache-dir pre-commit gcovr ninja cmake
26+
27+
# -------------------------------
28+
# Avoid ASAN stalling
29+
# -------------------------------
30+
# Reduces mmap randomization slightly so AddressSanitizer works reliably
31+
RUN sudo sysctl -w vm.mmap_rnd_bits=28

.devcontainer/devcontainer.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "Beman Project Generic Devcontainer",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
"postCreateCommand": "bash .devcontainer/postcreate.sh",
7+
"customizations": {
8+
"vscode": {
9+
"extensions": [
10+
"ms-vscode.cpptools",
11+
"ms-vscode.cmake-tools"
12+
]
13+
}
14+
}
15+
}

.devcontainer/postcreate.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2+
# Setup pre-commit
3+
pre-commit
4+
pre-commit install

.github/workflows/clang.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Clang on Ubuntu
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ develop ]
8+
workflow_dispatch:
9+
schedule:
10+
- cron: '30 15 * * 6'
11+
12+
jobs:
13+
clang:
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
version: [20, 21]
18+
19+
runs-on: ubuntu-latest
20+
21+
container:
22+
image: ghcr.io/mattkretz/cplusplus-ci/clang${{ matrix.version }}
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- uses: actions/setup-python@v5
28+
with: { python-version: "3.13" }
29+
30+
- name: Install Boost
31+
run: apt-get update -qq && apt-get install -y -qq libboost-all-dev
32+
33+
- name: Setup Cpp
34+
uses: aminya/setup-cpp@v1
35+
with:
36+
# compiler: llvm-${{ matrix.version }}
37+
cmake: 4.1.2
38+
ninja: 1.13.0
39+
gcovr: true
40+
41+
- name: Run test suite
42+
env:
43+
CXX: clang++-${{ matrix.version }}
44+
run: |
45+
export PATH=$HOME/.local/bin:$PATH
46+
cmake --workflow --preset llvm-release
47+
gcovr
48+
# PRESET_NAME=llvm-release make all
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CMake on multiple platforms
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ develop ]
8+
workflow_dispatch:
9+
schedule:
10+
- cron: '30 15 * * 6'
11+
12+
jobs:
13+
build:
14+
runs-on: ${{ matrix.os }}
15+
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-latest, windows-latest, macos-latest]
20+
build_type: [debug, release]
21+
c_compiler: [gcc, clang, cl]
22+
include:
23+
# Windows - MSVC
24+
- os: windows-latest
25+
c_compiler: cl
26+
cpp_compiler: cl
27+
preset: msvc
28+
29+
# Ubuntu - GCC
30+
- os: ubuntu-latest
31+
c_compiler: gcc
32+
cpp_compiler: g++
33+
preset: gcc
34+
35+
# Ubuntu - Clang
36+
- os: ubuntu-latest
37+
c_compiler: clang
38+
cpp_compiler: clang++
39+
preset: llvm
40+
41+
# macOS - Clang (default compiler)
42+
- os: macos-latest
43+
c_compiler: clang
44+
cpp_compiler: clang++
45+
preset: appleclang
46+
47+
exclude:
48+
- os: windows-latest
49+
c_compiler: gcc
50+
- os: windows-latest
51+
c_compiler: clang
52+
- os: ubuntu-latest
53+
c_compiler: cl
54+
- os: macos-latest
55+
c_compiler: gcc
56+
- os: macos-latest
57+
c_compiler: cl
58+
59+
steps:
60+
- name: Checkout source
61+
uses: actions/checkout@v4
62+
63+
# # see https://github.com/marketplace/actions/enable-developer-command-prompt
64+
- uses: ilammy/msvc-dev-cmd@v1
65+
if: matrix.os == 'windows-latest'
66+
with:
67+
vsversion: 2022
68+
arch: x64
69+
70+
- name: Workflow preset ${{ matrix.preset }}-${{ matrix.build_type }}
71+
env:
72+
CC: ${{ matrix.c_compiler }}
73+
CXX: ${{ matrix.cpp_compiler }}
74+
run: |
75+
cmake --workflow --preset ${{ matrix.preset }}-${{ matrix.build_type }}

0 commit comments

Comments
 (0)