Skip to content

Commit bf4e754

Browse files
authored
Initial commit
0 parents  commit bf4e754

32 files changed

+2283
-0
lines changed

.clang-format

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
BasedOnStyle: Google
3+
AlignAfterOpenBracket: 'AlwaysBreak'
4+
AllowAllConstructorInitializersOnNextLine: 'false'
5+
AllowAllParametersOfDeclarationOnNextLine: 'false'
6+
AlignConsecutiveMacros: 'true'
7+
AllowShortCaseLabelsOnASingleLine: 'true'
8+
AllowShortFunctionsOnASingleLine: 'None'
9+
AllowShortIfStatementsOnASingleLine: 'Never'
10+
AllowShortLoopsOnASingleLine: 'false'
11+
BreakBeforeBraces: Allman
12+
BinPackArguments: 'false'
13+
BinPackParameters: 'false'
14+
Cpp11BracedListStyle: 'false'
15+
ColumnLimit: 125
16+
NamespaceIndentation: All
17+
SpaceAfterTemplateKeyword: 'false'
18+
SpaceBeforeCtorInitializerColon: 'true'
19+
SpaceBeforeInheritanceColon: 'true'
20+
SpaceBeforeParens: ControlStatements
21+
SpaceBeforeRangeBasedForLoopColon: 'true'
22+
SpaceInEmptyBlock: true
23+
Standard: 'Latest'
24+
...

.clang-tidy

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
Checks: '*,-fuchsia-*,-google-*,-zircon-*,-abseil-*,-modernize-use-trailing-return-type,-llvm-*,-llvmlibc-*'
3+
CheckOptions: [{ key: misc-non-private-member-variables-in-classes, value: IgnoreClassesWithAllMemberVariablesBeingPublic }]
4+
WarningsAsErrors: '*'
5+
HeaderFilterRegex: ''
6+
FormatStyle: none

.github/ISSUE_TEMPLATE/bug_report.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help me improve
4+
title: "[BUG]"
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
16+
1. Go to '...'
17+
2. Click on '....'
18+
3. Scroll down to '....'
19+
4. See error
20+
21+
**Expected behavior**
22+
A clear and concise description of what you expected to happen.
23+
24+
**Screenshots**
25+
If applicable, add screenshots to help explain your problem.
26+
27+
**Desktop (please complete the following information):**
28+
29+
* OS: [e.g. Windows]
30+
* Version [e.g. 10]
31+
32+
**Additional context**
33+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/custom.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: Custom issue template
3+
about: Describe this issue template's purpose here.
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: "[FEATURE]"
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated
12+
when [...]
13+
14+
**Describe the solution you'd like**
15+
A clear and concise description of what you want to happen.
16+
17+
**Describe alternatives you've considered**
18+
A clear and concise description of any alternative solutions or features you've considered.
19+
20+
**Provide usage examples**
21+
A few examples of how the feature should be used. Please make sure they are clear
22+
and concise.
23+
24+
**Additional context**
25+
Add any other context or screenshots about the feature request here.

.github/workflows/macos.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: MacOS
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
env:
10+
BUILD_TYPE: Release
11+
INSTALL_LOCATION: .local
12+
13+
jobs:
14+
build:
15+
16+
runs-on: macos-latest
17+
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
22+
- name: cache dependencies
23+
uses: actions/cache@v2
24+
id: cache
25+
with:
26+
path: ${{ github.workspace }}/${{ env.INSTALL_LOCATION }}
27+
key: ${{ runner.os }}-dependencies
28+
29+
- name: install GoogleTest
30+
if: ${{ steps.cache.output.cache-hit != 'true' }}
31+
run: |
32+
cd ..
33+
git clone https://github.com/google/googletest.git --branch release-1.10.0
34+
cd googletest
35+
cmake -Bbuild -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/$INSTALL_LOCATION
36+
cmake --build build --config Release
37+
cmake --build build --target install --config Release
38+
cd ../modern-cpp-template
39+
40+
- name: configure
41+
run: cmake -Bbuild -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/$INSTALL_LOCATION
42+
43+
- name: build
44+
run: cmake --build build --config $BUILD_TYPE -j4
45+
46+
- name: run tests
47+
run: |
48+
cd build
49+
ctest -C $BUILD_TYPE -VV
50+
51+
- name: install project
52+
run: cmake --build build --target install --config Release
53+

.github/workflows/release.yml

+189
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
env:
9+
PROJECT_NAME: "modern-cpp-template"
10+
BUILD_TYPE: Release
11+
12+
jobs:
13+
build:
14+
name: ${{ matrix.config.name }}
15+
runs-on: ${{ matrix.config.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
config:
20+
- {
21+
name: "Windows Latest MSVC",
22+
artifact_ext: '.zip',
23+
os: windows-latest,
24+
cc: "cl",
25+
cxx: "cl",
26+
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
27+
}
28+
- {
29+
name: "Ubuntu Latest GCC",
30+
artifact_ext: '.tar.gz',
31+
os: ubuntu-latest,
32+
cc: "gcc",
33+
cxx: "g++",
34+
}
35+
- {
36+
name: "macOS Latest Clang",
37+
artifact_ext: '.tar.gz',
38+
os: macos-latest,
39+
cc: "clang",
40+
cxx: "clang++",
41+
}
42+
43+
steps:
44+
- name: set version name (Windows)
45+
id: version_win
46+
if: ${{ runner.os == 'Windows' }}
47+
run: |
48+
$TAG = (${env:GITHUB_REF} -replace 'refs/tags/', '')
49+
echo "::set-output name=name::$TAG"
50+
51+
- name: set version name
52+
id: version
53+
if: ${{ runner.os != 'Windows' }}
54+
run: echo ::set-output name=name::${GITHUB_REF#refs/tags/}
55+
56+
- name: Checkout
57+
uses: actions/checkout@v2
58+
with:
59+
submodules: recursive
60+
61+
- name: cache dependencies
62+
uses: actions/cache@v2
63+
id: cache
64+
with:
65+
path: ${{ github.HOME }}/.local
66+
key: ${{ runner.os }}-dependencies
67+
68+
- name: install GoogleTest
69+
if: ${{ steps.cache.output.cache-hit != 'true' }}
70+
run: |
71+
cd ..
72+
git clone https://github.com/google/googletest.git --branch release-1.10.0
73+
cd googletest
74+
cmake -Bbuild -DCMAKE_INSTALL_PREFIX="$HOME/.local" -Dgtest_force_shared_crt=1
75+
cmake --build build --config Release
76+
cmake --build build --target install --config Release
77+
cd ../modern-cpp-template
78+
79+
- name: configure
80+
run: cmake -Bbuild -DCMAKE_INSTALL_PREFIX="$HOME/.local"
81+
82+
- name: build
83+
run: cmake --build build --config "$env:BUILD_TYPE" -j4
84+
85+
- name: run tests
86+
run: |
87+
cd build
88+
ctest -C "$env:BUILD_TYPE" -VV
89+
90+
# for a release not containing directly the source code, replace the files archived
91+
# with the actual files needed (i.e. *.lib/*.a and *.h(pp))
92+
93+
- name: generate archive (Windows)
94+
if: ${{ runner.os == 'Windows' }}
95+
run: |
96+
rmdir -r -fo build
97+
7z a -tzip $HOME/artifact.zip *
98+
99+
100+
- name: generate archive
101+
if: ${{ runner.os != 'Windows' }}
102+
run: |
103+
rm -rf build
104+
tar -cvzf $HOME/artifact.tar.gz .
105+
106+
- name: upload artifacts
107+
uses: actions/upload-artifact@v2
108+
if: ${{ runner.os == 'Windows' }}
109+
with:
110+
name: ${{ runner.os }}-${{ steps.version_win.outputs.name }}
111+
path: '~/artifact.*'
112+
113+
- name: upload artifacts
114+
uses: actions/upload-artifact@v2
115+
if: ${{ runner.os != 'Windows' }}
116+
with:
117+
name: ${{ runner.os }}-${{ steps.version.outputs.name }}
118+
path: '~/artifact.*'
119+
120+
release:
121+
if: contains(github.ref, 'tags/v')
122+
runs-on: ubuntu-latest
123+
needs: build
124+
125+
steps:
126+
- name: set version name
127+
id: version
128+
run: echo ::set-output name=name::${GITHUB_REF#refs/tags/}
129+
130+
- name: create release
131+
id: create_release
132+
uses: actions/create-release@v1
133+
env:
134+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
135+
with:
136+
tag_name: ${{ github.ref }}
137+
release_name: Release ${{ steps.version.outputs.name }}
138+
# if needed, you can set the release body here
139+
#body: "Release notes"
140+
draft: false
141+
prerelease: false
142+
143+
- name: download artifact
144+
uses: actions/download-artifact@v2
145+
with:
146+
name: "Linux-${{ steps.version.outputs.name }}"
147+
path: ./
148+
149+
- name: upload ubuntu release asset
150+
uses: actions/upload-release-asset@v1
151+
env:
152+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
153+
with:
154+
upload_url: ${{ steps.create_release.outputs.upload_url }}
155+
asset_path: "artifact.tar.gz"
156+
asset_name: "${{ env.PROJECT_NAME }}-Linux-${{ steps.version.outputs.name }}.tar.gz"
157+
asset_content_type: application/x-tar
158+
159+
- name: download artifact
160+
uses: actions/download-artifact@v2
161+
with:
162+
name: "Windows-${{ steps.version.outputs.name }}"
163+
path: ./
164+
165+
- name: upload windows release asset
166+
uses: actions/upload-release-asset@v1
167+
env:
168+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
169+
with:
170+
upload_url: ${{ steps.create_release.outputs.upload_url }}
171+
asset_path: "artifact.zip"
172+
asset_name: "${{ env.PROJECT_NAME }}-Windows-${{ steps.version.outputs.name }}.zip"
173+
asset_content_type: application/zip
174+
175+
- name: download artifact
176+
uses: actions/download-artifact@v2
177+
with:
178+
name: "macOS-${{ steps.version.outputs.name }}"
179+
path: ./
180+
181+
- name: upload macos release asset
182+
uses: actions/upload-release-asset@v1
183+
env:
184+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
185+
with:
186+
upload_url: ${{ steps.create_release.outputs.upload_url }}
187+
asset_path: "./artifact.tar.gz"
188+
asset_name: "${{ env.PROJECT_NAME }}-macOS-${{ steps.version.outputs.name }}.tar.gz"
189+
asset_content_type: application/x-tar

0 commit comments

Comments
 (0)