-
Notifications
You must be signed in to change notification settings - Fork 26
147 lines (123 loc) · 4.61 KB
/
go.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
# 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: Go
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: Check formatting
run: |
if [ -n "$(go fmt ./...)" ]; then
echo "Some files are not properly formatted. Please run 'go fmt ./...'"
exit 1
fi
test:
strategy:
matrix:
os:
- macos-latest
- ubuntu-24.04
llvm: [18]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
if: startsWith(matrix.os, 'macos')
run: |
brew update
brew install llvm@${{matrix.llvm}} pkg-config bdw-gc openssl libffi
echo "$(brew --prefix llvm@${{matrix.llvm}})/bin" >> $GITHUB_PATH
echo "PKG_CONFIG_PATH=/opt/homebrew/opt/libffi/lib/pkgconfig" >> $GITHUB_ENV
# Install optional deps for demos.
#
# NOTE: Keep this list updated as new deps are introduced.
opt_deps=(
cjson # for github.com/goplus/llgo/c/cjson
sqlite # for github.com/goplus/llgo/c/sqlite
[email protected] # for github.com/goplus/llgo/py
)
brew install "${opt_deps[@]}"
- name: Install dependencies
if: startsWith(matrix.os, 'ubuntu')
run: |
echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-${{matrix.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-${{matrix.llvm}}-dev clang-${{matrix.llvm}} libclang-${{matrix.llvm}}-dev lld-${{matrix.llvm}} pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libcjson-dev
echo "/usr/lib/llvm-${{matrix.llvm}}/bin" >> $GITHUB_PATH
# Install optional deps for demos.
#
# NOTE: Keep this list updated as new deps are introduced.
opt_deps=(
libcjson-dev # for github.com/goplus/llgo/c/cjson
libsqlite3-dev # for github.com/goplus/llgo/c/sqlite
python3.12-dev # for github.com/goplus/llgo/py
)
sudo apt-get install -y "${opt_deps[@]}"
- name: Install further optional dependencies for demos
run: |
wget -P ./_demo/llama2-c https://huggingface.co/karpathy/tinyllamas/resolve/main/stories15M.bin
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: Clang information
run: |
echo $PATH
which clang
clang --version
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: Build
run: go build -v ./...
- name: Test
if: ${{!startsWith(matrix.os, 'macos')}}
run: go test -v ./...
- name: Test with coverage
if: startsWith(matrix.os, 'macos')
run: go test -v -coverprofile="coverage.txt" -covermode=atomic ./...
- name: Install
run: go install ./...
- 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: chore/_xtool build tests
run: |
cd chore/_xtool
llgo build -v ./...
- name: LLDB tests
if: ${{startsWith(matrix.os, 'macos')}}
run: |
echo "Test lldb with llgo plugin on ${{matrix.os}} with LLVM ${{matrix.llvm}}"
bash _lldb/runtest.sh -v
- name: Test demos
continue-on-error: true
run: bash .github/workflows/test_demo.sh
- name: Show test result
run: cat result.md
- name: PR comment with test result
uses: thollander/actions-comment-pull-request@v3
if: false
with:
filePath: result.md
comment_tag: test-result-on-${{matrix.os}}-with-llvm-${{matrix.llvm}}
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{secrets.CODECOV_TOKEN}}
slug: goplus/llgo