Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions .github/actions/setup-llcppg/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "Setup llcppg"
description: "Install dependencies, set up Go, set up LLGo, install llcppg"
description: "Install dependencies, set up Go, download LLGo release, install llcppg"
inputs:
go:
description: "Go version to install"
Expand All @@ -8,18 +8,12 @@ inputs:
description: "LLVM version to install (e.g. 18)"
default: "19"
llgo:
description: "LLGo git ref or tag"
default: "e4218f90d7926d31c1ffae3965a4e36228d38fd2"
description: "LLGo version to download (e.g. v0.12.0)"
default: "v0.12.0"
runs:
using: "composite"
steps:
- uses: actions/checkout@v4
- name: Checkout LLGo
uses: actions/checkout@v4
with:
repository: 'goplus/llgo'
path: '.llgo'
ref: ${{inputs.llgo}}
- name: Set up Go
uses: actions/setup-go@v4
with:
Expand All @@ -41,15 +35,21 @@ 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 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
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: Install LLGo
- name: Download LLGo release
shell: bash
working-directory: .llgo
run: |
go install -v ./cmd/llgo/...
bash .github/actions/setup-llcppg/download-llgo.sh ${{inputs.llgo}} .llgo
echo "$GITHUB_WORKSPACE/.llgo/bin" >> $GITHUB_PATH
export LLGO_ROOT=$GITHUB_WORKSPACE/.llgo
echo "LLGO_ROOT=$LLGO_ROOT" >> $GITHUB_ENV
- name: Verify LLGo installation
shell: bash
run: |
echo "LLGO_ROOT: $LLGO_ROOT"
llgo version
clang --version
- name: Build
shell: bash
run: go build -v ./...
Expand Down
65 changes: 65 additions & 0 deletions .github/actions/setup-llcppg/download-llgo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash

# Script to download and extract LLGo release
# Usage: ./download-llgo.sh <version> <install_dir>
# Example: ./download-llgo.sh v0.12.0 ./llgo

set -e

VERSION=$1
INSTALL_DIR=$2

if [ -z "$VERSION" ] || [ -z "$INSTALL_DIR" ]; then
echo "Usage: $0 <version> <install_dir>"
echo "Example: $0 v0.12.0 ./llgo"
exit 1
fi

# Detect OS and architecture
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)

# Map architecture names
case $ARCH in
x86_64)
ARCH="amd64"
;;
aarch64|arm64)
ARCH="arm64"
;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac

# Construct download URL
# Format: llgo{version}.{os}-{arch}.tar.gz
# Example: llgo0.12.0.darwin-arm64.tar.gz or llgo0.12.0.linux-amd64.tar.gz
# Remove 'v' prefix from version if present
VERSION_NUMBER="${VERSION#v}"
FILENAME="llgo${VERSION_NUMBER}.${OS}-${ARCH}.tar.gz"
URL="https://github.com/goplus/llgo/releases/download/${VERSION}/${FILENAME}"

echo "Downloading LLGo ${VERSION} for ${OS}-${ARCH}..."
echo "URL: $URL"

# Create install directory
mkdir -p "$INSTALL_DIR"

# Download and extract
curl -L -o "/tmp/${FILENAME}" "$URL"
tar -xzf "/tmp/${FILENAME}" -C "$INSTALL_DIR"
rm "/tmp/${FILENAME}"

echo "LLGo ${VERSION} has been installed to ${INSTALL_DIR}"
echo "Binary location: ${INSTALL_DIR}/bin/llgo"

# Verify installation
if [ -f "${INSTALL_DIR}/bin/llgo" ]; then
echo "Installation verified successfully"
ls -lh "${INSTALL_DIR}/bin/llgo"
else
echo "Error: llgo binary not found at ${INSTALL_DIR}/bin/llgo"
exit 1
fi
Loading