-
Notifications
You must be signed in to change notification settings - Fork 55
208 lines (196 loc) · 7.41 KB
/
build_release.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
###
# This workflow is used for release
# Triggers:
# 1. Manual trigger
# Jobs:
# 1. Check Code Format
# 2. PMD Scan
# 3. Calculate Version Number
# 4. Build Web Artifact
# 5. Build Client Artifact
# 6. Release (TODO)
# 7. Tag (TODO)
###
name: Build Release
run-name: Build Release triggered by ${{ github.actor }} 🎉
on:
workflow_dispatch:
inputs:
rpm_release:
description: "Rpm release number"
required: false
default: ''
type: string
image_tag:
description: "Docker image tag"
required: false
default: ''
type: string
env:
ODC_CURRENT_BRANCH: ${{ github.ref_name }}
ODC_TARGET_BRANCH: ${{ github.base_ref }}
jobs:
check-format:
name: Check Code Format
runs-on: ubuntu-latest
steps:
- name: Checkout workspace
uses: actions/checkout@v4
- name: Setup JDK 8
uses: actions/setup-java@v4
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@v4
- name: Setup JDK 8
uses: actions/setup-java@v4
with:
java-version: "8"
distribution: "temurin"
cache: maven
- name: Install pty4j
run: |
echo "Start install pty4j"
pushd import
echo "Current dir is "`pwd`
mvn install:install-file -Dfile=./pty4j-0.11.4.jar -DgroupId=org.jetbrains.pty4j -DartifactId=pty4j -Dversion=0.11.4 -Dpackaging=jar
echo "Install pty4j success"
popd
- name: Install purejavacomm
run: |
echo "Start install purejavacomm"
pushd import
echo "Current dir is "`pwd`
mvn install:install-file -Dfile=./purejavacomm-0.0.11.1.jar -DgroupId=org.jetbrains.pty4j -DartifactId=purejavacomm -Dversion=0.0.11.1 -Dpackaging=jar
echo "Install purejavacomm success"
popd
- name: Build project
run: mvn clean install -Dmaven.test.skip=true
- name: Run PMD scan
run: mvn pmd:check
calculate-version:
name: Calculate Version Number
needs: [ check-format, pmd-scan ]
runs-on: ubuntu-latest
outputs:
odc_rpm_release_number: ${{ steps.calculate_version.outputs.odc_rpm_release_number }}
odc_docker_image_tag: ${{ steps.calculate_version.outputs.odc_docker_image_tag }}
steps:
- name: Checkout workspace
uses: actions/checkout@v4
- name: Calculate version number
id: calculate_version
run: |
odc_rpm_release_number=$(date +%Y%m%d)
if [[ -n "${{ inputs.rpm_release }}" ]]; then odc_rpm_release_number="${{ inputs.rpm_release }}"; fi
echo "odc_rpm_release_number=${odc_rpm_release_number}" >> $GITHUB_OUTPUT
echo "odc_rpm_release_number=${odc_rpm_release_number}"
branch_match_regex="^(((dev/)?[0-9]\\.[0-9]\\.([0-9]{1,2}|x))|(release\\S*))$"
tag_prefix=`[[ "${{ env.ODC_CURRENT_BRANCH }}" =~ ${branch_match_regex} ]] && echo "" || echo "test-"`
odc_docker_image_tag="${tag_prefix}$(cat distribution/odc-server-VER.txt)"
if [[ -n "${{ inputs.image_tag }}" ]]; then odc_docker_image_tag="${{ inputs.image_tag }}"; fi
echo "odc_docker_image_tag=${odc_docker_image_tag}" >> $GITHUB_OUTPUT
echo "odc_docker_image_tag=${odc_docker_image_tag}"
build-web-arm64:
name: Build Web Artifact (ARM64)
needs: [ calculate-version ]
runs-on: ubuntu-latest
env:
odc_rpm_release_number: ${{ needs.calculate-version.outputs.odc_rpm_release_number }}
odc_docker_image_tag: ${{ needs.calculate-version.outputs.odc_docker_image_tag }}
steps:
- name: Checkout workspace
uses: actions/checkout@v4
- name: Setup JDK 8
uses: actions/setup-java@v4
with:
java-version: "8"
distribution: "temurin"
cache: maven
- name: action by obfarm++odc_build_arm++BUILD_DOCKER_IMAGE=1;BUILD_RPM=1;BUILD_RPM_VERSION=${{ inputs.rpm_release }};BUILD_DOCKER_TAG=${{ env.odc_docker_image_tag }}
uses: ./.github/obfarm/
id: build-web-arm64
with:
pipeline_id: ${{ github.run_id }}
project: ${{ github.repository }}
- name: Echo Build Result
run: |
main_version="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | cut -d - -f 1)"
new_version="${main_version}-${odc_rpm_release_number}"
echo "::notice ::BUILD RPM DOWNLOAD URL https://farm-use-for-odc.obs.cn-east-3.myhuaweicloud.com/odc-rpm/$GITHUB_RUN_ID/odc-server-${new_version}.aarch64.rpm"
echo "::notice ::BUILD DOCKER IMAGE DOWNLOAD URL https://farm-use-for-odc.obs.cn-east-3.myhuaweicloud.com/odc-image/$GITHUB_RUN_ID/odc-${{ env.odc_docker_image_tag }}-arm64.tar.gz"
build-web-x86_64:
name: Build Web Artifact Release(AMD64)
needs: [ calculate-version ]
runs-on: ubuntu-latest
env:
odc_rpm_release_number: ${{ needs.calculate-version.outputs.odc_rpm_release_number }}
odc_docker_image_tag: ${{ needs.calculate-version.outputs.odc_docker_image_tag }}
steps:
- name: Checkout workspace
uses: actions/checkout@v4
- name: action by obfarm++odc_build_amd++BUILD_DOCKER_IMAGE=1;BUILD_RPM=1;BUILD_RPM_VERSION=${{ inputs.rpm_release }};BUILD_DOCKER_TAG=${{ env.odc_docker_image_tag }}
uses: ./.github/obfarm/
id: build-web-arm64
with:
pipeline_id: ${{ github.run_id }}
project: ${{ github.repository }}
jobname: odc_build_amd
build-web-arm:
name: Build Web Artifact Release(ARM64)
needs: [ calculate-version ]
runs-on: ubuntu-latest
env:
odc_rpm_release_number: ${{ needs.calculate-version.outputs.odc_rpm_release_number }}
odc_docker_image_tag: ${{ needs.calculate-version.outputs.odc_docker_image_tag }}
steps:
- name: Checkout workspace
uses: actions/checkout@v4
- name: action by obfarm++odc_build_arm++BUILD_DOCKER_IMAGE=1;BUILD_RPM=1;BUILD_RPM_VERSION=${{ inputs.rpm_release }};BUILD_DOCKER_TAG=${{ env.odc_docker_image_tag }}
uses: ./.github/obfarm/
id: build-web-arm64
with:
pipeline_id: ${{ github.run_id }}
project: ${{ github.repository }}
jobname: odc_build_arm
build-client:
name: Build Client Artifact
needs: [ calculate-version ]
runs-on: ubuntu-latest
env:
odc_rpm_release_number: ${{ needs.calculate-version.outputs.odc_rpm_release_number }}
odc_docker_image_tag: ${{ needs.calculate-version.outputs.odc_docker_image_tag }}
steps:
- name: Checkout workspace
uses: actions/checkout@v4
- name: action by obfarm++odc_build_client
uses: ./.github/obfarm/
id: build-client
with:
pipeline_id: ${{ github.run_id }}
project: ${{ github.repository }}
jobname: odc_build_client
release:
name: Release (Skip for now)
needs: [ build-client ]
runs-on: ubuntu-latest
steps:
- name: Release artifacts
run: echo "Skip for now 🤪"
tag:
name: Tag (Skip for now)
needs: [ release ]
runs-on: ubuntu-latest
steps:
- name: Tag release
run: echo "Skip for now 🤪"