forked from alibaba/loongcollector
-
Notifications
You must be signed in to change notification settings - Fork 1
150 lines (132 loc) · 5 KB
/
build-linux.yaml
File metadata and controls
150 lines (132 loc) · 5 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
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
# Copyright 2021 iLogtail Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Build Linux
on:
pull_request:
paths-ignore:
- "changes/**"
- "config_server/**"
- "docs/**"
- "example_config/**"
- "k8s_template/**"
- "licenses/**"
- "CHANGELOG.md"
push:
branches:
- main
- 1.*
- 2.*
- 3.*
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
BuildCoreUT:
runs-on: ${{ matrix.runner }}
timeout-minutes: 90
strategy:
matrix:
runner: [arc-runner-set-ilogtail]
fail-fast: true
steps:
- name: Set up Go (pre-installed on runner)
run: |
# Go 已经预安装在 /usr/local/go,确保 PATH 包含 Go 二进制文件路径
echo "GOROOT=/usr/local/go" >> $GITHUB_ENV
echo "PATH=/usr/local/go/bin:$PATH" >> $GITHUB_ENV
# 验证 Go 是否可用
if [ -f "/usr/local/go/bin/go" ]; then
echo "✅ Go 已安装在 /usr/local/go"
/usr/local/go/bin/go version
elif command -v go &> /dev/null; then
echo "✅ Go 已在 PATH 中可用"
go version
else
echo "❌ 错误: Go 未找到"
echo "请确保 Go 已安装在 /usr/local/go 或已添加到 PATH"
exit 1
fi
- name: Check out code
uses: actions/checkout@v4
with:
submodules: false
fetch-depth: 2
- name: Set custom submodule URL and fetch
run: |
SUBMODULE_PATH="core/_thirdparty/coolbpf"
git config submodule.$SUBMODULE_PATH.url "https://github.com/aliyun/coolbpf.git"
git submodule update --init
cd $SUBMODULE_PATH
echo "Current commit: $(git rev-parse HEAD)"
- name: Build Unit Test
env:
BUILD_LOGTAIL: OFF
BUILD_LOGTAIL_UT: ON
ENABLE_COMPATIBLE_MODE: OFF
ENABLE_STATIC_LINK_CRT: ON
WITHOUTGDB: ON
MAKE_JOBS: 16
WITHSPL: ON
BUILD_TYPE: Debug
run: CURRENT_DIR=$(pwd) && sed -i "s|/src|$CURRENT_DIR|g" docker/Dockerfile_build && make core PATH_IN_DOCKER=$(pwd)
- name: Build Coverage Image
run: docker build -t unittest_coverage -f ./docker/Dockerfile_coverage .
- name: Unit Test
run: docker run --privileged -v /sys:/sys -v /:/logtail_host -v $(pwd):$(pwd) unittest_coverage bash -c "cd $(pwd) && MAX_JOBS=16 ./scripts/run_core_ut.sh"
- name: Unit Test Coverage
run: docker run -v $(pwd):$(pwd) unittest_coverage bash -c "cd $(pwd)/core && gcovr --gcov-ignore-parse-errors --merge-mode-functions=separate --gcov-ignore-errors=no_working_dir_found --root . --json coverage.json --json-summary-pretty --json-summary summary.json -e \".*\.pb\.cc\" -e \".*\.pb\.h\" -e \".*unittest.*\" -e \".*sdk.*\" -e \".*logger.*\" -e \".*config_server.*\" -e \".*go_pipeline.*\" -e \".*application.*\" -e \".*runner.*\" -e \".*_thirdparty.*\""
- name: Setup Python3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Report code coverage
run: python3 tools/coverage-diff/main.py --path core/coverage.json --summary core/summary.json
BuildPurePlugin:
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
strategy:
matrix:
runner: [arc-runner-set-ilogtail]
fail-fast: true
steps:
- name: Set up Go (pre-installed on runner)
run: |
# Go 已经预安装在 /usr/local/go,确保 PATH 包含 Go 二进制文件路径
echo "GOROOT=/usr/local/go" >> $GITHUB_ENV
echo "PATH=/usr/local/go/bin:$PATH" >> $GITHUB_ENV
# 验证 Go 是否可用
if [ -f "/usr/local/go/bin/go" ]; then
echo "✅ Go 已安装在 /usr/local/go"
/usr/local/go/bin/go version
elif command -v go &> /dev/null; then
echo "✅ Go 已在 PATH 中可用"
go version
else
echo "❌ 错误: Go 未找到"
echo "请确保 Go 已安装在 /usr/local/go 或已添加到 PATH"
exit 1
fi
- name: Check out code
uses: actions/checkout@v4
with:
submodules: false
- name: Build pure plugin
run: make plugin_main
actions-timeline:
needs: [BuildCoreUT, BuildPurePlugin]
runs-on: ubuntu-latest
permissions:
actions: read
steps:
- uses: Kesin11/actions-timeline@v2