From c77e8069170f32f0346fff30ef1fe14a2c05d4e6 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Sun, 27 Sep 2026 09:37:43 +0800 Subject: [PATCH 01/10] ci: collect LLGo test coverage with Codecov --- .github/actions/setup-llgo/action.yml | 16 ++++++++++++++-- .github/workflows/llgo.yml | 21 ++++++++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/.github/actions/setup-llgo/action.yml b/.github/actions/setup-llgo/action.yml index 39c90aa1..ab3cbb87 100644 --- a/.github/actions/setup-llgo/action.yml +++ b/.github/actions/setup-llgo/action.yml @@ -8,8 +8,8 @@ inputs: description: "LLVM version to install (e.g. 18)" default: "22" llgo: - description: "LLGo version to install (e.g. v1.0.1)" - default: "v1.0.4" + description: "LLGo release version or main branch" + default: "main" runs: using: "composite" steps: @@ -35,10 +35,22 @@ runs: sudo apt-get update sudo apt-get install -y clang-${{inputs.llvm}} pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libuv1-dev echo "/usr/lib/llvm-${{inputs.llvm}}/bin" >> $GITHUB_PATH + - name: Build LLGo from main + if: inputs.llgo == 'main' + shell: bash + run: | + git clone --depth 1 --branch main https://github.com/xgo-dev/llgo.git .llgo + git -C .llgo rev-parse HEAD + mkdir -p .llgo/bin + go -C .llgo build -p=2 -o bin/llgo ./cmd/llgo - name: Download LLGo release + if: inputs.llgo != 'main' shell: bash run: | bash .github/actions/setup-llgo/download-llgo.sh ${{inputs.llgo}} .llgo + - name: Add LLGo to PATH + shell: bash + run: | echo "$GITHUB_WORKSPACE/.llgo/bin" >> $GITHUB_PATH export LLGO_ROOT=$GITHUB_WORKSPACE/.llgo echo "LLGO_ROOT=$LLGO_ROOT" >> $GITHUB_ENV diff --git a/.github/workflows/llgo.yml b/.github/workflows/llgo.yml index fb8015e2..6e6e5cec 100644 --- a/.github/workflows/llgo.yml +++ b/.github/workflows/llgo.yml @@ -20,13 +20,16 @@ concurrency: jobs: test: + permissions: + contents: read + id-token: write strategy: matrix: os: - macos-latest - ubuntu-latest llvm: [22] - llgo: [v1.0.4] + llgo: [main] go: [1.27] fail-fast: false runs-on: ${{matrix.os}} @@ -39,6 +42,18 @@ jobs: llvm: ${{ matrix.llvm }} llgo: ${{ matrix.llgo }} - - name: Test + - name: Test with coverage run: | - llgo test -v ./... + llgo test -v -covermode=atomic -coverprofile=coverage.txt ./... + go tool cover -func=coverage.txt | tail -1 + + - name: Upload coverage to Codecov + if: ${{ github.repository == 'goplus/llcppg' && !cancelled() && hashFiles('coverage.txt') != '' }} + uses: codecov/codecov-action@v7 + with: + token: ${{ secrets.CODECOV_TOKEN }} + use_oidc: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} + files: coverage.txt + flags: llgo-tests + disable_search: true + fail_ci_if_error: true From 9118fe7b76af4fd321d1acf9e7541117d67480ab Mon Sep 17 00:00:00 2001 From: Li Jie Date: Sun, 27 Sep 2026 09:55:13 +0800 Subject: [PATCH 02/10] ci: install LLVM linker for Linux coverage tests --- .github/actions/setup-llgo/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-llgo/action.yml b/.github/actions/setup-llgo/action.yml index ab3cbb87..9eeb6623 100644 --- a/.github/actions/setup-llgo/action.yml +++ b/.github/actions/setup-llgo/action.yml @@ -33,7 +33,7 @@ runs: echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-${{inputs.llvm}} main" | sudo tee /etc/apt/sources.list.d/llvm.list wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - sudo apt-get update - sudo apt-get install -y clang-${{inputs.llvm}} pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libuv1-dev + sudo apt-get install -y clang-${{inputs.llvm}} lld-${{inputs.llvm}} pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libuv1-dev echo "/usr/lib/llvm-${{inputs.llvm}}/bin" >> $GITHUB_PATH - name: Build LLGo from main if: inputs.llgo == 'main' From cc5b7d8b8180623f7192826333b09eb28e751081 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Sun, 27 Sep 2026 10:00:09 +0800 Subject: [PATCH 03/10] ci: install libclang for Linux coverage tests --- .github/actions/setup-llgo/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-llgo/action.yml b/.github/actions/setup-llgo/action.yml index 9eeb6623..9b257f6a 100644 --- a/.github/actions/setup-llgo/action.yml +++ b/.github/actions/setup-llgo/action.yml @@ -33,7 +33,7 @@ runs: echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-${{inputs.llvm}} main" | sudo tee /etc/apt/sources.list.d/llvm.list wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - sudo apt-get update - sudo apt-get install -y clang-${{inputs.llvm}} lld-${{inputs.llvm}} pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libuv1-dev + sudo apt-get install -y clang-${{inputs.llvm}} libclang-${{inputs.llvm}}-dev lld-${{inputs.llvm}} pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libuv1-dev echo "/usr/lib/llvm-${{inputs.llvm}}/bin" >> $GITHUB_PATH - name: Build LLGo from main if: inputs.llgo == 'main' From 74d4e4e3f89711bc4e28c2b15f3b2ad32b8709c1 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Sun, 27 Sep 2026 10:20:27 +0800 Subject: [PATCH 04/10] ci: include cross-package LLGo coverage and all source directories --- .github/codecov.yml | 2 ++ .github/workflows/llgo.yml | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .github/codecov.yml diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 00000000..fb9f8594 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,2 @@ +# Include every package in the LLGo report, including tool/ and its dependencies. +ignore: [] diff --git a/.github/workflows/llgo.yml b/.github/workflows/llgo.yml index 6e6e5cec..6080152a 100644 --- a/.github/workflows/llgo.yml +++ b/.github/workflows/llgo.yml @@ -43,8 +43,9 @@ jobs: llgo: ${{ matrix.llgo }} - name: Test with coverage + shell: bash run: | - llgo test -v -covermode=atomic -coverprofile=coverage.txt ./... + llgo test -v -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt ./... go tool cover -func=coverage.txt | tail -1 - name: Upload coverage to Codecov From e9f683966d6cf8553884c23780f28abf90352f6f Mon Sep 17 00:00:00 2001 From: Li Jie Date: Sun, 27 Sep 2026 10:31:13 +0800 Subject: [PATCH 05/10] ci: address LLGo setup and upload review feedback --- .github/actions/setup-llgo/action.yml | 21 +++++++++++++-------- .github/workflows/llgo.yml | 2 -- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/actions/setup-llgo/action.yml b/.github/actions/setup-llgo/action.yml index 9b257f6a..779b8312 100644 --- a/.github/actions/setup-llgo/action.yml +++ b/.github/actions/setup-llgo/action.yml @@ -8,16 +8,26 @@ inputs: description: "LLVM version to install (e.g. 18)" default: "22" llgo: - description: "LLGo release version or main branch" + description: "The literal 'main' builds the latest main branch from source; any other value is downloaded as a release tag (e.g. v1.0.4)" default: "main" runs: using: "composite" steps: - uses: actions/checkout@v7 + - name: Checkout LLGo main + if: inputs.llgo == 'main' + shell: bash + run: | + # Track main for coverage support and log the exact revision used by this run. + git clone --depth 1 --branch main https://github.com/xgo-dev/llgo.git .llgo + git -C .llgo rev-parse HEAD - name: Set up Go uses: actions/setup-go@v7 with: go-version: ${{inputs.go}} + cache-dependency-path: | + go.sum + .llgo/go.sum - name: Install dependencies (macOS) if: runner.os == 'macOS' shell: bash @@ -38,11 +48,7 @@ runs: - name: Build LLGo from main if: inputs.llgo == 'main' shell: bash - run: | - git clone --depth 1 --branch main https://github.com/xgo-dev/llgo.git .llgo - git -C .llgo rev-parse HEAD - mkdir -p .llgo/bin - go -C .llgo build -p=2 -o bin/llgo ./cmd/llgo + run: go -C .llgo build -o bin/llgo ./cmd/llgo - name: Download LLGo release if: inputs.llgo != 'main' shell: bash @@ -52,8 +58,7 @@ runs: shell: bash run: | echo "$GITHUB_WORKSPACE/.llgo/bin" >> $GITHUB_PATH - export LLGO_ROOT=$GITHUB_WORKSPACE/.llgo - echo "LLGO_ROOT=$LLGO_ROOT" >> $GITHUB_ENV + echo "LLGO_ROOT=$GITHUB_WORKSPACE/.llgo" >> $GITHUB_ENV - name: Verify LLGo installation shell: bash run: | diff --git a/.github/workflows/llgo.yml b/.github/workflows/llgo.yml index 6080152a..03c2a375 100644 --- a/.github/workflows/llgo.yml +++ b/.github/workflows/llgo.yml @@ -22,7 +22,6 @@ jobs: test: permissions: contents: read - id-token: write strategy: matrix: os: @@ -53,7 +52,6 @@ jobs: uses: codecov/codecov-action@v7 with: token: ${{ secrets.CODECOV_TOKEN }} - use_oidc: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} files: coverage.txt flags: llgo-tests disable_search: true From 05b4fc2f2194d54ac16e433385b8aab6a6e334d6 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Sun, 27 Sep 2026 10:52:51 +0800 Subject: [PATCH 06/10] ci: use xgo-dev/setup-llgo with main branch support --- .github/actions/setup-llgo/action.yml | 27 +++++---------------------- .github/workflows/llgo.yml | 9 +++++---- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/.github/actions/setup-llgo/action.yml b/.github/actions/setup-llgo/action.yml index 779b8312..39c90aa1 100644 --- a/.github/actions/setup-llgo/action.yml +++ b/.github/actions/setup-llgo/action.yml @@ -8,26 +8,16 @@ inputs: description: "LLVM version to install (e.g. 18)" default: "22" llgo: - description: "The literal 'main' builds the latest main branch from source; any other value is downloaded as a release tag (e.g. v1.0.4)" - default: "main" + description: "LLGo version to install (e.g. v1.0.1)" + default: "v1.0.4" runs: using: "composite" steps: - uses: actions/checkout@v7 - - name: Checkout LLGo main - if: inputs.llgo == 'main' - shell: bash - run: | - # Track main for coverage support and log the exact revision used by this run. - git clone --depth 1 --branch main https://github.com/xgo-dev/llgo.git .llgo - git -C .llgo rev-parse HEAD - name: Set up Go uses: actions/setup-go@v7 with: go-version: ${{inputs.go}} - cache-dependency-path: | - go.sum - .llgo/go.sum - name: Install dependencies (macOS) if: runner.os == 'macOS' shell: bash @@ -43,22 +33,15 @@ runs: echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-${{inputs.llvm}} main" | sudo tee /etc/apt/sources.list.d/llvm.list wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - sudo apt-get update - sudo apt-get install -y clang-${{inputs.llvm}} libclang-${{inputs.llvm}}-dev lld-${{inputs.llvm}} pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libuv1-dev + sudo apt-get install -y clang-${{inputs.llvm}} pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libuv1-dev echo "/usr/lib/llvm-${{inputs.llvm}}/bin" >> $GITHUB_PATH - - name: Build LLGo from main - if: inputs.llgo == 'main' - shell: bash - run: go -C .llgo build -o bin/llgo ./cmd/llgo - name: Download LLGo release - if: inputs.llgo != 'main' shell: bash run: | bash .github/actions/setup-llgo/download-llgo.sh ${{inputs.llgo}} .llgo - - name: Add LLGo to PATH - shell: bash - run: | echo "$GITHUB_WORKSPACE/.llgo/bin" >> $GITHUB_PATH - echo "LLGO_ROOT=$GITHUB_WORKSPACE/.llgo" >> $GITHUB_ENV + export LLGO_ROOT=$GITHUB_WORKSPACE/.llgo + echo "LLGO_ROOT=$LLGO_ROOT" >> $GITHUB_ENV - name: Verify LLGo installation shell: bash run: | diff --git a/.github/workflows/llgo.yml b/.github/workflows/llgo.yml index 03c2a375..35b3f4dc 100644 --- a/.github/workflows/llgo.yml +++ b/.github/workflows/llgo.yml @@ -35,11 +35,12 @@ jobs: steps: - uses: actions/checkout@v7 - name: Setup llgo - uses: ./.github/actions/setup-llgo + # Ref installation and current toolchains: xgo-dev/setup-llgo#50. + uses: xgo-dev/setup-llgo@553930cf11e9a2eb44a708c6d4ed4d0c1f910722 with: - go: ${{ matrix.go }} - llvm: ${{ matrix.llvm }} - llgo: ${{ matrix.llgo }} + go-version: ${{ matrix.go }} + llvm-version: ${{ matrix.llvm }} + llgo-version: ${{ matrix.llgo }} - name: Test with coverage shell: bash From 2766b24dd63db868a3cbd01b7f78b9c151b60e1c Mon Sep 17 00:00:00 2001 From: Li Jie Date: Sun, 27 Sep 2026 11:08:21 +0800 Subject: [PATCH 07/10] ci: use reviewed setup-llgo implementation --- .github/workflows/llgo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/llgo.yml b/.github/workflows/llgo.yml index 35b3f4dc..13c8845c 100644 --- a/.github/workflows/llgo.yml +++ b/.github/workflows/llgo.yml @@ -36,7 +36,7 @@ jobs: - uses: actions/checkout@v7 - name: Setup llgo # Ref installation and current toolchains: xgo-dev/setup-llgo#50. - uses: xgo-dev/setup-llgo@553930cf11e9a2eb44a708c6d4ed4d0c1f910722 + uses: xgo-dev/setup-llgo@47fdb6a8663930f441dbeeca34ea7fd39f5316c4 with: go-version: ${{ matrix.go }} llvm-version: ${{ matrix.llvm }} From 23e52f39717e1858303ba1c82d671016e7ab5054 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Sun, 27 Sep 2026 11:22:08 +0800 Subject: [PATCH 08/10] ci: pin setup-llgo contribution with validated CI checks --- .github/workflows/llgo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/llgo.yml b/.github/workflows/llgo.yml index 13c8845c..aa891bf4 100644 --- a/.github/workflows/llgo.yml +++ b/.github/workflows/llgo.yml @@ -36,7 +36,7 @@ jobs: - uses: actions/checkout@v7 - name: Setup llgo # Ref installation and current toolchains: xgo-dev/setup-llgo#50. - uses: xgo-dev/setup-llgo@47fdb6a8663930f441dbeeca34ea7fd39f5316c4 + uses: xgo-dev/setup-llgo@d40dce1c971f98409d077cbade1cd04607919dd4 with: go-version: ${{ matrix.go }} llvm-version: ${{ matrix.llvm }} From dc4f514ed7cc5362ff851c08ff4c396c0c53ba47 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Sun, 27 Sep 2026 11:49:09 +0800 Subject: [PATCH 09/10] ci: consume setup-llgo review fixes --- .github/workflows/llgo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/llgo.yml b/.github/workflows/llgo.yml index aa891bf4..48aba0a6 100644 --- a/.github/workflows/llgo.yml +++ b/.github/workflows/llgo.yml @@ -36,7 +36,7 @@ jobs: - uses: actions/checkout@v7 - name: Setup llgo # Ref installation and current toolchains: xgo-dev/setup-llgo#50. - uses: xgo-dev/setup-llgo@d40dce1c971f98409d077cbade1cd04607919dd4 + uses: xgo-dev/setup-llgo@16e54713e4480f5c315c1b1b395ce6c10ba91ecf with: go-version: ${{ matrix.go }} llvm-version: ${{ matrix.llvm }} From b69078ec2da39f537ff5dcc4190dd7428162d1d5 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Sun, 27 Sep 2026 12:27:14 +0800 Subject: [PATCH 10/10] ci: use released setup-llgo v0.2.0 --- .github/workflows/llgo.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/llgo.yml b/.github/workflows/llgo.yml index 48aba0a6..0ebdaa8f 100644 --- a/.github/workflows/llgo.yml +++ b/.github/workflows/llgo.yml @@ -35,8 +35,7 @@ jobs: steps: - uses: actions/checkout@v7 - name: Setup llgo - # Ref installation and current toolchains: xgo-dev/setup-llgo#50. - uses: xgo-dev/setup-llgo@16e54713e4480f5c315c1b1b395ce6c10ba91ecf + uses: xgo-dev/setup-llgo@v0.2.0 with: go-version: ${{ matrix.go }} llvm-version: ${{ matrix.llvm }}