-
Notifications
You must be signed in to change notification settings - Fork 320
244 lines (213 loc) · 6.83 KB
/
cicd.yaml
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
237
238
239
240
241
242
243
244
# OpenMLDB core cpp jobs
name: cicd
on:
push:
branches:
- main
paths-ignore:
- 'docs/**'
- 'demo/**'
- 'docker/**'
- 'image/**'
- 'release/**'
- 'tools/**'
- '*.md'
- 'benchmark/**'
tags:
- v*
pull_request:
paths-ignore:
- 'docs/**'
- 'demo/**'
- 'docker/**'
- 'image/**'
- 'release/**'
- 'tools/**'
- '*.md'
- 'benchmark/**'
workflow_dispatch:
env:
GIT_SUBMODULE_STRATEGY: recursive
NPROC: 2 # default Parallel build number for GitHub's Linux runner
EXAMPLES_ENABLE: OFF # turn off hybridse's example code
HYBRIDSE_TESTING_ENABLE: OFF # turn off hybridse's test code
jobs:
cpp:
runs-on: [self-hosted,generic]
if: github.repository == '4paradigm/OpenMLDB'
container:
image: ghcr.io/4paradigm/hybridsql:latest
env:
OS: linux
SQL_PYSDK_ENABLE: OFF
TESTING_ENABLE: ON
NPROC: 8
CTEST_PARALLEL_LEVEL: 1 # parallel test level for ctest (make test)
steps:
- uses: actions/checkout@v2
- name: prepare release
run: |
VERSION="snapshot"
if [[ ${{ github.ref }} == "refs/tags/v"* ]]; then
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
VERSION=${VERSION#v}
bash steps/prepare_release.sh "$VERSION"
fi
echo "OPENMLDB_PREFIX=openmldb-$VERSION-linux" >> $GITHUB_ENV
- name: enable java on release
if: github.event_name == 'push'
run: |
echo "SQL_JAVASDK_ENABLE=ON" >> $GITHUB_ENV
- name: configure
env:
SQL_JAVASDK_ENABLE: ${{ env.SQL_JAVASDK_ENABLE }}
run: |
make configure CMAKE_INSTALL_PREFIX=${{ env.OPENMLDB_PREFIX }}
- name: build
run: |
make build
# GitHub runner disk space is limited
# delete thirdparty build directory($ROOT/.deps/) to save disk space
# make thirdpartybuild-clean
- name: run cpp
id: unittest
run: |
make test
- name: run sql_router_test
id: sql_router_test
run: |
bash steps/ut.sh sql_router_test 0
- name: run sql_sdk_test
id: sql_sdk_test
run: |
bash steps/ut.sh sql_sdk_test 0
- name: run sql_cluster_test
id: sql_cluster_test
run: |
bash steps/ut.sh sql_cluster_test 0
- name: run sql_standalone_sdk_test
id: sql_standalone_sdk_test
run: |
bash steps/ut.sh sql_standalone_sdk_test 0
- name: upload unit test results
if: always()
uses: actions/upload-artifact@v2
with:
name: linux-ut-result-cpp-${{ github.sha }}
# exclude _deps xml
path: |
build/**/*.xml
reports/*.xml
!build/_deps/*
- name: install
if: ${{ github.event_name == 'push' }}
run: |
make install
- name: package
if: ${{ github.event_name == 'push' }}
run: |
tar czf ${{ env.OPENMLDB_PREFIX }}.tar.gz ${{ env.OPENMLDB_PREFIX }}/
- name: upload artifacts
if: ${{ github.event_name == 'push' }}
uses: actions/upload-artifact@v2
with:
path: openmldb-*.tar.gz
name: release-artifacts
publish-test-results:
needs: [ "cpp" ]
# the action will only run on 4paradigm/OpenMLDB's context, not for fork repo or dependabot
if: >
always() && github.event_name == 'push' || (
github.event.pull_request.head.repo.full_name == github.repository &&
github.event.sender.login != 'dependabot[bot]' )
name: Publish Linux UT Results
uses: ./.github/workflows/publish-test-results-action.yml
with:
files: linux-ut-result-*/**/*.xml
check_name: Linux Test Report
comment_title: Linux Test Report
macos-cpp:
runs-on: macos-12
if: github.repository == '4paradigm/OpenMLDB'
env:
OS: darwin
ARCH: x86_64
NPROC: 3
CTEST_PARALLEL_LEVEL: 1 # parallel test level for ctest (make test)
steps:
- uses: actions/checkout@v4
# target on macOS >= 12.0
- name: Xcode Select Version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '14.0.1'
- name: prepare release
run: |
VERSION="snapshot"
if [[ ${{ github.ref }} == "refs/tags/v"* ]]; then
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
VERSION=${VERSION#v}
bash steps/prepare_release.sh "$VERSION"
fi
echo "OPENMLDB_PREFIX=openmldb-$VERSION-darwin" >> $GITHUB_ENV
- name: enable java on release
if: ${{ github.event_name == 'push' }}
run: |
echo "SQL_JAVASDK_ENABLE=ON" >> $GITHUB_ENV
- name: configure
env:
SQL_JAVASDK_ENABLE: ${{ env.SQL_JAVASDK_ENABLE }}
run: |
make configure CMAKE_INSTALL_PREFIX=${{ env.OPENMLDB_PREFIX }}
- name: build
run: |
# even gnu binutils support ar -M script, get error `ar: BFD (GNU Binutils) 2.40 assertion fail archive.c:1813`
# brew install binutils
# export PATH="/usr/local/opt/binutils/bin:$PATH"
make build
# GitHub runner disk space is limited
# delete thirdparty build directory($ROOT/.deps/) to save disk space
# make thirdpartybuild-clean
- name: install
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
run: |
make install
- name: package
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
run: |
tar czf ${{ env.OPENMLDB_PREFIX }}.tar.gz ${{ env.OPENMLDB_PREFIX }}/
- name: upload artifacts
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
uses: actions/upload-artifact@v3
with:
path: openmldb-*.tar.gz
name: release-artifacts
- name: Upload Event File
if: always()
uses: actions/upload-artifact@v3
with:
name: event-file
path: ${{ github.event_path }}
release:
runs-on: ubuntu-latest
# if test failed, shouldn't release
needs: [ "cpp", "macos-cpp" ]
if: >
success() && startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download Release Artifacts
uses: actions/download-artifact@v3
with:
name: release-artifacts
- name: generate signature
run: |
sha256sum openmldb-*.tar.gz > SHA256SUM
- name: Release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: softprops/action-gh-release@v1
with:
files: |
openmldb-*.tar.gz
SHA256SUM
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}