diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index c7270da..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,4 +0,0 @@ -# These are supported funding model platforms - -github: lefticus -patreon: lefticus diff --git a/.github/template/README.md b/.github/template/README.md deleted file mode 100644 index 989cade..0000000 --- a/.github/template/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# %%myproject%% - -[![ci](https://github.com/%%myorg%%/%%myproject%%/actions/workflows/ci.yml/badge.svg)](https://github.com/%%myorg%%/%%myproject%%/actions/workflows/ci.yml) -[![codecov](https://codecov.io/gh/%%myorg%%/%%myproject%%/branch/main/graph/badge.svg)](https://codecov.io/gh/%%myorg%%/%%myproject%%) -[![CodeQL](https://github.com/%%myorg%%/%%myproject%%/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/%%myorg%%/%%myproject%%/actions/workflows/codeql-analysis.yml) - -LGTM Has to be set up manually after template is created: - -[![Language grade: C++](https://img.shields.io/lgtm/grade/cpp/github/%%myorg%%/%%myproject%%)](https://lgtm.com/projects/g/%%myorg%%/%%myproject%%/context:cpp) - -## About %%myproject%% -%%description%% - - -## More Details - - * [Dependency Setup](README_dependencies.md) - * [Building Details](README_building.md) - * [Troubleshooting](README_troubleshooting.md) - * [Docker](README_docker.md) diff --git a/.github/template/removal-list b/.github/template/removal-list deleted file mode 100644 index 4f63e51..0000000 --- a/.github/template/removal-list +++ /dev/null @@ -1,2 +0,0 @@ -LICENSE -.github/FUNDING.yml \ No newline at end of file diff --git a/.github/template/template_name b/.github/template/template_name deleted file mode 100644 index d82c711..0000000 --- a/.github/template/template_name +++ /dev/null @@ -1 +0,0 @@ -ftxui_template diff --git a/.github/template/template_repository b/.github/template/template_repository deleted file mode 100644 index 310718d..0000000 --- a/.github/template/template_repository +++ /dev/null @@ -1 +0,0 @@ -cpp-best-practices/ftxui_template diff --git a/.github/workflows/template-janitor.yml b/.github/workflows/template-janitor.yml deleted file mode 100644 index 3efe5ce..0000000 --- a/.github/workflows/template-janitor.yml +++ /dev/null @@ -1,233 +0,0 @@ -# This workflow should cleanup everything unneeded from the template project - -name: Template Janitor - -on: - pull_request: - release: - types: [published] - push: - tags: - branches: - - main - - develop - -env: - TEMPLATES_PATH: ".github/template" - CONAN_SYSREQUIRES_MODE: enabled - CONAN_USER_HOME: "${{ github.workspace }}/conan-cache" - CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short" - - -jobs: - - template-cleanup: - name: Cleanup after create - runs-on: ubuntu-latest - strategy: - matrix: - compiler: - - gcc-11 - generator: - - "Unix Makefiles" - build_type: - - Debug - developer_mode: - - OFF - - steps: - - uses: actions/checkout@v2 - - - name: Setup Cache - uses: ./.github/actions/setup_cache - with: - compiler: ${{ matrix.compiler }} - build_type: ${{ matrix.build_type }} - developer_mode: ${{ matrix.developer_mode }} - generator: ${{ matrix.generator }} - - - name: Get organization and project name - run: | - echo "NEW_ORG=${{ github.repository_owner }}" >> $GITHUB_ENV - echo "NEW_PROJECT=${{ github.event.repository.name }}" >> $GITHUB_ENV - echo "NEW_URL=${{ github.repositoryUrl }}" >> $GITHUB_ENV - - - uses: octokit/request-action@v2.x - id: get_repo_meta - with: - route: GET /repos/{owner}/{repo} - owner: ${{ env.NEW_ORG }} - repo: ${{ env.NEW_PROJECT }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # Rename all cpp_starter_project occurences to current repository and remove this workflow - - name: Insert new org and project - run: | - # rename the CMake project to match the github project - sed -i "s/myproject/${{ github.event.repository.name }}/gi" CMakeLists.txt configured_files/config.hpp.in src/main.cpp - - # Update URL placeholders for project - sed -i "s|%%myurl%%|${{ fromJson(steps.get_repo_meta.outputs.data).html_url }}|gi" CMakeLists.txt - - # fill in placeholders of readme and move it into place - sed -i "s/%%myorg%%/${{ env.NEW_ORG }}/g" ${{ env.TEMPLATES_PATH }}/README.md - sed -i "s/%%myproject%%/${{ env.NEW_PROJECT }}/g" ${{ env.TEMPLATES_PATH }}/README.md - sed -i "s|%%description%%|${{ fromJson(steps.get_repo_meta.outputs.data).description }}|g" ${{ env.TEMPLATES_PATH }}/README.md - cp ${{ env.TEMPLATES_PATH }}/README.md README.md - - - name: Print diff after replacement - run: | - # Exclude the README as that is checked separately! - git diff ':!README.md' - # following should not have any diffs - diff ${{ env.TEMPLATES_PATH }}/README.md README.md - - - name: Remove unwanted files - run: | - # No tests needed as this will fail if any file from the list is missing/misspelled - xargs rm -r < ${{ env.TEMPLATES_PATH }}/removal-list - - - name: Clean up before commit and push - run: | - rm -r ${{ env.TEMPLATES_PATH }} - - # Can we get that from a variable? - # Remove this workflow as it has fulfilled its purpose - rm .github/workflows/template-janitor.yml - - - name: Setup Cpp - uses: aminya/setup-cpp@v1 - with: - compiler: ${{ matrix.compiler }} - - cmake: true - ninja: false - conan: true - vcpkg: false - ccache: false - clangtidy: false - - cppcheck: false - - gcovr: false - opencppcoverage: false - - - name: Cleanup Conan system packages (they are not properly cached) - run: | - conan remove -f '*/system' - - - name: Test simple configuration to make sure nothing broke - run: | - cmake -S . -B ./build -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE:STRING=${{ matrix.build_type }} -DENABLE_DEVELOPER_MODE:BOOL=${{ matrix.developer_mode }} -DOPT_ENABLE_COVERAGE:BOOL=OFF - - - - uses: EndBug/add-and-commit@v4 - # only commit and push if we are not a template project anymore! - if: fromJson(steps.get_repo_meta.outputs.data).is_template != true - with: - author_name: Template Janitor - author_email: template.janitor@example.com - message: 'Cleanup template and initialize repository' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - - template-rename: - name: Renames template when a new name is detected - runs-on: ubuntu-latest - strategy: - matrix: - compiler: - - gcc-11 - generator: - - "Unix Makefiles" - build_type: - - Debug - developer_mode: - - OFF - - steps: - - uses: actions/checkout@v2 - - - name: Setup Cache - uses: ./.github/actions/setup_cache - with: - compiler: ${{ matrix.compiler }} - build_type: ${{ matrix.build_type }} - developer_mode: ${{ matrix.developer_mode }} - generator: ${{ matrix.generator }} - - - name: Get organization and project name - run: | - echo "TEST_RUN=false" >> $GITHUB_ENV - echo "NEW_ORG=${{ github.repository_owner }}" >> $GITHUB_ENV - echo "NEW_PROJECT=${{ github.event.repository.name }}" >> $GITHUB_ENV - echo "NEW_REPOSITORY=${{ github.repository }}" >> $GITHUB_ENV - echo "TEMPLATE_NAME=`cat ${{ env.TEMPLATES_PATH }}/template_name`" >> $GITHUB_ENV - echo "TEMPLATE_REPOSITORY=`cat ${{ env.TEMPLATES_PATH }}/template_repository`" >> $GITHUB_ENV - - - uses: octokit/request-action@v2.x - id: get_repo_meta - with: - route: GET /repos/{owner}/{repo} - owner: ${{ env.NEW_ORG }} - repo: ${{ env.NEW_PROJECT }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Setup fake test org/project names if project didn't change - if: env.TEMPLATE_NAME == env.NEW_PROJECT - run: | - echo "TEST_RUN=true" >> $GITHUB_ENV - echo "NEW_ORG=${{ github.repository_owner }}" >> $GITHUB_ENV - echo "NEW_PROJECT=TEST_PROJECT" >> $GITHUB_ENV - echo "NEW_REPOSITORY=TEST_REPOSITORY" >> $GITHUB_ENV - - - # Rename all cpp_starter_project occurrences to current repository and remove this workflow - - name: Update repository to match new template information - run: | - # Update the README and template files to match the new org / repository names - sed -i "s|${{ env.TEMPLATE_REPOSITORY }}|${{ env.NEW_REPOSITORY }}|g" README.md ${{ env.TEMPLATES_PATH }}/template_repository - sed -i "s|${{ env.TEMPLATE_NAME }}|${{ env.NEW_PROJECT }}|g" README.md ${{ env.TEMPLATES_PATH }}/template_name - - - name: Print diff after template name replacement - run: | - git diff - - - name: Setup Cpp - uses: aminya/setup-cpp@v1 - with: - compiler: gcc - - cmake: true - ninja: false - conan: true - vcpkg: false - ccache: false - clangtidy: false - - cppcheck: false - - gcovr: false - opencppcoverage: false - - - name: Cleanup Conan system packages (they are not properly cached) - run: | - conan remove -f '*/system' - - - name: Test simple configuration to make sure nothing broke (default compiler,cmake,developer_mode OFF) - run: | - cmake -S . -B ./build -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE:STRING=${{ matrix.build_type }} -DENABLE_DEVELOPER_MODE:BOOL=${{ matrix.developer_mode }} -DOPT_ENABLE_COVERAGE:BOOL=OFF - - - uses: EndBug/add-and-commit@v4 - # only commit and push if we are a template and project name has changed - if: fromJson(steps.get_repo_meta.outputs.data).is_template == true && env.TEST_RUN == 'false' - with: - author_name: Template Janitor - author_email: template.janitor@example.com - message: 'Change Template Name' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 84ee0ec..3daebab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,10 +49,10 @@ include(${_project_options_SOURCE_DIR}/Index.cmake) # Set the project name and language project( - myproject + my_awesome_game VERSION 0.0.1 DESCRIPTION "" - HOMEPAGE_URL "%%myurl%%" + HOMEPAGE_URL "https://github.com/lefticus/my_awesome_game" LANGUAGES CXX C) set(GIT_SHA diff --git a/LICENSE b/LICENSE deleted file mode 100644 index fdddb29..0000000 --- a/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -This is free and unencumbered software released into the public domain. - -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. - -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -For more information, please refer to diff --git a/README.md b/README.md index 906afc3..1d8b80a 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,16 @@ -# ftxui_template +# my_awesome_game -[![ci](https://github.com/cpp-best-practices/ftxui_template/actions/workflows/ci.yml/badge.svg)](https://github.com/cpp-best-practices/ftxui_template/actions/workflows/ci.yml) -[![codecov](https://codecov.io/gh/cpp-best-practices/ftxui_template/branch/main/graph/badge.svg)](https://codecov.io/gh/cpp-best-practices/ftxui_template) -[![Language grade: C++](https://img.shields.io/lgtm/grade/cpp/github/cpp-best-practices/ftxui_template)](https://lgtm.com/projects/g/cpp-best-practices/ftxui_template/context:cpp) -[![CodeQL](https://github.com/cpp-best-practices/ftxui_template/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/cpp-best-practices/ftxui_template/actions/workflows/codeql-analysis.yml) +[![ci](https://github.com/lefticus/my_awesome_game/actions/workflows/ci.yml/badge.svg)](https://github.com/lefticus/my_awesome_game/actions/workflows/ci.yml) +[![codecov](https://codecov.io/gh/lefticus/my_awesome_game/branch/main/graph/badge.svg)](https://codecov.io/gh/lefticus/my_awesome_game) +[![CodeQL](https://github.com/lefticus/my_awesome_game/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/lefticus/my_awesome_game/actions/workflows/codeql-analysis.yml) -## About ftxui_template +LGTM Has to be set up manually after template is created: -This is a C++ Best Practices GitHub template for getting up and running with C++ quickly. +[![Language grade: C++](https://img.shields.io/lgtm/grade/cpp/github/lefticus/my_awesome_game)](https://lgtm.com/projects/g/lefticus/my_awesome_game/context:cpp) -By default (collectively known as `ENABLE_DEVELOPER_MODE`) +## About my_awesome_game +This is an awesome submission to the C++ Best Practices Game Jam - * Address Sanitizer and Undefined Behavior Sanitizer enabled where possible - * Warnings as errors - * clang-tidy and cppcheck static analysis - * conan for dependencies - -It includes - - * a basic CLI example - * examples for fuzz, unit, and constexpr testing - * large github action testing matrix - -It requires - - * cmake - * conan - * a compiler - - -This project gets you started with a simple example of using FTXUI, which happens to also be a game. - - -## Getting Started - -### Use the Github template -First, click the green `Use this template` button near the top of this page. -This will take you to Github's ['Generate Repository'](https://github.com/cpp-best-practices/ftxui_template/generate) page. -Fill in a repository name and short description, and click 'Create repository from template'. -This will allow you to create a new repository in your Github account, -prepopulated with the contents of this project. - -After creating the project please wait until the cleanup workflow has finished -setting up your project and commited the changes. - -Now you can clone the project locally and get to work! - - git clone https://github.com//.git ## More Details @@ -54,13 +18,3 @@ Now you can clone the project locally and get to work! * [Building Details](README_building.md) * [Troubleshooting](README_troubleshooting.md) * [Docker](README_docker.md) - -## Testing - -See [Catch2 tutorial](https://github.com/catchorg/Catch2/blob/master/docs/tutorial.md) - -## Fuzz testing - -See [libFuzzer Tutorial](https://github.com/google/fuzzing/blob/master/tutorial/libFuzzerTutorial.md) - - diff --git a/configured_files/config.hpp.in b/configured_files/config.hpp.in index 4e18806..ee7dc32 100644 --- a/configured_files/config.hpp.in +++ b/configured_files/config.hpp.in @@ -1,9 +1,9 @@ -#ifndef MYPROJECT_CONFIG_HPP -#define MYPROJECT_CONFIG_HPP +#ifndef my_awesome_game_CONFIG_HPP +#define my_awesome_game_CONFIG_HPP // this is a basic example of how a CMake configured file might look // in this particular case, we are using it to set the version number of our executable -namespace myproject::cmake { +namespace my_awesome_game::cmake { static constexpr std::string_view project_name = "@PROJECT_NAME@"; static constexpr std::string_view project_version = "@PROJECT_VERSION@"; static constexpr int project_version_major { @PROJECT_VERSION_MAJOR@ }; @@ -11,6 +11,6 @@ static constexpr int project_version_minor { @PROJECT_VERSION_MINOR@ }; static constexpr int project_version_patch { @PROJECT_VERSION_PATCH@ }; static constexpr int project_version_tweak { @PROJECT_VERSION_TWEAK@ }; static constexpr std::string_view git_sha = "@GIT_SHA@"; -}// namespace myproject::cmake +}// namespace my_awesome_game::cmake #endif diff --git a/src/main.cpp b/src/main.cpp index 2377736..5826175 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,7 +10,7 @@ #include // This file will be generated automatically when you run the CMake -// configuration step. It creates a namespace called `myproject`. You can modify +// configuration step. It creates a namespace called `my_awesome_game`. You can modify // the source template at `configured_files/config.hpp.in`. #include @@ -325,8 +325,8 @@ int main(int argc, const char **argv) { std::next(argv), std::next(argv, argc) }, true,// show help if requested fmt::format("{} {}", - myproject::cmake::project_name, - myproject::cmake::project_version));// version string, acquired + my_awesome_game::cmake::project_name, + my_awesome_game::cmake::project_version));// version string, acquired // from config.hpp via CMake if (args["turn_based"].asBool()) {