From 7f874dbcd852cfa75b479e4feab331f4fc3f4e95 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Tue, 6 Oct 2026 15:16:25 +0800 Subject: [PATCH 1/4] ci: validate setup-llgo action and shared standalone installer --- .github/workflows/llgo.yml | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/.github/workflows/llgo.yml b/.github/workflows/llgo.yml index 037666e1b..3a5184608 100644 --- a/.github/workflows/llgo.yml +++ b/.github/workflows/llgo.yml @@ -17,6 +17,7 @@ concurrency: jobs: test: + timeout-minutes: 25 permissions: contents: read strategy: @@ -27,17 +28,45 @@ jobs: llvm: [22] llgo: [main] go: [1.27] + installer: [action, standalone] fail-fast: false runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v7 - name: Setup llgo + if: matrix.installer == 'action' + uses: cpunion/setup-llgo@6676861b76e6095866319e6c267d3809baa3cbfe + with: + llvm-version: ${{ matrix.llvm }} + llgo-version: ${{ matrix.llgo }} + go-version: ${{ matrix.go }} + + - name: Checkout the same standalone installer + if: matrix.installer == 'standalone' + uses: actions/checkout@v7 + with: + repository: cpunion/setup-llgo + ref: 6676861b76e6095866319e6c267d3809baa3cbfe + path: .setup-llgo + persist-credentials: false + - name: Setup llgo without the action + if: matrix.installer == 'standalone' shell: bash env: LLVM_VERSION: ${{ matrix.llvm }} - LLGO_REF: ${{ matrix.llgo }} + LLGO_VERSION: ${{ matrix.llgo }} GO_VERSION: ${{ matrix.go }}.0 - run: .github/scripts/install-llgo.sh + GH_TOKEN: ${{ github.token }} + run: bash .setup-llgo/scripts/install.sh + + - name: Check the active toolchain and HTTPS after installation + shell: bash + run: | + GOTOOLCHAIN=local go version + llvm-config --version + llgo version + git ls-remote https://github.com/xgo-dev/llgo HEAD + curl --fail --silent --show-error --head https://github.com - name: Test with coverage shell: bash From 336924f4afbf59e7076cd6a2ae7da6d480053628 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Tue, 6 Oct 2026 15:24:04 +0800 Subject: [PATCH 2/4] ci: provide the standalone installer bootstrap Go on clean runners --- .github/workflows/llgo.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/llgo.yml b/.github/workflows/llgo.yml index 3a5184608..cb1476090 100644 --- a/.github/workflows/llgo.yml +++ b/.github/workflows/llgo.yml @@ -49,6 +49,12 @@ jobs: ref: 6676861b76e6095866319e6c267d3809baa3cbfe path: .setup-llgo persist-credentials: false + - name: Provide the standalone installer's Go launcher + if: matrix.installer == 'standalone' + uses: actions/setup-go@v7 + with: + go-version: '1.24' + cache: false - name: Setup llgo without the action if: matrix.installer == 'standalone' shell: bash From 61c86761c8628ea77fe6c3a853cbc9f4eef6ec66 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Tue, 6 Oct 2026 15:30:44 +0800 Subject: [PATCH 3/4] docs: guide agents through the CI-validated setup-llgo installer --- .github/workflows/llgo.yml | 4 +-- AGENTS.md | 65 ++++++++++++++++++++------------------ 2 files changed, 37 insertions(+), 32 deletions(-) diff --git a/.github/workflows/llgo.yml b/.github/workflows/llgo.yml index cb1476090..32c0fc411 100644 --- a/.github/workflows/llgo.yml +++ b/.github/workflows/llgo.yml @@ -35,7 +35,7 @@ jobs: - uses: actions/checkout@v7 - name: Setup llgo if: matrix.installer == 'action' - uses: cpunion/setup-llgo@6676861b76e6095866319e6c267d3809baa3cbfe + uses: cpunion/setup-llgo@46658437168f2b817fea2e56c88ecdd61f29cc4f with: llvm-version: ${{ matrix.llvm }} llgo-version: ${{ matrix.llgo }} @@ -46,7 +46,7 @@ jobs: uses: actions/checkout@v7 with: repository: cpunion/setup-llgo - ref: 6676861b76e6095866319e6c267d3809baa3cbfe + ref: 46658437168f2b817fea2e56c88ecdd61f29cc4f path: .setup-llgo persist-credentials: false - name: Provide the standalone installer's Go launcher diff --git a/AGENTS.md b/AGENTS.md index 343ebcae0..d10145e0d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -38,61 +38,66 @@ the most critical; changes to either must be tested with `llgo test`. | `tool/pputil/` | Preprocessor utilities (header listing, include resolution) used by `tool`. | | `cmd/llcppg/` | Main `llcppg` command-line entry point. | | `clang/` | Higher-level clang helpers (based on package `github.com/llarhub/clang-c`). | -| `.github/` | CI workflow (`workflows/llgo.yml`) and `scripts/install-llgo.sh`, which installs Go, LLVM and llgo (used by both CI and agents). | +| `.github/` | CI workflow (`workflows/llgo.yml`) validates the setup-llgo action and its standalone installer. | ## Build and test ### Install the llgo toolchain **Installing llgo is a required, supported step. "I cannot install llgo" is not -an acceptable reason to skip `llgo test`.** Do not build llgo by hand or use -`setup-llgo` outside CI; run the repository's install script, which is also what -CI runs (`.github/workflows/llgo.yml`), so it stays tested. +an acceptable reason to skip `llgo test`.** Use setup-llgo's standalone installer +for local/agent work; it shares the action's version resolver, source builder and +dependency setup. CI tests both entrypoints (`.github/workflows/llgo.yml`). -Prerequisites: Linux (Ubuntu/Debian with `apt`) or macOS (Homebrew), `git`, -`curl`, network access, and `sudo` (or root) on Linux. Any `go` on `PATH` is -enough to start; the script obtains the exact Go version from `go.mod` -(currently Go 1.27.0). +During this draft's validation, use the candidate from +[setup-llgo #51](https://github.com/xgo-dev/setup-llgo/pull/51), pinned to the same +commit as CI below. Follow its +[local installation guide](https://github.com/cpunion/setup-llgo/blob/46658437168f2b817fea2e56c88ecdd61f29cc4f/README.md#local-development-and-agents); +the entrypoint is `scripts/install.sh`. +For released LLGo and platform package-manager instructions, see the +[upstream LLGo README](https://raw.githubusercontent.com/xgo-dev/llgo/refs/heads/main/README.md). -1. Install (idempotent, ~1-5 minutes; safe to re-run): +Prerequisites: Linux (Ubuntu/Debian with `apt`) or macOS (Homebrew), Bash, Git, +Node.js 20+, an existing Go 1.21+ launcher, network access, and `sudo` (or root) +on Linux. If Go or Node is absent, install it with the platform package manager +first. The installer then selects the exact Go 1.27.0 toolchain. - ```bash - .github/scripts/install-llgo.sh - ``` - - Pinned versions (what CI uses): LLVM `22`, llgo `main`, Go from `go.mod`. - To pick others, set env vars, e.g. - `LLGO_REF= LLVM_VERSION=22 .github/scripts/install-llgo.sh` - (see the header of the script for all options). - -2. Activate it in your shell using the `export` lines the script prints at the - end (they must be re-run in every new shell). Typical Linux values: +1. Check out the candidate into a new sibling directory, then install: ```bash - export PATH="$HOME/.llgo/bin:/usr/lib/llvm-22/bin:$PATH" - export GOTOOLCHAIN=local - export LLGO_ROOT="$HOME/.llgo-src" + git clone https://github.com/cpunion/setup-llgo.git ../setup-llgo + git -C ../setup-llgo checkout --detach 46658437168f2b817fea2e56c88ecdd61f29cc4f + LLGO_VERSION=main GO_VERSION=1.27.0 LLVM_VERSION=22 bash ../setup-llgo/scripts/install.sh ``` - The printed `PATH` also contains the Go 1.27 `bin` directory; it **must** - come before any older `go` (see failure modes below). + Reuse that installer checkout on subsequent invocations; do not reset another + user's checkout. `LLGO_VERSION` accepts a branch, tag, or commit. Each install + owns a new directory under `~/.cache/setup-llgo` by default, without changing + shell profiles. No `npm install` is needed. + +2. Run the exact `source .../env.sh` command printed at the end, and repeat it + in each new shell. It sets `LLGO_ROOT`, `GOTOOLCHAIN=local` and `PATH`, with + the selected Go/LLVM/LLGo executables before older installations. Do not use + the old `~/.llgo/bin` or `~/.llgo-src` paths for this installer. 3. Confirm success: ```bash - llgo version # prints "llgo v1.0.x ... linux/amd64" - llgo test ./tool/pputil/... # prints "ok github.com/goplus/llcppg/tool/pputil" + GOTOOLCHAIN=local go version # must report go1.27.0 + llvm-config --version # must report LLVM 22.x + llgo version + llgo test ./tool/pputil/... ``` Common failure modes: - `go: unknown GOEXPERIMENT dwarf5`: an older `go` (e.g. 1.24) is first on - `PATH`. Put the Go 1.27 `bin` dir printed by the script first, and set - `GOTOOLCHAIN=local`. + `PATH`. Source the generated `env.sh` to activate the actual Go 1.27 binary + with `GOTOOLCHAIN=local`. - `llvm-config`/`clang` not found or wrong version: add `/usr/lib/llvm-22/bin` (Linux) or `$(brew --prefix llvm@22)/bin` (macOS) to `PATH`. -- `llgo: command not found`: re-run the `export PATH=...` line from step 2. +- `llgo: command not found`: source the generated `env.sh` from step 2. - apt/brew/network errors: re-run the script; it is idempotent. - Link errors with missing symbols: you ran plain `go test`; use `llgo test`. From 63234e5ac3df07e29ee5dd8140c4efb3f5b73b07 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Tue, 6 Oct 2026 16:40:02 +0800 Subject: [PATCH 4/4] ci: validate the simplified setup-llgo head --- .github/workflows/llgo.yml | 4 ++-- AGENTS.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/llgo.yml b/.github/workflows/llgo.yml index 32c0fc411..620b9b2bb 100644 --- a/.github/workflows/llgo.yml +++ b/.github/workflows/llgo.yml @@ -35,7 +35,7 @@ jobs: - uses: actions/checkout@v7 - name: Setup llgo if: matrix.installer == 'action' - uses: cpunion/setup-llgo@46658437168f2b817fea2e56c88ecdd61f29cc4f + uses: cpunion/setup-llgo@66efbc5bac45a7810acc79717e8bee5ac62f8e77 with: llvm-version: ${{ matrix.llvm }} llgo-version: ${{ matrix.llgo }} @@ -46,7 +46,7 @@ jobs: uses: actions/checkout@v7 with: repository: cpunion/setup-llgo - ref: 46658437168f2b817fea2e56c88ecdd61f29cc4f + ref: 66efbc5bac45a7810acc79717e8bee5ac62f8e77 path: .setup-llgo persist-credentials: false - name: Provide the standalone installer's Go launcher diff --git a/AGENTS.md b/AGENTS.md index d10145e0d..df40674ca 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -52,7 +52,7 @@ dependency setup. CI tests both entrypoints (`.github/workflows/llgo.yml`). During this draft's validation, use the candidate from [setup-llgo #51](https://github.com/xgo-dev/setup-llgo/pull/51), pinned to the same commit as CI below. Follow its -[local installation guide](https://github.com/cpunion/setup-llgo/blob/46658437168f2b817fea2e56c88ecdd61f29cc4f/README.md#local-development-and-agents); +[local installation guide](https://github.com/cpunion/setup-llgo/blob/66efbc5bac45a7810acc79717e8bee5ac62f8e77/README.md#local-development-and-agents); the entrypoint is `scripts/install.sh`. For released LLGo and platform package-manager instructions, see the [upstream LLGo README](https://raw.githubusercontent.com/xgo-dev/llgo/refs/heads/main/README.md). @@ -66,7 +66,7 @@ first. The installer then selects the exact Go 1.27.0 toolchain. ```bash git clone https://github.com/cpunion/setup-llgo.git ../setup-llgo - git -C ../setup-llgo checkout --detach 46658437168f2b817fea2e56c88ecdd61f29cc4f + git -C ../setup-llgo checkout --detach 66efbc5bac45a7810acc79717e8bee5ac62f8e77 LLGO_VERSION=main GO_VERSION=1.27.0 LLVM_VERSION=22 bash ../setup-llgo/scripts/install.sh ```