Skip to content

Commit 39489e1

Browse files
xgopilot[bot]xgopilotluoliwoshang
authored
ci: use prebuilt llgo v0.12.0 and keep LLVM for clang (#610)
This commit updates the CI configuration to use prebuilt llgo v0.12.0 releases instead of building from source, while maintaining LLVM dependency for clang access. Changes: - Add download-llgo.sh script to fetch prebuilt llgo releases - Update action.yml to use download script instead of source checkout - Keep LLVM/clang dependency as requested in issue #609 - Remove unnecessary LLVM dev packages (llvm-dev, libclang-dev, lld, etc.) - Retain only clang-19 for compilation needs - Add verification step for llgo and clang installation Benefits: - Faster CI builds (no source compilation) - Simpler dependency management - More reliable with official releases - Reduced complexity while keeping clang access Related: #609, #590 Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: xgopilot <[email protected]> Co-authored-by: luoliwoshang <[email protected]>
1 parent 16f004c commit 39489e1

File tree

2 files changed

+78
-13
lines changed

2 files changed

+78
-13
lines changed

.github/actions/setup-llcppg/action.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: "Setup llcppg"
2-
description: "Install dependencies, set up Go, set up LLGo, install llcppg"
2+
description: "Install dependencies, set up Go, download LLGo release, install llcppg"
33
inputs:
44
go:
55
description: "Go version to install"
@@ -8,18 +8,12 @@ inputs:
88
description: "LLVM version to install (e.g. 18)"
99
default: "19"
1010
llgo:
11-
description: "LLGo git ref or tag"
12-
default: "e4218f90d7926d31c1ffae3965a4e36228d38fd2"
11+
description: "LLGo version to download (e.g. v0.12.0)"
12+
default: "v0.12.0"
1313
runs:
1414
using: "composite"
1515
steps:
1616
- uses: actions/checkout@v4
17-
- name: Checkout LLGo
18-
uses: actions/checkout@v4
19-
with:
20-
repository: 'goplus/llgo'
21-
path: '.llgo'
22-
ref: ${{inputs.llgo}}
2317
- name: Set up Go
2418
uses: actions/setup-go@v4
2519
with:
@@ -41,15 +35,21 @@ runs:
4135
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
4236
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
4337
sudo apt-get update
44-
sudo apt-get install -y llvm-${{inputs.llvm}}-dev clang-${{inputs.llvm}} libclang-${{inputs.llvm}}-dev lld-${{inputs.llvm}} libunwind-${{inputs.llvm}}-dev libc++-${{inputs.llvm}}-dev pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libuv1-dev
38+
sudo apt-get install -y clang-${{inputs.llvm}} pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libuv1-dev
4539
echo "/usr/lib/llvm-${{inputs.llvm}}/bin" >> $GITHUB_PATH
46-
- name: Install LLGo
40+
- name: Download LLGo release
4741
shell: bash
48-
working-directory: .llgo
4942
run: |
50-
go install -v ./cmd/llgo/...
43+
bash .github/actions/setup-llcppg/download-llgo.sh ${{inputs.llgo}} .llgo
44+
echo "$GITHUB_WORKSPACE/.llgo/bin" >> $GITHUB_PATH
5145
export LLGO_ROOT=$GITHUB_WORKSPACE/.llgo
5246
echo "LLGO_ROOT=$LLGO_ROOT" >> $GITHUB_ENV
47+
- name: Verify LLGo installation
48+
shell: bash
49+
run: |
50+
echo "LLGO_ROOT: $LLGO_ROOT"
51+
llgo version
52+
clang --version
5353
- name: Build
5454
shell: bash
5555
run: go build -v ./...
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
3+
# Script to download and extract LLGo release
4+
# Usage: ./download-llgo.sh <version> <install_dir>
5+
# Example: ./download-llgo.sh v0.12.0 ./llgo
6+
7+
set -e
8+
9+
VERSION=$1
10+
INSTALL_DIR=$2
11+
12+
if [ -z "$VERSION" ] || [ -z "$INSTALL_DIR" ]; then
13+
echo "Usage: $0 <version> <install_dir>"
14+
echo "Example: $0 v0.12.0 ./llgo"
15+
exit 1
16+
fi
17+
18+
# Detect OS and architecture
19+
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
20+
ARCH=$(uname -m)
21+
22+
# Map architecture names
23+
case $ARCH in
24+
x86_64)
25+
ARCH="amd64"
26+
;;
27+
aarch64|arm64)
28+
ARCH="arm64"
29+
;;
30+
*)
31+
echo "Unsupported architecture: $ARCH"
32+
exit 1
33+
;;
34+
esac
35+
36+
# Construct download URL
37+
# Format: llgo{version}.{os}-{arch}.tar.gz
38+
# Example: llgo0.12.0.darwin-arm64.tar.gz or llgo0.12.0.linux-amd64.tar.gz
39+
# Remove 'v' prefix from version if present
40+
VERSION_NUMBER="${VERSION#v}"
41+
FILENAME="llgo${VERSION_NUMBER}.${OS}-${ARCH}.tar.gz"
42+
URL="https://github.com/goplus/llgo/releases/download/${VERSION}/${FILENAME}"
43+
44+
echo "Downloading LLGo ${VERSION} for ${OS}-${ARCH}..."
45+
echo "URL: $URL"
46+
47+
# Create install directory
48+
mkdir -p "$INSTALL_DIR"
49+
50+
# Download and extract
51+
curl -L -o "/tmp/${FILENAME}" "$URL"
52+
tar -xzf "/tmp/${FILENAME}" -C "$INSTALL_DIR"
53+
rm "/tmp/${FILENAME}"
54+
55+
echo "LLGo ${VERSION} has been installed to ${INSTALL_DIR}"
56+
echo "Binary location: ${INSTALL_DIR}/bin/llgo"
57+
58+
# Verify installation
59+
if [ -f "${INSTALL_DIR}/bin/llgo" ]; then
60+
echo "Installation verified successfully"
61+
ls -lh "${INSTALL_DIR}/bin/llgo"
62+
else
63+
echo "Error: llgo binary not found at ${INSTALL_DIR}/bin/llgo"
64+
exit 1
65+
fi

0 commit comments

Comments
 (0)