Files
llgo/.github/actions/setup-deps/action.yml
luoliwoshang e11ae0e21b test: add comprehensive tests and CI for export feature
Add extensive test coverage, demo program, and CI integration for
//export with different names feature:

Unit Tests (cl/builtin_test.go):
- TestHandleExportDiffName: core functionality with 4 scenarios
  * Different names with enableExportRename
  * Same names with enableExportRename
  * Different names with spaces in export directive
  * Matching names without enableExportRename
- TestInitLinknameByDocExportDiffNames: flag behavior verification
  * Export with different names when enabled
  * Export with same name when enabled
  * Normal linkname directives
- TestInitLinkExportDiffNames: edge case handling
  * Symbol not found in decl packages (silent handling)

Demo (_demo/embed/export/):
- Example program demonstrating various export patterns
- Verification script testing both embedded and non-embedded targets
- Documents expected behavior and error cases

CI Integration (.github/workflows/llgo.yml):
- Add export demo to embedded target tests
- Ensure feature works correctly across platforms
- Catch regressions in future changes

The tests verify:
✓ Different names work with -target flag
✓ Same names work in all cases
✓ Different names fail without -target flag
✓ Proper error messages for invalid exports
✓ Silent handling for decl packages

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 18:52:58 +08:00

75 lines
2.8 KiB
YAML

name: "Setup LLGO Dependencies"
description: "Install all required dependencies for LLGO"
inputs:
llvm-version:
description: "LLVM version to install"
required: true
default: "19"
install-llvm:
description: "Whether to install LLVM"
required: false
default: "true"
runs:
using: "composite"
steps:
- name: Install macOS dependencies
if: runner.os == 'macOS'
shell: bash
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
run: |
brew update
# Install LLVM if requested
if [[ "${{ inputs.install-llvm }}" == "true" ]]; then
brew install llvm@${{inputs.llvm-version}} lld@${{inputs.llvm-version}}
brew link --overwrite llvm@${{inputs.llvm-version}} lld@${{inputs.llvm-version}}
echo "$(brew --prefix llvm@${{inputs.llvm-version}})/bin" >> $GITHUB_PATH
fi
# Install common dependencies
brew install bdw-gc openssl libffi libuv
brew link --overwrite libffi
# Install optional deps for demos.
#
# NOTE: Keep this list updated as new deps are introduced.
opt_deps=(
cjson # for github.com/goplus/lib/c/cjson
sqlite # for github.com/goplus/lib/c/sqlite
)
brew install "${opt_deps[@]}"
brew install python@3.12 || true # for github.com/goplus/lib/py
brew link --overwrite python@3.12
- name: Install Ubuntu dependencies
if: runner.os == 'Linux'
shell: bash
run: |
# Install LLVM if requested
if [[ "${{ inputs.install-llvm }}" == "true" ]]; then
echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-${{inputs.llvm-version}} 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-version}}-dev clang-${{inputs.llvm-version}} libclang-${{inputs.llvm-version}}-dev lld-${{inputs.llvm-version}} libunwind-${{inputs.llvm-version}}-dev libc++-${{inputs.llvm-version}}-dev
echo "PATH=/usr/lib/llvm-${{inputs.llvm-version}}/bin:$PATH" >> $GITHUB_ENV
else
sudo apt-get update
fi
# Install common dependencies
sudo apt-get install -y pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libcjson-dev libuv1-dev
# Install optional deps for demos.
#
# NOTE: Keep this list updated as new deps are introduced.
opt_deps=(
libcjson-dev # for github.com/goplus/lib/c/cjson
libsqlite3-dev # for github.com/goplus/lib/c/sqlite
python3.12-dev # for github.com/goplus/lib/py
)
sudo apt-get install -y "${opt_deps[@]}"