-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathaction.yml
More file actions
99 lines (88 loc) · 3.9 KB
/
Copy pathaction.yml
File metadata and controls
99 lines (88 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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
llvm_formula="llvm@${{inputs.llvm-version}}"
lld_formula="lld@${{inputs.llvm-version}}"
# GitHub macOS runners may pre-link another LLVM/LLD version (for example llvm@18),
# which makes lld@<target> fail during Homebrew's automatic link step.
while IFS= read -r formula; do
case "${formula}" in
llvm|llvm@*|lld|lld@*)
if [[ "${formula}" != "${llvm_formula}" && "${formula}" != "${lld_formula}" ]]; then
brew unlink "${formula}" || true
fi
;;
esac
done < <(brew list --formula)
brew install "${llvm_formula}" "${lld_formula}"
brew link --force --overwrite "${llvm_formula}" "${lld_formula}"
llvm_bin="$(brew --prefix "${llvm_formula}")/bin"
lld_bin="$(brew --prefix "${lld_formula}")/bin"
echo "${llvm_bin}" >> "$GITHUB_PATH"
# Print resolved toolchain versions for CI diagnostics.
echo "LLVM/LLD versions:"
brew list --versions "${llvm_formula}" "${lld_formula}"
clang_version="$("${llvm_bin}/clang" --version | head -n 1)"
lld_version="$("${lld_bin}/ld.lld" --version | head -n 1)"
echo "clang: ${clang_version}"
echo "ld.lld: ${lld_version}"
echo "linked ld.lld path: $(command -v ld.lld || true)"
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[@]}"