-
Notifications
You must be signed in to change notification settings - Fork 26
92 lines (76 loc) · 2.9 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
# 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: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
test:
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
llvm: [17]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Update Homebrew
# needed as long as LLVM 17 is still fresh
if: matrix.llvm == 17 && startsWith(matrix.os, 'macos')
run: brew update
- name: Install LLVM ${{ matrix.llvm }} and bdw-gc
if: startsWith(matrix.os, 'macos')
run: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install llvm@${{ matrix.llvm }} bdw-gc
echo `brew --prefix llvm@${{ matrix.llvm }}`/bin >> $GITHUB_PATH
- name: Install LLVM ${{ matrix.llvm }} and libgc-dev
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 }} lld-${{ matrix.llvm }} pkg-config libgc-dev libcjson-dev libsqlite3-dev python3.11-dev
echo /usr/lib/llvm-${{ matrix.llvm }}/bin >> $GITHUB_PATH
- 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: matrix.os != 'macos-latest'
run: go test -v ./...
- name: Test with coverage
if: matrix.os == 'macos-latest'
run: go test -v -coverprofile="coverage.txt" -covermode=atomic ./...
- name: Install
run: go install ./...
- name: LLGO tests
if: matrix.os != 'ubuntu-latest'
run: |
echo "Test result on ${{ matrix.os }} with LLVM ${{ matrix.llvm }}" > result.md
LLGOROOT=$PWD bash .github/workflows/test_llgo.sh
- name: Test _demo and _pydemo
run: |
set +e
LLGOROOT=$PWD bash .github/workflows/test_demo.sh
exit 0
- name: Show test result
run: cat result.md
- name: PR comment with test result
uses: thollander/actions-comment-pull-request@v2
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