forked from oceanbase/odc
-
Notifications
You must be signed in to change notification settings - Fork 0
194 lines (187 loc) · 6.08 KB
/
build_dev.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
###
# This workflow is used for daily development
# Triggers:
# 1. Push
# 2. Pull-Request
# Jobs:
# 1. Check Code Format
# 2. PMD Scan
# 3. Unit Test (TODO)
# 4. Calculate Version Number
# 5. Build RPM (exclude front resources and only x86_64 platform for now)
# (Job 4 and 5 are executed only when Pull-Request)
###
name: Build Dev
run-name: ${{ github.event_name }} triggered by ${{ github.actor }} 🚀
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
jobs:
check-format:
name: Check Code Format
runs-on: ubuntu-latest
steps:
- name: Checkout workspace
uses: actions/checkout@v3
- name: Setup JDK 8
uses: actions/setup-java@v3
with:
java-version: "8"
distribution: "temurin"
cache: maven
- name: Check code format
run: mvn impsort:check formatter:validate
- name: Check license
run: mvn license:check
pmd-scan:
name: PMD Scan
runs-on: ubuntu-latest
steps:
- name: Checkout workspace
uses: actions/checkout@v3
- name: Setup JDK 8
uses: actions/setup-java@v3
with:
java-version: "8"
distribution: "temurin"
cache: maven
- name: Install db-browser
run: |
echo "Start install db-browser"
pushd libs/db-browser
echo "Current dir is "`pwd`
mvn clean install -Dmaven.test.skip=true
echo "Install db-browser success"
popd
- name: Install ob-sql-parser
run: |
echo "Start install ob-sql-parser"
pushd libs/ob-sql-parser
echo "Current dir is "`pwd`
mvn clean install -Dmaven.test.skip=true
echo "Install ob-sql-parser success"
popd
- name: Build project
run: mvn clean install -Dmaven.test.skip=true
- name: Run PMD scan
run: mvn pmd:check
unit-test:
name: Unit Test (Skip for now)
needs: [ check-format, pmd-scan ]
runs-on: ubuntu-latest
steps:
- name: Checkout workspace
uses: actions/checkout@v3
- name: Setup JDK 8
uses: actions/setup-java@v3
with:
java-version: "8"
distribution: "temurin"
cache: maven
- name: Install db-browser
run: |
echo "Start install db-browser"
pushd libs/db-browser
echo "Current dir is "`pwd`
mvn clean install -Dmaven.test.skip=true
echo "Install db-browser success"
popd
- name: Install ob-sql-parser
run: |
echo "Start install ob-sql-parser"
pushd libs/ob-sql-parser
echo "Current dir is "`pwd`
mvn clean install -Dmaven.test.skip=true
echo "Install ob-sql-parser success"
popd
- name: Run unit test
run: echo "Skip for now 🤪"
calculate-version:
name: Calculate Version Number
needs: [ unit-test ]
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
outputs:
odc_rpm_release_number: ${{ steps.calculate_version.outputs.odc_rpm_release_number }}
steps:
- name: Checkout workspace
uses: actions/checkout@v3
- name: Calculate version number
id: calculate_version
run: |
odc_rpm_release_number=$(date +%Y%m%d%H%M%S)
echo "odc_rpm_release_number=${odc_rpm_release_number}" >> $GITHUB_OUTPUT
echo "odc_rpm_release_number=${odc_rpm_release_number}"
build-rpm-x86_64:
name: Build RPM (x86_64)
needs: [ calculate-version ]
runs-on: ubuntu-latest
env:
odc_rpm_release_number: ${{ needs.calculate-version.outputs.odc_rpm_release_number }}
steps:
- name: Checkout workspace
uses: actions/checkout@v3
with:
submodules: "recursive"
- name: Setup JDK 8
uses: actions/setup-java@v3
with:
java-version: "8"
distribution: "temurin"
cache: maven
- name: Setup node 16
uses: actions/setup-node@v3
with:
node-version: "16"
- name: Set release version
id: set_release_version
run: |
main_version="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | cut -d - -f 1)"
new_version="${main_version}-${odc_rpm_release_number}"
echo "new_version=${new_version}" >> $GITHUB_OUTPUT
echo "RPM's version is "${new_version}
mvn versions:set -DnewVersion="${new_version}"
mvn versions:commit
- name: Install db-browser
run: |
echo "Start install db-browser"
pushd libs/db-browser
echo "Current dir is "`pwd`
mvn clean install -Dmaven.test.skip=true
echo "Install db-browser success"
popd
- name: Install ob-sql-parser
run: |
echo "Start install ob-sql-parser"
pushd libs/ob-sql-parser
echo "Current dir is "`pwd`
mvn clean install -Dmaven.test.skip=true
echo "Install ob-sql-parser success"
popd
- name: Build jar & rpm (x86_64)
run: |
echo "Start prepare oceanbase-client"
pushd import
echo "Current dir is "`pwd`
rm -rf obclient_aarch.tar.gz
rm -rf obclient_win.tar.gz
mv obclient_x86.tar.gz obclient.tar.gz
popd
echo "Prepare oceanbase-client success"
echo "Start build rpm package"
mvn help:system
mvn clean install -Dmaven.test.skip=true
mvn --file server/odc-server/pom.xml rpm:rpm -Drpm.prefix=/opt
echo "Build rpm package success"
rm --force --recursive --verbose distribution/docker/resources/odc-*.rpm
mkdir -p distribution/docker/resources/
mv --verbose server/odc-server/target/rpm/odc-server/RPMS/*/odc-*.rpm distribution/docker/resources/
- name: Upload rpm (x86_64)
uses: actions/upload-artifact@v3
with:
name: odc-server-${{ steps.set_release_version.outputs.new_version }}.x86_64.rpm
path: distribution/docker/resources/odc-*.rpm