-
Notifications
You must be signed in to change notification settings - Fork 37
236 lines (207 loc) · 7.13 KB
/
llgo.yml
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: LLGo
on:
push:
branches: [ "**" ]
pull_request:
branches: [ "**" ]
jobs:
download-model:
runs-on: ubuntu-latest
steps:
- name: Download model file
run: |
mkdir -p ./_demo/llama2-c
wget -P ./_demo/llama2-c https://huggingface.co/karpathy/tinyllamas/resolve/main/stories15M.bin
- name: Upload model as artifact
uses: actions/upload-artifact@v4
with:
name: llama2-model
path: ./_demo/llama2-c/stories15M.bin
retention-days: 1
llgo:
needs: download-model
continue-on-error: true
strategy:
matrix:
os:
- macos-latest
- ubuntu-24.04
llvm: [18]
go: ['1.20.14', '1.21.13', '1.22.12', '1.23.6', '1.24.0']
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup-deps
with:
llvm-version: ${{matrix.llvm}}
- name: Download model artifact
uses: actions/download-artifact@v4
with:
name: llama2-model
path: ./_demo/llama2-c/
- name: Install further optional dependencies for demos
run: |
py_deps=(
numpy # for github.com/goplus/llgo/py/numpy
torch # for github.com/goplus/llgo/py/torch
)
pip3.12 install --break-system-packages "${py_deps[@]}"
- name: Set up Go for build
uses: ./.github/actions/setup-go
with:
go-version: '1.24.0'
- name: Install
working-directory: compiler
run: |
go install ./...
echo "LLGO_ROOT=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Set up Go for testing
uses: actions/setup-go@v5
with:
go-version: ${{matrix.go}}
- name: Verify Go version
run: |
go_version=$(go version | cut -d' ' -f3 | sed 's/go//')
if [[ "$go_version" != "${{matrix.go}}"* ]]; then
echo "Expected Go version ${{matrix.go}}, but got $go_version"
exit 1
fi
echo "Using Go version: $go_version"
- name: _xtool build tests
run: |
cd _xtool
llgo build -v ./...
- name: LLGO tests
if: ${{!startsWith(matrix.os, 'ubuntu')}}
run: |
echo "Test result on ${{matrix.os}} with LLVM ${{matrix.llvm}}" > result.md
bash ./.github/workflows/test_llgo.sh
- name: Test demos
run: |
# TODO(lijie): force python3-embed to be linked with python-3.12-embed
# Currently, python3-embed is python-3.13-embed, doesn't work with pytorch
# Will remove this after pytorch is fixed.
pcdir=$HOME/pc
mkdir -p $pcdir
libdir=$(pkg-config --variable=libdir python-3.12-embed)
echo "libdir: $libdir"
ln -s $libdir/pkgconfig/python-3.12-embed.pc $pcdir/python3-embed.pc
export PKG_CONFIG_PATH=$pcdir
bash .github/workflows/test_demo.sh
- name: Show test result
run: cat result.md
- name: LLDB tests
if: ${{startsWith(matrix.os, 'macos')}}
working-directory: compiler
run: |
echo "Test lldb with llgo plugin on ${{matrix.os}} with LLVM ${{matrix.llvm}}"
bash _lldb/runtest.sh -v
test:
continue-on-error: true
strategy:
matrix:
os:
- macos-latest
- ubuntu-24.04
llvm: [18]
go: ['1.24.0']
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup-deps
with:
llvm-version: ${{matrix.llvm}}
- name: Install further optional dependencies for demos
run: |
py_deps=(
numpy # for github.com/goplus/llgo/py/numpy
torch # for github.com/goplus/llgo/py/torch
)
pip3.12 install --break-system-packages "${py_deps[@]}"
- name: Set up Go for build
uses: ./.github/actions/setup-go
with:
go-version: '1.24.0'
- name: Install
working-directory: compiler
run: |
go install ./...
echo "LLGO_ROOT=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Set up Go for testing
uses: actions/setup-go@v5
with:
go-version: ${{matrix.go}}
- name: Verify Go version
run: |
go_version=$(go version | cut -d' ' -f3 | sed 's/go//')
if [[ "$go_version" != "${{matrix.go}}"* ]]; then
echo "Expected Go version ${{matrix.go}}, but got $go_version"
exit 1
fi
echo "Using Go version: $go_version"
- name: run llgo test
run: |
llgo test ./...
cd _demo
llgo test -v ./runtest
hello:
continue-on-error: true
strategy:
matrix:
os: [ubuntu-24.04, macos-latest]
llvm: [18]
go: ['1.20.14', '1.21.13', '1.22.12', '1.23.6', '1.24.0']
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup-deps
with:
llvm-version: ${{matrix.llvm}}
- name: Set up Go 1.23 for building llgo
uses: ./.github/actions/setup-go
with:
go-version: '1.24.0'
- name: Install llgo
working-directory: compiler
run: |
go install ./...
echo "LLGO_ROOT=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Set up Go for testing
uses: ./.github/actions/setup-go
with:
go-version: ${{matrix.go}}
- name: Test Hello World with go.mod 1.20
if: startsWith(matrix.go, '1.20') || startsWith(matrix.go, '1.21') || startsWith(matrix.go, '1.22') || startsWith(matrix.go, '1.23') || startsWith(matrix.go, '1.24')
uses: ./.github/actions/test-helloworld
with:
go-version: ${{matrix.go}}
mod-version: '1.20'
- name: Test Hello World with go.mod 1.21
if: startsWith(matrix.go, '1.21') || startsWith(matrix.go, '1.22') || startsWith(matrix.go, '1.23') || startsWith(matrix.go, '1.24')
uses: ./.github/actions/test-helloworld
with:
go-version: ${{matrix.go}}
mod-version: '1.21'
- name: Test Hello World with go.mod 1.22
if: startsWith(matrix.go, '1.22') || startsWith(matrix.go, '1.23') || startsWith(matrix.go, '1.24')
uses: ./.github/actions/test-helloworld
with:
go-version: ${{matrix.go}}
mod-version: '1.22'
- name: Test Hello World with go.mod 1.23
if: startsWith(matrix.go, '1.23') || startsWith(matrix.go, '1.24')
uses: ./.github/actions/test-helloworld
with:
go-version: ${{matrix.go}}
mod-version: '1.23'
- name: Test Hello World with go.mod 1.24
if: startsWith(matrix.go, '1.24')
uses: ./.github/actions/test-helloworld
with:
go-version: ${{matrix.go}}
mod-version: '1.24'