-
Notifications
You must be signed in to change notification settings - Fork 64
185 lines (181 loc) · 6.62 KB
/
main.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
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
name: main
on: [pull_request, push]
jobs:
pre-process:
name: Pre process
runs-on: ubuntu-latest
outputs:
were-only-docs-updated: ${{ steps.were-only-docs-updated-action.outputs.were-only-docs-updated }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get commit range
id: get-commit-range-action
uses: ./.github/actions/get-commit-range-action
- name: Were only docs updated
id: were-only-docs-updated-action
uses: ./.github/actions/were-only-docs-updated-action
with:
commit-range: ${{ steps.get-commit-range-action.outputs.commit-range }}
check-header:
name: Check Header
runs-on: ubuntu-latest
needs: pre-process
if: needs.pre-process.outputs.were-only-docs-updated != 'yes'
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 2.
- name: Get commit range
id: get-commit-range-action
uses: ./.github/actions/get-commit-range-action
- name: Check header
run: |
git clone --branch=devops https://github.com/vmware/singleton.git devops
cp $GITHUB_WORKSPACE/devops/check_headers.py .
chmod +x check_headers.py
git diff ${{ steps.get-commit-range-action.outputs.commit-range }} --stat
git diff --name-only --diff-filter=d ${{ steps.get-commit-range-action.outputs.commit-range }}
python ./check_headers.py -f "$(git diff --name-only --diff-filter=d ${{ steps.get-commit-range-action.outputs.commit-range }})"
unit-test:
name: Unit Test
runs-on: ubuntu-latest
needs: pre-process
if: needs.pre-process.outputs.were-only-docs-updated != 'yes'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
- name: Unit test
run: |
cd $GITHUB_WORKSPACE/g11n-ws
./gradlew test jacocoTestReport
- name: Upload Codecov report for vip-manager-i18n
uses: codecov/codecov-action@v2
with:
files: ./g11n-ws/vip-manager-i18n/build/reports/jacoco.xml
flags: vip-manager-i18n
- name: Upload Codecov report for vip-manager-l10n
uses: codecov/codecov-action@v2
with:
files: ./g11n-ws/vip-manager-l10n/build/reports/jacoco.xml
flags: vip-manager-l10n
- name: Upload Codecov report for vip-manager-lite-i18n
uses: codecov/codecov-action@v2
with:
files: ./g11n-ws/vip-manager-lite-i18n/build/reports/jacoco.xml
flags: vip-manager-lite-i18n
security-analysis:
name: Security Analysis
runs-on: ubuntu-latest
needs: pre-process
if: needs.pre-process.outputs.were-only-docs-updated != 'yes'
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
- name: Autobuild
uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
codacy-analysis-cli:
name: Codacy Analysis CLI
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@main
- name: Run Codacy Analysis CLI
uses: codacy/codacy-analysis-cli-action@master
with:
output: results.sarif
format: sarif
# Adjust severity of non-security issues
gh-code-scanning-compat: true
# Force 0 exit code to allow SARIF file generation
# This will handover control about PR rejection to the GitHub side
max-allowed-issues: 2147483647
# Upload the SARIF file generated in the previous step
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@main
with:
sarif_file: results.sarif
smoke-test:
name: Smoke Test
runs-on: ubuntu-latest
needs: pre-process
if: needs.pre-process.outputs.were-only-docs-updated != 'yes'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
- name: Smoke Test
run: |
git clone --branch=devops https://github.com/vmware/singleton.git devops
cd $GITHUB_WORKSPACE/g11n-ws && ./gradlew build -x test
cp $GITHUB_WORKSPACE/devops/deploy/i18n-service/Dockerfile $GITHUB_WORKSPACE/publish/
cd $GITHUB_WORKSPACE/publish && ls
mv singleton-[0~9]*.jar i18n-service.jar && ls
docker build -t singleton .
docker run -d -p 8090:8090 --name singleton singleton
docker ps
cd $GITHUB_WORKSPACE/devops/autotest/service/i18n-service/APITest && $GITHUB_WORKSPACE/g11n-ws/gradlew build
docker cp l10n singleton:/
str=$(printf '=%.0s' {1..50})
echo $str Smoke Test Start $str
date
locale
java -cp "target/*:resource/*" org.testng.TestNG testng.xml
echo $str Smoke Test End $str
performance-test:
name: Performance Test
runs-on: ubuntu-latest
needs: pre-process
if: needs.pre-process.outputs.were-only-docs-updated != 'yes'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
- name: Set up Python3
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Performance Test
run: |
git clone --branch=devops https://github.com/vmware/singleton.git devops
cd $GITHUB_WORKSPACE/g11n-ws && ./gradlew build -x test
cp $GITHUB_WORKSPACE/devops/performancetest/Dockerfile $GITHUB_WORKSPACE/publish/
cd $GITHUB_WORKSPACE/publish && ls
mv singleton-[0~9]*.jar i18n-service.jar && ls
cp -r $GITHUB_WORKSPACE/devops/performancetest/resource/l10n l10n
docker build -t singleton .
docker run -d -p 8090:8090 --name singleton singleton
docker ps
str=$(printf '=%.0s' {1..50})
cd $GITHUB_WORKSPACE/devops/performancetest
pip install -r requirements.txt
python performance.py