- 
                Notifications
    You must be signed in to change notification settings 
- Fork 0
Add clang-format, clang-tidy, and compiler CI matrix #42
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
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            69 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      3bbc47a
              
                Add clang-format, clang-tidy, and compiler CI matrix
              
              
                flyingrobots d917182
              
                docs: rename 'mg-ledger' to 'git-ledger'
              
              
                flyingrobots 29a758e
              
                docs: formatting in a few documents
              
              
                flyingrobots 68295c0
              
                Add ACTIVITY.log.jsonl
              
              
                flyingrobots ad41407
              
                Logged the orientation leg of the journey
              
              
                flyingrobots d310fa2
              
                Taught the version printer to speak without snprintf
              
              
                flyingrobots 997a27c
              
                Let the workflow toggle run_tidy without lying
              
              
                flyingrobots 0e776d7
              
                Recorded the lint fix trail in the ledger
              
              
                flyingrobots da7b763
              
                Stopped apt from chasing a mythical clang++
              
              
                flyingrobots 14ac526
              
                Logged the package fix for the clang lane
              
              
                flyingrobots b6293a0
              
                Let clang-format tidy the hand-rolled formatter
              
              
                flyingrobots bd3ce16
              
                Renamed the METAGRAPH prefix to GITLEDGER where it matters
              
              
                flyingrobots e41172f
              
                Logged the METAGRAPH to GITLEDGER rename prep
              
              
                flyingrobots d6e3223
              
                Built a docker harness so local builds mirror CI
              
              
                flyingrobots e4b1c06
              
                Told the docs to trust the docker harness, not your host
              
              
                flyingrobots 23dd8b5
              
                Refused host targets unless you shout the magic words
              
              
                flyingrobots be9a904
              
                Told git inside the container that our sandbox is safe
              
              
                flyingrobots d11e379
              
                Untangled PROJECT-PLAN headings for the lint police
              
              
                flyingrobots 4d5e392
              
                Let clang-format sort includes again
              
              
                flyingrobots 11416bd
              
                Killed the stray modernize knobs in clang-tidy
              
              
                flyingrobots af9e5bf
              
                Taught editorconfig about our shell and build scripts
              
              
                flyingrobots 043cfee
              
                Tightened workflow branch lists to pass lint
              
              
                flyingrobots 908ab94
              
                Taught clang-tidy to ignore test translation units
              
              
                flyingrobots cad732d
              
                Aligned CI labels with real GCC/Clang versions
              
              
                flyingrobots ea143da
              
                Taught CI to check Docker before invoking containerised builds
              
              
                flyingrobots 3abc1c2
              
                Settled on C17 and applied warnings per target
              
              
                flyingrobots d5b748a
              
                Made semantic version components unsigned
              
              
                flyingrobots c4e498d
              
                Hard-pinned C17 in every cmake invocation
              
              
                flyingrobots 65f10c3
              
                Gave the Makefile conventional all/test targets
              
              
                flyingrobots 6047c41
              
                Defaulted lint/format to host targets with container aliases
              
              
                flyingrobots a1884a1
              
                Meson: lowercase tests target and stick with C17
              
              
                flyingrobots 48b1641
              
                Added gitledger_semantic_version_snprintf and a safer static wrapper
              
              
                flyingrobots adbc498
              
                Pinned dev container packages to Ubuntu 24.04 versions
              
              
                flyingrobots eb1604c
              
                Kept version test checking snprintf result under NDEBUG
              
              
                flyingrobots 48089be
              
                Let clang-tidy breathe without rebuilding the world
              
              
                flyingrobots 5d0db6b
              
                Defused the fixture script's rm -rf tripwire
              
              
                flyingrobots f84af2b
              
                Merge branch 'origin/main' into feat/coding-standards
              
              
                flyingrobots aca80f8
              
                Recorded merge activity entry
              
              
                flyingrobots 8e2ce60
              
                Anchored clang-tidy filters and documented cert exceptions
              
              
                flyingrobots 2a5f092
              
                Made clang-tidy roots configurable
              
              
                flyingrobots 5daf608
              
                Trimmed editorconfig to meaningful overrides
              
              
                flyingrobots 13729dc
              
                Brought PROJECT-PLAN.md back into markdownlint compliance
              
              
                flyingrobots 844dbb5
              
                Hardened fixture path resolution ladder
              
              
                flyingrobots 4b626fc
              
                Routed format-check through containers and added markdownlint target
              
              
                flyingrobots 133486f
              
                Handled printf results in CLI smoke binaries
              
              
                flyingrobots 57888e5
              
                Logged push after review fixes
              
              
                flyingrobots f263ef9
              
                Let clang-format unify the ledger’s style again
              
              
                flyingrobots 8bc83ac
              
                Taught the lint harness to police itself
              
              
                flyingrobots 1c0ee82
              
                Defused the non-breaking hyphen minefield
              
              
                flyingrobots c1182c7
              
                Gave the ledger a make log confession booth
              
              
                flyingrobots 12b8eec
              
                Taught the activity schema to reject bogus PR links
              
              
                flyingrobots 34a7516
              
                Journaled the schema tightening in the activity log
              
              
                flyingrobots 53c4aa9
              
                CI now dry-runs the containerized make targets
              
              
                flyingrobots 70ee8e9
              
                Let the fixture helper breathe under /tmp
              
              
                flyingrobots 04269d9
              
                Annotated the Makefile's host guard escape hatch
              
              
                flyingrobots ca66f04
              
                Deleted the pointless container aliases
              
              
                flyingrobots 5520b1f
              
                Explained how to flip RUN_TIDY when clang-tidy drags
              
              
                flyingrobots 7853827
              
                Moved activity logging plumbing into a script
              
              
                flyingrobots dd60300
              
                Tightened the PR URL regex without ajv formats
              
              
                flyingrobots b4ccea2
              
                Logged the container matrix shakedown
              
              
                flyingrobots 76d3052
              
                Gave the log dispatcher real WHERE handling
              
              
                flyingrobots b6ad85c
              
                Let markdownlint fix the autogenerated drafts
              
              
                flyingrobots b3936c8
              
                ShellCheck won't roast our fixture guard anymore
              
              
                flyingrobots 99c437b
              
                Schema knows URIs and CI reads the matrix
              
              
                flyingrobots 94c55a3
              
                Teach the log dispatcher to respect spaces
              
              
                flyingrobots 1f7fac8
              
                Release builds now export compile_commands too
              
              
                flyingrobots ec85096
              
                Ajv now tolerates schema format hints
              
              
                flyingrobots d1b59c9
              
                Use ajv's plural unknown-formats flag
              
              
                flyingrobots 8ebbe47
              
                Ajv strict mode off for schema validation
              
              
                flyingrobots File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
          Some comments aren't visible on the classic Files Changed page.
        
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| BasedOnStyle: LLVM | ||
| IndentWidth: 4 | ||
| ColumnLimit: 100 | ||
| UseTab: Never | ||
| BreakBeforeBraces: GNU | ||
| AllowShortIfStatementsOnASingleLine: false | ||
| AllowShortFunctionsOnASingleLine: Empty | ||
| AllowShortBlocksOnASingleLine: Empty | ||
| PointerAlignment: Left | ||
| DerivePointerAlignment: false | ||
| SpaceBeforeCpp11BracedList: true | ||
| AlignConsecutiveAssignments: Consecutive | ||
| AlignConsecutiveDeclarations: Consecutive | ||
| AlignTrailingComments: true | ||
| SpaceAfterCStyleCast: true | ||
| SpaceBeforeParens: ControlStatements | ||
| IncludeBlocks: Preserve | ||
| # Keep include sorting enabled to ensure consistent formatter output across tooling. | ||
| SortIncludes: true | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| Checks: > | ||
| -*, | ||
| bugprone-*, | ||
| cert-*, | ||
| clang-analyzer-*, | ||
| concurrency-*, | ||
| misc-*, | ||
| performance-*, | ||
| portability-*, | ||
| readability-*, | ||
| -readability-magic-numbers, | ||
| -bugprone-easily-swappable-parameters | ||
| WarningsAsErrors: '*' | ||
| HeaderFilterRegex: '^(include|src|libgitledger)/.*\.(h|c)$' | ||
| CheckOptions: | ||
| - key: readability-identifier-naming.TypedefCase | ||
| value: lower_case | ||
| - key: readability-identifier-naming.StructCase | ||
| value: lower_case | ||
| - key: readability-identifier-naming.UnionCase | ||
| value: lower_case | ||
| - key: readability-identifier-naming.EnumCase | ||
| value: lower_case | ||
| - key: readability-identifier-naming.EnumConstantCase | ||
| value: UPPER_CASE | ||
| - key: readability-identifier-naming.EnumConstantPrefix | ||
| value: 'GITLEDGER_' | ||
| - key: readability-identifier-naming.FunctionCase | ||
| value: lower_case | ||
| - key: readability-identifier-naming.FunctionPrefix | ||
| value: '' | ||
| - key: readability-identifier-naming.VariableCase | ||
| value: lower_case | ||
| - key: readability-identifier-naming.ParameterCase | ||
| value: lower_case | ||
| - key: readability-identifier-naming.MacroDefinitionCase | ||
| value: UPPER_CASE | ||
| - key: readability-identifier-naming.MacroDefinitionPrefix | ||
| value: 'GITLEDGER_' | ||
| - key: readability-identifier-naming.GlobalConstantCase | ||
| value: UPPER_CASE | ||
| - key: readability-identifier-naming.GlobalConstantPrefix | ||
| value: 'GITLEDGER_' | ||
| - key: readability-function-cognitive-complexity.Threshold | ||
| value: '25' | ||
| - key: readability-function-size.LineThreshold | ||
| value: '50' | ||
| - key: readability-function-size.StatementThreshold | ||
| value: '60' | ||
| - key: readability-function-size.BranchThreshold | ||
| value: '15' | ||
| - key: readability-function-size.ParameterThreshold | ||
| value: '8' | ||
| - key: readability-function-size.NestingThreshold | ||
| value: '5' | ||
| - key: readability-function-size.CallThreshold | ||
| value: '30' | ||
| - key: bugprone-suspicious-string-compare.WarnOnImplicitComparison | ||
| value: 'true' | ||
| - key: bugprone-suspicious-string-compare.WarnOnLogicalNotComparison | ||
| value: 'true' | ||
| - key: cert-err33-c.CheckedFunctions | ||
| # Mirror the cert-err33-c default allowlist so we can trim entries locally in future diffs. | ||
| value: | | ||
| ::aligned_alloc;::calloc;::clock;::fclose;::ferror;::fflush;::fgetc;::fgetpos;::fgets;::fgetwc;::fopen; | ||
| ::fprintf;::fputc;::fputs;::fputwc;::fread;::freopen;::fscanf;::fseek;::fsetpos;::ftell;::fwprintf; | ||
| ::fwrite;::fwscanf;::getc;::getchar;::gets;::getwc;::getwchar;::gmtime;::localtime;::malloc;::mbrtowc; | ||
| ::mbsrtowcs;::mbstowcs;::memchr;::mktime;::printf;::putc;::putchar;::puts;::putwc;::putwchar;::raise; | ||
| ::realloc;::remove;::rename;::scanf;::setlocale;::setvbuf;::signal;::snprintf;::sprintf;::sscanf;::strchr; | ||
| ::strerror_s;::strftime;::strpbrk;::strrchr;::strstr;::strtod;::strtof;::strtoimax;::strtok;::strtol; | ||
| ::strtoll;::strtoul;::strtoull;::strtoumax;::strxfrm;::swprintf;::swscanf;::time;::tmpfile;::tmpnam; | ||
| ::ungetc;::ungetwc;::vfprintf;::vfscanf;::vfwprintf;::vfwscanf;::vprintf;::vscanf;::vsnprintf;::vsprintf; | ||
| ::vsscanf;::vswprintf;::vswscanf;::vwprintf;::vwscanf;::wcrtomb;::wcschr;::wcsftime;::wcspbrk;::wcsrchr; | ||
| ::wcsrtombs;::wcsstr;::wcstod;::wcstof;::wcstoimax;::wcstok;::wcstol;::wcstoll;::wcstombs;::wcstoul; | ||
| ::wcstoull;::wcstoumax;::wcsxfrm;::wctob;::wmemchr;::wprintf;::wscanf | ||
| - key: performance-move-const-arg.CheckTriviallyCopyableMove | ||
| value: 'false' | ||
| - key: performance-no-automatic-move.AllowedTypes | ||
| value: '' | ||
| - key: misc-misplaced-const.CheckPrimitiveCasts | ||
| value: 'true' | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| root = true | ||
|  | ||
| [*] | ||
| charset = utf-8 | ||
| end_of_line = lf | ||
| insert_final_newline = true | ||
| trim_trailing_whitespace = true | ||
|  | ||
| [*.{c,h}] | ||
| indent_style = space | ||
| indent_size = 4 | ||
|  | ||
| [*.{yml,yaml,json,md,txt}] | ||
| indent_style = space | ||
| indent_size = 2 | ||
|  | ||
|         
                  flyingrobots marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| [*.md] | ||
| trim_trailing_whitespace = false | ||
|  | ||
| [Makefile] | ||
| indent_style = tab | ||
| indent_size = tab | ||
| tab_width = 4 | ||
|  | ||
| [*.sh] | ||
| indent_style = space | ||
| indent_size = 2 | ||
|  | ||
| [CMakeLists.txt] | ||
| indent_style = space | ||
| indent_size = 2 | ||
|  | ||
| [*.cmake] | ||
| indent_style = space | ||
| indent_size = 2 | ||
|  | ||
| [meson.build] | ||
| indent_style = space | ||
| indent_size = 2 | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| name: CI | ||
|  | ||
| on: | ||
| push: | ||
| branches: [main, feat/coding-standards] | ||
| pull_request: | ||
| branches: [main] | ||
|  | ||
| jobs: | ||
| linux-matrix: | ||
| name: ${{ matrix.name }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - name: GCC 14 (Ubuntu 24.04) | ||
| os: ubuntu-24.04 | ||
| cc: gcc-14 | ||
| cxx: g++-14 | ||
| packages: gcc-14 g++-14 clang-format-18 clang-tidy-18 | ||
| clang_format: clang-format-18 | ||
| clang_tidy: clang-tidy-18 | ||
| run_tidy: true | ||
| - name: Clang 18 (Ubuntu 24.04) | ||
| os: ubuntu-24.04 | ||
| cc: clang-18 | ||
| cxx: clang++-18 | ||
| packages: clang-18 clang++-18 clang-format-18 clang-tidy-18 | ||
| clang_format: clang-format-18 | ||
| clang_tidy: clang-tidy-18 | ||
| run_tidy: false | ||
| env: | ||
| CC: ${{ matrix.cc }} | ||
| CXX: ${{ matrix.cxx }} | ||
| CLANG_FORMAT: ${{ matrix.clang_format }} | ||
| CLANG_TIDY: ${{ matrix.clang_tidy }} | ||
| LIBGITLEDGER_CONTAINER_IMAGE: libgitledger-ci:latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|  | ||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y build-essential ninja-build cmake python3-pip rsync ${{ matrix.packages }} | ||
| python3 -m pip install --upgrade pip | ||
| python3 -m pip install meson | ||
|  | ||
| - name: Display toolchain versions | ||
| run: | | ||
| ${CC} --version | ||
| ${CXX} --version | ||
| ${CLANG_FORMAT} --version | ||
| ${CLANG_TIDY} --version | ||
| cmake --version | ||
| meson --version | ||
|  | ||
| - name: Verify Docker availability | ||
| run: docker version | ||
|  | ||
| - name: Pre-build CI container image | ||
| run: docker build -t libgitledger-ci:latest -f tools/container/Dockerfile . | ||
|  | ||
| - name: Verify make targets exist | ||
| # The container dispatch script expects these orchestrated targets; a dry run proves they resolve. | ||
| run: | | ||
| for target in cmake test-cmake meson test-meson format-check tidy; do | ||
| make -n "$target" >/dev/null | ||
| done | ||
|  | ||
| - name: Build with CMake | ||
| run: make cmake | ||
|  | ||
| - name: Run CMake tests | ||
| run: make test-cmake | ||
|  | ||
| - name: Build with Meson | ||
| run: make meson | ||
|  | ||
| - name: Run Meson tests | ||
| run: make test-meson | ||
|  | ||
|         
                  flyingrobots marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| - name: clang-format check | ||
| run: make format-check | ||
|  | ||
| - name: clang-tidy check | ||
| if: ${{ matrix.run_tidy }} | ||
| # tools/lint/run_clang_tidy.sh filters compile_commands.json to exclude test TU entries | ||
| run: make tidy | ||
|  | ||
| - name: Validate activity log schema | ||
| run: make activity-validate | ||
|  | ||
| windows-msvc: | ||
| name: MSVC (Windows) | ||
| runs-on: windows-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|  | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m pip install meson ninja | ||
| choco install ninja -y | ||
| shell: pwsh | ||
|  | ||
| - name: Configure CMake (Ninja) | ||
| run: cmake -S . -B build-msvc -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_STANDARD=17 -DCMAKE_C_STANDARD_REQUIRED=ON | ||
| shell: pwsh | ||
|  | ||
| - name: Build | ||
| run: cmake --build build-msvc | ||
| shell: pwsh | ||
|  | ||
| - name: Run CTest | ||
| run: ctest --test-dir build-msvc --output-on-failure | ||
| shell: pwsh | ||
|  | ||
| - name: Configure Meson | ||
| run: | | ||
| meson setup meson-msvc --buildtype release | ||
| meson compile -C meson-msvc | ||
| meson test -C meson-msvc --print-errorlogs | ||
| shell: pwsh | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -20,6 +20,7 @@ Icon | |
| build/ | ||
| build-debug/ | ||
| build-release/ | ||
| build-tidy/ | ||
| meson-debug/ | ||
| meson-release/ | ||
| meson-*/ | ||
|  | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| MD013: | ||
| line_length: 240 | ||
| code_blocks: false | ||
| tables: false | ||
| MD041: true | ||
| MD024: | ||
| siblings_only: true | ||
| MD029: | ||
| style: ordered | 
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.