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

Dev #1

Merged
merged 9 commits into from
Jun 19, 2024
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
24 changes: 24 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
BasedOnStyle: Google
AlignAfterOpenBracket: 'AlwaysBreak'
AllowAllConstructorInitializersOnNextLine: 'false'
AllowAllParametersOfDeclarationOnNextLine: 'false'
AlignConsecutiveMacros: 'true'
AllowShortCaseLabelsOnASingleLine: 'true'
AllowShortFunctionsOnASingleLine: 'None'
AllowShortIfStatementsOnASingleLine: 'Never'
AllowShortLoopsOnASingleLine: 'false'
BreakBeforeBraces: Allman
BinPackArguments: 'false'
BinPackParameters: 'false'
Cpp11BracedListStyle: 'false'
ColumnLimit: 125
NamespaceIndentation: All
SpaceAfterTemplateKeyword: 'false'
SpaceBeforeCtorInitializerColon: 'true'
SpaceBeforeInheritanceColon: 'true'
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: 'true'
SpaceInEmptyBlock: true
Standard: 'Latest'
...
6 changes: 6 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
Checks: '*,-fuchsia-*,-google-*,-zircon-*,-abseil-*,-modernize-use-trailing-return-type,-llvm-*,-llvmlibc-*'
CheckOptions: [{ key: misc-non-private-member-variables-in-classes, value: IgnoreClassesWithAllMemberVariablesBeingPublic }]
WarningsAsErrors: '*'
HeaderFilterRegex: ''
FormatStyle: none
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug report
about: Create a report to help me improve
title: "[BUG]"
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**

* OS: [e.g. Windows]
* Version [e.g. 10]

**Additional context**
Add any other context about the problem here.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/custom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Custom issue template
about: Describe this issue template's purpose here.
title: ''
labels: ''
assignees: ''

---


25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[FEATURE]"
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated
when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Provide usage examples**
A few examples of how the feature should be used. Please make sure they are clear
and concise.

**Additional context**
Add any other context or screenshots about the feature request here.
53 changes: 53 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: MacOS

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

env:
BUILD_TYPE: Release
INSTALL_LOCATION: .local

jobs:
build:

runs-on: macos-latest
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"

steps:
- uses: actions/checkout@v2

- name: cache dependencies
uses: actions/cache@v2
id: cache
with:
path: ${{ github.workspace }}/${{ env.INSTALL_LOCATION }}
key: ${{ runner.os }}-dependencies

- name: install GoogleTest
if: ${{ steps.cache.output.cache-hit != 'true' }}
run: |
cd ..
git clone https://github.com/google/googletest.git --branch release-1.10.0
cd googletest
cmake -Bbuild -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/$INSTALL_LOCATION
cmake --build build --config Release
cmake --build build --target install --config Release
cd ../modern-cpp-template

- name: configure
run: cmake -Bbuild -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/$INSTALL_LOCATION

- name: build
run: cmake --build build --config $BUILD_TYPE -j4

- name: run tests
run: |
cd build
ctest -C $BUILD_TYPE -VV

- name: install project
run: cmake --build build --target install --config Release

189 changes: 189 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
name: Release

on:
push:
tags:
- 'v*'

env:
PROJECT_NAME: "modern-cpp-template"
BUILD_TYPE: Release

jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows Latest MSVC",
artifact_ext: '.zip',
os: windows-latest,
cc: "cl",
cxx: "cl",
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
}
- {
name: "Ubuntu Latest GCC",
artifact_ext: '.tar.gz',
os: ubuntu-latest,
cc: "gcc",
cxx: "g++",
}
- {
name: "macOS Latest Clang",
artifact_ext: '.tar.gz',
os: macos-latest,
cc: "clang",
cxx: "clang++",
}

steps:
- name: set version name (Windows)
id: version_win
if: ${{ runner.os == 'Windows' }}
run: |
$TAG = (${env:GITHUB_REF} -replace 'refs/tags/', '')
echo "::set-output name=name::$TAG"

- name: set version name
id: version
if: ${{ runner.os != 'Windows' }}
run: echo ::set-output name=name::${GITHUB_REF#refs/tags/}

- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive

- name: cache dependencies
uses: actions/cache@v2
id: cache
with:
path: ${{ github.HOME }}/.local
key: ${{ runner.os }}-dependencies

- name: install GoogleTest
if: ${{ steps.cache.output.cache-hit != 'true' }}
run: |
cd ..
git clone https://github.com/google/googletest.git --branch release-1.10.0
cd googletest
cmake -Bbuild -DCMAKE_INSTALL_PREFIX="$HOME/.local" -Dgtest_force_shared_crt=1
cmake --build build --config Release
cmake --build build --target install --config Release
cd ../modern-cpp-template

- name: configure
run: cmake -Bbuild -DCMAKE_INSTALL_PREFIX="$HOME/.local"

- name: build
run: cmake --build build --config "$env:BUILD_TYPE" -j4

- name: run tests
run: |
cd build
ctest -C "$env:BUILD_TYPE" -VV

# for a release not containing directly the source code, replace the files archived
# with the actual files needed (i.e. *.lib/*.a and *.h(pp))

- name: generate archive (Windows)
if: ${{ runner.os == 'Windows' }}
run: |
rmdir -r -fo build
7z a -tzip $HOME/artifact.zip *


- name: generate archive
if: ${{ runner.os != 'Windows' }}
run: |
rm -rf build
tar -cvzf $HOME/artifact.tar.gz .

- name: upload artifacts
uses: actions/upload-artifact@v2
if: ${{ runner.os == 'Windows' }}
with:
name: ${{ runner.os }}-${{ steps.version_win.outputs.name }}
path: '~/artifact.*'

- name: upload artifacts
uses: actions/upload-artifact@v2
if: ${{ runner.os != 'Windows' }}
with:
name: ${{ runner.os }}-${{ steps.version.outputs.name }}
path: '~/artifact.*'

release:
if: contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
needs: build

steps:
- name: set version name
id: version
run: echo ::set-output name=name::${GITHUB_REF#refs/tags/}

- name: create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ steps.version.outputs.name }}
# if needed, you can set the release body here
#body: "Release notes"
draft: false
prerelease: false

- name: download artifact
uses: actions/download-artifact@v2
with:
name: "Linux-${{ steps.version.outputs.name }}"
path: ./

- name: upload ubuntu release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifact.tar.gz"
asset_name: "${{ env.PROJECT_NAME }}-Linux-${{ steps.version.outputs.name }}.tar.gz"
asset_content_type: application/x-tar

- name: download artifact
uses: actions/download-artifact@v2
with:
name: "Windows-${{ steps.version.outputs.name }}"
path: ./

- name: upload windows release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifact.zip"
asset_name: "${{ env.PROJECT_NAME }}-Windows-${{ steps.version.outputs.name }}.zip"
asset_content_type: application/zip

- name: download artifact
uses: actions/download-artifact@v2
with:
name: "macOS-${{ steps.version.outputs.name }}"
path: ./

- name: upload macos release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "./artifact.tar.gz"
asset_name: "${{ env.PROJECT_NAME }}-macOS-${{ steps.version.outputs.name }}.tar.gz"
asset_content_type: application/x-tar
Loading
Loading