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

Improve code quality #35

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
16d294e
Modernize Dockerfile using HEREDOCS syntax
fruzitent Apr 24, 2023
927a941
Move default settings into customizations category
fruzitent Apr 24, 2023
33c8ec4
Don't auto-install extensions, so container can be started offline
fruzitent Apr 24, 2023
757e023
Use named volume for increased performance
fruzitent Apr 24, 2023
1a2872e
Use WSLg to forward X-Server
fruzitent Apr 24, 2023
5a54cca
Update recommended defaults
fruzitent Apr 24, 2023
1243648
Use .json as .yml requires additional dependencies
fruzitent Apr 24, 2023
f35188a
Rename LICENSE to LICENSE.md
fruzitent Apr 24, 2023
430583f
Update .gitignore
fruzitent Apr 24, 2023
b47738a
LGTM is deprecated as of August 2022
fruzitent Apr 24, 2023
7c9e063
Remove inline HTML from .md
fruzitent Apr 24, 2023
7e59444
Update Dockerfile
fruzitent Apr 25, 2023
0c802b7
Fix header resolution for clangd
fruzitent Apr 25, 2023
1a4017c
Update README.md
fruzitent Apr 25, 2023
c899b39
Compatibility fix for codespaces
fruzitent Apr 26, 2023
0e4114a
apply formatting, may need some additional changes
fruzitent Apr 26, 2023
672392b
Update configuration files
fruzitent Apr 26, 2023
8544cfa
fix "expected expression" compilation error
fruzitent Apr 26, 2023
31432b1
Pre-Build Dev Container
fruzitent Apr 26, 2023
a724803
Update Dockerfile
fruzitent Apr 28, 2023
49d5bbc
Merge branch 'cpp-best-practices:main' into main
fruzitent Apr 29, 2023
5416094
NOLINT only specific checks
fruzitent Apr 29, 2023
38960d4
Simplify clang-format
fruzitent Apr 29, 2023
20588ec
Update clang-format
fruzitent Apr 29, 2023
c2ca43b
Merge remote-tracking branch 'upstream/main'
fruzitent Apr 29, 2023
33d2b90
Update workflows
fruzitent Apr 30, 2023
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
Prev Previous commit
Update workflows
  • Loading branch information
fruzitent committed Apr 30, 2023
commit 33d2b90574db9b60026028698ffdcfe63a08bf69
41 changes: 25 additions & 16 deletions .github/workflows/auto-clang-format.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
name: auto-clang-format
on: [pull_request]

on:
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: DoozyX/clang-format-lint-action@v0.13
with:
source: '.'
exclude: './third_party ./external'
extensions: 'h,cpp,hpp'
clangFormatVersion: 12
inplace: True
- uses: EndBug/add-and-commit@v4
with:
author_name: Clang Robot
author_email: robot@example.com
message: ':art: Committing clang-format changes'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@master
with:
fetch-depth: 1

- name: Run clang-format
uses: DoozyX/clang-format-lint-action@v0.13
with:
clangFormatVersion: 12
exclude: "./third_party ./external"
extensions: "h,cpp,hpp"
inplace: True
source: "."

- name: Commit changes
uses: EndBug/add-and-commit@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
author_email: robot@example.com
author_name: Clang Robot
message: ":art: Committing clang-format changes"
132 changes: 68 additions & 64 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
name: ci

on:
pull_request:
release:
types: [published]

push:
branches:
- main
- develop
- main

release:
types:
- published

env:
CLANG_TIDY_VERSION: "15.0.2"
VERBOSE: 1

jobs:
Test:
test:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false

Expand All @@ -26,93 +31,93 @@ jobs:
# Disable/enable builds in this list to meet the above recommendations
# and your own projects needs
matrix:
os:
- ubuntu-20.04
- macos-10.15
- windows-2019
build_shared:
- OFF
build_type:
- Debug
- Release
compiler:
# you can specify the version after `-` like "llvm-15.0.2".
- llvm-15.0.2
- gcc-11
- llvm-15.0.2
generator:
- "Ninja Multi-Config"
build_type:
- Release
- Debug
os:
- macos-10.15
- ubuntu-20.04
- windows-2019
packaging_maintainer_mode:
- ON
- OFF
build_shared:
- OFF
- ON

exclude:
# mingw is determined by this author to be too buggy to support
- os: windows-2019
compiler: gcc-11
- compiler: gcc-11
os: windows-2019

include:
# Add appropriate variables for gcov version required. This will intentionally break
# if you try to use a compiler that does not have gcov set
- compiler: gcc-11
gcov_executable: gcov
enable_ipo: On
gcov_executable: gcov

- compiler: llvm-15.0.2
enable_ipo: Off
gcov_executable: "llvm-cov gcov"

- os: macos-10.15
enable_ipo: Off
- enable_ipo: Off
os: macos-10.15

# Set up preferred package generators, for given build configurations
- build_type: Release
packaging_maintainer_mode: OFF
package_generator: TBZ2
packaging_maintainer_mode: OFF

# This exists solely to make sure a non-multiconfig build works
- os: ubuntu-20.04
- build_type: Debug
compiler: gcc-11
generator: "Unix Makefiles"
build_type: Debug
enable_ipo: Off
gcov_executable: gcov
generator: "Unix Makefiles"
os: ubuntu-20.04
packaging_maintainer_mode: On
enable_ipo: Off

# Windows msvc builds
- os: windows-2022
- build_type: Debug
compiler: msvc
enable_ipo: On
generator: "Visual Studio 17 2022"
build_type: Debug
os: windows-2022
packaging_maintainer_mode: On
enable_ipo: On

- os: windows-2022
- build_type: Release
compiler: msvc
enable_ipo: On
generator: "Visual Studio 17 2022"
build_type: Release
os: windows-2022
packaging_maintainer_mode: On
enable_ipo: On

- os: windows-2022
- build_type: Debug
compiler: msvc
generator: "Visual Studio 17 2022"
build_type: Debug
os: windows-2022
packaging_maintainer_mode: Off

- os: windows-2022
- build_type: Release
compiler: msvc
generator: "Visual Studio 17 2022"
build_type: Release
packaging_maintainer_mode: Off
os: windows-2022
package_generator: ZIP
packaging_maintainer_mode: Off

- os: windows-2022
- build_shared: On
build_type: Release
compiler: msvc
enable_ipo: On
generator: "Visual Studio 17 2022"
build_type: Release
os: windows-2022
packaging_maintainer_mode: On
enable_ipo: On
build_shared: On

steps:
- name: Check for llvm version mismatches
Expand All @@ -122,79 +127,78 @@ jobs:
script: |
core.setFailed('There is a mismatch between configured llvm compiler and clang-tidy version chosen')

- uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@master
with:
fetch-depth: 1

- name: Setup Cache
uses: ./.github/actions/setup_cache
with:
compiler: ${{ matrix.compiler }}
build_type: ${{ matrix.build_type }}
packaging_maintainer_mode: ${{ matrix.packaging_maintainer_mode }}
compiler: ${{ matrix.compiler }}
generator: ${{ matrix.generator }}
packaging_maintainer_mode: ${{ matrix.packaging_maintainer_mode }}

- name: Project Name
uses: cardinalby/export-env-action@v2
with:
envFile: '.github/constants.env'

envFile: ".github/constants.env"

- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.compiler }}
vcvarsall: ${{ contains(matrix.os, 'windows' )}}

cmake: true
ninja: true
vcpkg: false
ccache: true
clangtidy: ${{ env.CLANG_TIDY_VERSION }}

cmake: true
compiler: ${{ matrix.compiler }}
cppcheck: true

gcovr: true
ninja: true
opencppcoverage: true
vcpkg: false
vcvarsall: ${{ contains(matrix.os, 'windows' )}}

- name: Configure CMake
run: |
cmake -S . -B ./build -G "${{matrix.generator}}" -D${{ env.PROJECT_NAME }}_ENABLE_IPO=${{matrix.enable_ipo }} -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -D${{ env.PROJECT_NAME }}_PACKAGING_MAINTAINER_MODE:BOOL=${{matrix.packaging_maintainer_mode}} -D${{ env.PROJECT_NAME }}_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} -DGIT_SHA:STRING=${{ github.sha }}
cmake -B ./build -S . -D${{ env.PROJECT_NAME }}_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} -D${{ env.PROJECT_NAME }}_ENABLE_IPO=${{ matrix.enable_ipo }} -D${{ env.PROJECT_NAME }}_PACKAGING_MAINTAINER_MODE:BOOL=${{ matrix.packaging_maintainer_mode }} -DCMAKE_BUILD_TYPE:STRING=${{ matrix.build_type }} -DGIT_SHA:STRING=${{ github.sha }} -G "${{ matrix.generator }}"

- name: Build
# Execute the build. You can specify a specific target with "--target <NAME>"
run: |
cmake --build ./build --config ${{matrix.build_type}}
cmake --build ./build --config ${{ matrix.build_type }}

- name: Unix - Test and coverage
if: runner.os != 'Windows'
working-directory: ./build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
ctest -C ${{matrix.build_type}}
gcovr -j ${{env.nproc}} --delete --root ../ --print-summary --xml-pretty --xml coverage.xml . --gcov-executable '${{ matrix.gcov_executable }}'
ctest -C ${{ matrix.build_type }}
gcovr -j ${{ env.nproc }} --delete --root ../ --print-summary --xml-pretty --xml coverage.xml . --gcov-executable '${{ matrix.gcov_executable }}'
working-directory: ./build

- name: Windows - Test and coverage
if: runner.os == 'Windows'
working-directory: ./build
run: |
OpenCppCoverage.exe --export_type cobertura:coverage.xml --cover_children -- ctest -C ${{matrix.build_type}}
OpenCppCoverage.exe --export_type cobertura:coverage.xml --cover_children -- ctest -C ${{ matrix.build_type }}
working-directory: ./build

- name: CPack
if: matrix.package_generator != ''
working-directory: ./build
run: |
cpack -C ${{matrix.build_type}} -G ${{matrix.package_generator}}
cpack -C ${{ matrix.build_type }} -G ${{ matrix.package_generator }}
working-directory: ./build

- name: Publish Tagged Release
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.package_generator != '' }}
uses: softprops/action-gh-release@v1
with:
files: |
build/*-*${{ matrix.build_type }}*-*.*

- name: Publish to codecov
uses: codecov/codecov-action@v2
with:
files: ./build/coverage.xml
flags: ${{ runner.os }}
name: ${{ runner.os }}-coverage
files: ./build/coverage.xml
Loading