From e4518639c09a0c45178dc39a2d0c17a649d1a896 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 10:58:45 +0000 Subject: [PATCH 01/15] Initial plan From 98f93100967c83d968e1d11017a8dbedb3d9e31b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 11:03:22 +0000 Subject: [PATCH 02/15] Add simple C project with GitHub Actions CI workflow Co-authored-by: DasVinch <11826483+DasVinch@users.noreply.github.com> --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ Makefile | 14 ++++++++++++++ hello | Bin 0 -> 16168 bytes src/main.c | 7 +++++++ src/mylib.c | 11 +++++++++++ src/mylib.h | 7 +++++++ 6 files changed, 61 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 Makefile create mode 100755 hello create mode 100644 src/main.c create mode 100644 src/mylib.c create mode 100644 src/mylib.h diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3d2525c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,22 @@ +name: CI + +on: + push: + branches: ["**"] + pull_request: + branches: ["**"] + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + + - name: Build + run: make + + - name: Run + run: ./hello diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e35a5a5 --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +CC = gcc +CFLAGS = -Wall -Wextra -Isrc +SRCS = src/main.c src/mylib.c +TARGET = hello + +.PHONY: all clean + +all: $(TARGET) + +$(TARGET): $(SRCS) + $(CC) $(CFLAGS) -o $@ $^ + +clean: + rm -f $(TARGET) diff --git a/hello b/hello new file mode 100755 index 0000000000000000000000000000000000000000..ce059e85a1a5ccd19fa1c8fa6ef39a3e997eb349 GIT binary patch literal 16168 zcmeHOYit}>6~4R9!=Y)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Itw5Yai z?{4Bjq}_*7r6FafNAuJ~fPOKseBLXTGKKsM!6jSK%chthwc)I$M-kTf}^0xKS=t&(cB3A$NUk9_A!4n`=25{&mFdRDNU7ZBR z{2BWzb?4wrXrxp9fpoOuwYqoAZ%;Rok_!9+>4pq_9d(GuzC1Ro z^J?tV#eQ7Af4P8%aqvUZ@i~EydG^G5_NIN%0aQQ12QDOXn6HxJ+8iL-K>+X|FCjAP z&_3pq3E`Xm+*Y{oe4lmVUNwO)X{_qO4 +#include "mylib.h" + +int main(void) { + printf("%s\n", greet("World")); + return 0; +} diff --git a/src/mylib.c b/src/mylib.c new file mode 100644 index 0000000..4c5ee76 --- /dev/null +++ b/src/mylib.c @@ -0,0 +1,11 @@ +#include +#include "mylib.h" + +#define BUF_SIZE 256 + +static _Thread_local char buf[BUF_SIZE]; + +const char *greet(const char *name) { + snprintf(buf, BUF_SIZE, "Hello, %s!", name); + return buf; +} diff --git a/src/mylib.h b/src/mylib.h new file mode 100644 index 0000000..3247c7f --- /dev/null +++ b/src/mylib.h @@ -0,0 +1,7 @@ +#ifndef MYLIB_H +#define MYLIB_H + +/* Returns a greeting string for the given name. */ +const char *greet(const char *name); + +#endif /* MYLIB_H */ From 289a01bfd74fb23cb723a519ceac4aba643f2a33 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 11:03:35 +0000 Subject: [PATCH 03/15] Remove built binary from tracking; add hello to .gitignore Co-authored-by: DasVinch <11826483+DasVinch@users.noreply.github.com> --- .gitignore | 1 + hello | Bin 16168 -> 0 bytes 2 files changed, 1 insertion(+) delete mode 100755 hello diff --git a/.gitignore b/.gitignore index 845cda6..18deb2c 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,4 @@ dkms.conf # debug information files *.dwo +hello diff --git a/hello b/hello deleted file mode 100755 index ce059e85a1a5ccd19fa1c8fa6ef39a3e997eb349..0000000000000000000000000000000000000000 GIT binary patch literal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mX)$gqd7m-N9Y#=972uuQFz5+W#=pgdkgBhoq0KItw5Yai z?{4Bjq}_*7r6FafNAuJ~fPOKseBLXTGKKsM!6jSK%chthwc)I$M-kTf}^0xKS=t&(cB3A$NUk9_A!4n`=25{&mFdRDNU7ZBR z{2BWzb?4wrXrxp9fpoOuwYqoAZ%;Rok_!9+>4pq_9d(GuzC1Ro z^J?tV#eQ7Af4P8%aqvUZ@i~EydG^G5_NIN%0aQQ12QDOXn6HxJ+8iL-K>+X|FCjAP z&_3pq3E`Xm+*Y{oe4lmVUNwO)X{_qO4 Date: Thu, 12 Mar 2026 12:13:22 +0100 Subject: [PATCH 04/15] env to workflow --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d2525c..3b86823 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,8 @@ name: CI +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + on: push: branches: ["**"] @@ -11,7 +14,6 @@ jobs: runs-on: ubuntu-latest permissions: contents: read - steps: - uses: actions/checkout@v4 From 03b76698173437534301f11dbd32e502bfb49e64 Mon Sep 17 00:00:00 2001 From: vdeo Date: Thu, 12 Mar 2026 12:46:56 +0100 Subject: [PATCH 05/15] play with workflows --- .clang-format | 2 ++ .clang-tidy | 12 ++++++++++++ .github/workflows/ci.yml | 4 ++-- .github/workflows/lint.yaml | 33 +++++++++++++++++++++++++++++++++ src/mylib.c | 4 ++-- src/mylib.h | 2 +- 6 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 .clang-format create mode 100644 .clang-tidy create mode 100644 .github/workflows/lint.yaml diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..563cd9a --- /dev/null +++ b/.clang-format @@ -0,0 +1,2 @@ +BasedOnStyle: Chromium +IndentWidth: 4 diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..1d1d234 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,12 @@ +Checks: > + -*, + clang-analyzer-*, + bugprone-*, + performance-*, + readability-*, + modernize-*, + -modernize-use-trailing-return-type, + -readability-magic-numbers, + -clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling +HeaderFilterRegex: 'src/.*' +WarningsAsErrors: '' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b86823..b3d17bf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,9 +5,9 @@ env: on: push: - branches: ["**"] + branches: [dev, main] pull_request: - branches: ["**"] + branches: [dev, main] jobs: build: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..bf2457d --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,33 @@ +name: Lint + +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + +on: + push: + branches: [dev, main] + pull_request: + branches: [dev, main] + +jobs: + lint: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + + - name: Install clang tools + run: | + sudo apt-get update + sudo apt-get install -y clang-format clang-tidy + + - name: Check formatting (clang-format) + run: | + find . -type f \( -name '*.c' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) \ + | xargs clang-format --dry-run --Werror + + - name: Static analysis (clang-tidy) + run: | + find . -type f \( -name '*.c' -o -name '*.cpp' \) \ + | xargs clang-tidy -- -Isrc diff --git a/src/mylib.c b/src/mylib.c index 4c5ee76..cd01d47 100644 --- a/src/mylib.c +++ b/src/mylib.c @@ -1,11 +1,11 @@ -#include #include "mylib.h" +#include #define BUF_SIZE 256 static _Thread_local char buf[BUF_SIZE]; -const char *greet(const char *name) { +const char* greet(const char* name) { snprintf(buf, BUF_SIZE, "Hello, %s!", name); return buf; } diff --git a/src/mylib.h b/src/mylib.h index 3247c7f..a197d9d 100644 --- a/src/mylib.h +++ b/src/mylib.h @@ -2,6 +2,6 @@ #define MYLIB_H /* Returns a greeting string for the given name. */ -const char *greet(const char *name); +const char* greet(const char* name); #endif /* MYLIB_H */ From 5b30c42ae67cb6add00a0ae843834173cc397929 Mon Sep 17 00:00:00 2001 From: vdeo Date: Thu, 12 Mar 2026 12:51:54 +0100 Subject: [PATCH 06/15] Fix xargs call to clang-tidy --- .github/workflows/lint.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index bf2457d..5de3133 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -29,5 +29,5 @@ jobs: - name: Static analysis (clang-tidy) run: | - find . -type f \( -name '*.c' -o -name '*.cpp' \) \ - | xargs clang-tidy -- -Isrc + find . -type f \( -name '*.c' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) \ + | xargs -I {} clang-tidy {} -- -Isrc From 9fef4897c7f7242248cdb29950efa6bdd808ccfa Mon Sep 17 00:00:00 2001 From: vdeo Date: Thu, 12 Mar 2026 13:03:47 +0100 Subject: [PATCH 07/15] update workflows --- .github/workflows/ci.yml | 2 +- .github/workflows/lint.yaml | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3d17bf..7b89c6f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: push: branches: [dev, main] pull_request: - branches: [dev, main] + branches: ["**"] jobs: build: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 5de3133..718d8c3 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -7,7 +7,7 @@ on: push: branches: [dev, main] pull_request: - branches: [dev, main] + branches: ["**"] jobs: lint: @@ -31,3 +31,13 @@ jobs: run: | find . -type f \( -name '*.c' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) \ | xargs -I {} clang-tidy {} -- -Isrc + + - name: Commit if changes + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add -A + if ! git diff --cached --quiet; then + git commit -m "chore: auto-format code [skip ci]" + git push + fi From 5a60e1b1a89d2a6cd556ffea33d176d05c05b4d4 Mon Sep 17 00:00:00 2001 From: vdeo Date: Thu, 12 Mar 2026 13:07:02 +0100 Subject: [PATCH 08/15] test: bad formatting --- src/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index ad46833..045345d 100644 --- a/src/main.c +++ b/src/main.c @@ -1,7 +1,10 @@ #include #include "mylib.h" -int main(void) { +int main(void) + +{ printf("%s\n", greet("World")); - return 0; + return 0; + } From 9f7d820af4e028f25551f2ac9cb35f8cd31f80c3 Mon Sep 17 00:00:00 2001 From: vdeo Date: Thu, 12 Mar 2026 13:10:30 +0100 Subject: [PATCH 09/15] wflow fix - clang format autoformat --- .github/workflows/lint.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 718d8c3..10078ef 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -22,15 +22,15 @@ jobs: sudo apt-get update sudo apt-get install -y clang-format clang-tidy - - name: Check formatting (clang-format) + - name: Static analysis (clang-tidy) run: | find . -type f \( -name '*.c' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) \ - | xargs clang-format --dry-run --Werror + | xargs -I {} clang-tidy {} -- -Isrc - - name: Static analysis (clang-tidy) + - name: Check formatting (clang-format) run: | find . -type f \( -name '*.c' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) \ - | xargs -I {} clang-tidy {} -- -Isrc + | xargs clang-format -i - name: Commit if changes run: | From 96016278ab581f8d954f8f059ffd5cadf58f91ca Mon Sep 17 00:00:00 2001 From: vdeo Date: Thu, 12 Mar 2026 13:12:51 +0100 Subject: [PATCH 10/15] co the appropriate brach in action for lint re-commit --- .github/workflows/lint.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 10078ef..95d4f2f 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -16,6 +16,8 @@ jobs: contents: read steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} - name: Install clang tools run: | From 55b615dada1c3ac6668940accefcb9b2fde26c62 Mon Sep 17 00:00:00 2001 From: vdeo Date: Thu, 12 Mar 2026 13:17:55 +0100 Subject: [PATCH 11/15] --fixup --- .github/workflows/lint.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 95d4f2f..5c18b29 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -13,7 +13,8 @@ jobs: lint: runs-on: ubuntu-latest permissions: - contents: read + contents: write + pull-requests: write steps: - uses: actions/checkout@v4 with: From db482663805db0048aafce3d833d2064d25195e0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 12 Mar 2026 12:18:23 +0000 Subject: [PATCH 12/15] chore: auto-format code [skip ci] --- src/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 045345d..3051327 100644 --- a/src/main.c +++ b/src/main.c @@ -5,6 +5,5 @@ int main(void) { printf("%s\n", greet("World")); - return 0; - + return 0; } From 1ead3f9810ceacb0c21396870a21d2012d6ebcde Mon Sep 17 00:00:00 2001 From: vdeo Date: Thu, 12 Mar 2026 13:19:21 +0100 Subject: [PATCH 13/15] Add commit but github has linted in the meantime. --- src/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.c b/src/main.c index 3051327..77abac7 100644 --- a/src/main.c +++ b/src/main.c @@ -4,6 +4,7 @@ int main(void) { + int x = 3; printf("%s\n", greet("World")); return 0; } From 11f50937920f3ae603d30e1d26e8fc50561bdac1 Mon Sep 17 00:00:00 2001 From: vdeo Date: Mon, 16 Mar 2026 21:15:00 +0100 Subject: [PATCH 14/15] pre-commit-config --- .pre-commit-config.yaml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..169506c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,32 @@ +repos: +- repo: https://github.com/google/yapf.git + rev: v0.40.2 + hooks: + - id: yapf + additional_dependencies: [toml] +- repo: https://github.com/pre-commit/mirrors-autopep8 + rev: v1.6.0 + hooks: + - id: autopep8 + files: \.pyx + args: + - --in-place + - --max-line-length + - '80' + - -a +- repo: https://github.com/pre-commit/pre-commit-hooks.git + rev: v5.0.0 + hooks: + - id: trailing-whitespace + exclude: \.fits + - id: end-of-file-fixer + exclude: \.fits + - id: check-yaml + - id: debug-statements + - id: name-tests-test + exclude: conftestaux/ + - id: requirements-txt-fixer +- repo: https://github.com/pre-commit/mirrors-clang-format + rev: v20.1.0 + hooks: + - id: clang-format From 52fb3b5f691677b1e0a84e7c4a38c4de7baaf726 Mon Sep 17 00:00:00 2001 From: vdeo Date: Mon, 16 Mar 2026 21:16:05 +0100 Subject: [PATCH 15/15] Successful pre-commit commit --- .clang-format | 1 + .github/workflows/pre-commit.yaml | 50 +++++++++++++++++++++++++++++++ .pre-commit-config.yaml | 16 ++-------- src/main.c | 4 +-- 4 files changed, 55 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/pre-commit.yaml diff --git a/.clang-format b/.clang-format index 563cd9a..daf13da 100644 --- a/.clang-format +++ b/.clang-format @@ -1,2 +1,3 @@ BasedOnStyle: Chromium IndentWidth: 4 +ColumnLimit: 100 diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml new file mode 100644 index 0000000..0773e39 --- /dev/null +++ b/.github/workflows/pre-commit.yaml @@ -0,0 +1,50 @@ +name: pre-commit + +on: + push: + branches: [dev, main] + pull_request: + branches: [dev, main] + workflow_call: + inputs: + working-directory: + type: string + required: false + default: '.' + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + id: setup-python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + cache: 'pip' + + - uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit + key: > + ${{ format('pre-commit-{0}-{1}', + steps.setup-python.outputs.python-version, + hashFiles('.pre-commit-config.yaml') + ) }} + + - name: Install pre-commit + run: | + pip install --upgrade pip + pip install pre-commit + pre-commit install + + - name: Run pre-commit hooks + working-directory: ${{ inputs.working-directory }} + run: | + git ls-files | xargs pre-commit run \ + --show-diff-on-failure \ + --color=always \ + --files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 169506c..0690d83 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,21 +1,11 @@ repos: - repo: https://github.com/google/yapf.git - rev: v0.40.2 + rev: v0.43.0 hooks: - id: yapf additional_dependencies: [toml] -- repo: https://github.com/pre-commit/mirrors-autopep8 - rev: v1.6.0 - hooks: - - id: autopep8 - files: \.pyx - args: - - --in-place - - --max-line-length - - '80' - - -a - repo: https://github.com/pre-commit/pre-commit-hooks.git - rev: v5.0.0 + rev: v6.0.0 hooks: - id: trailing-whitespace exclude: \.fits @@ -27,6 +17,6 @@ repos: exclude: conftestaux/ - id: requirements-txt-fixer - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v20.1.0 + rev: v22.1.1 hooks: - id: clang-format diff --git a/src/main.c b/src/main.c index 77abac7..f2399e7 100644 --- a/src/main.c +++ b/src/main.c @@ -1,9 +1,7 @@ #include #include "mylib.h" -int main(void) - -{ +int main(void) { int x = 3; printf("%s\n", greet("World")); return 0;