-
-
Notifications
You must be signed in to change notification settings - Fork 101
191 lines (184 loc) · 7.66 KB
/
bofore_checker.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
186
187
188
189
190
191
name: Before checker with maven
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "dev" ]
jobs:
before_checker_loading:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- run: echo 'Before checker loading'
before_checker_ui:
runs-on: ubuntu-latest
needs:
- before_checker_loading
if: |
${{ github.event_name == 'pull_request' && (
contains(github.event.pull_request.changed_files.*.filename, 'core/datacap-ui') ||
contains(toJSON(github.event.pull_request.changed_files), 'core/datacap-ui')
) }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- run: cd core/datacap-ui && npm install pnpm -g && pnpm install && pnpm run build
before_checker_style:
runs-on: ubuntu-latest
needs:
- before_checker_loading
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Debug file changes
run: |
echo "Event name: ${{ github.event_name }}"
echo "Modified files (push):"
echo "${{ toJSON(github.event.commits.*.modified) }}"
echo "Changed files (pull_request):"
echo "${{ toJSON(github.event.pull_request.changed_files.*.filename) }}"
- name: Check if Java or Kotlin files changed
id: check_files
run: |
if [[ "${{ github.event_name }}" == "push" ]]; then
MODIFIED_FILES="${{ toJSON(github.event.commits.*.modified) }}"
if [[ $MODIFIED_FILES == *".java"* ]] || [[ $MODIFIED_FILES == *".kt"* ]]; then
echo "run_check=true" >> $GITHUB_OUTPUT
fi
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
CHANGED_FILES="${{ toJSON(github.event.pull_request.changed_files.*.filename) }}"
if [[ $CHANGED_FILES == *".java"* ]] || [[ $CHANGED_FILES == *".kt"* ]]; then
echo "run_check=true" >> $GITHUB_OUTPUT
fi
fi
shell: bash
- name: Maven Checker Style
if: steps.check_files.outputs.run_check == 'true'
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- if: steps.check_files.outputs.run_check == 'true'
run: chmod 755 ./mvnw
- if: steps.check_files.outputs.run_check == 'true'
run: ./mvnw clean install checkstyle:checkstyle -Dspotbugs.skip -Dgpg.skip -Dskip.pnpm -DskipTests=true
before_checker_bugs:
runs-on: ubuntu-latest
needs:
- before_checker_loading
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Debug file changes
run: |
echo "Event name: ${{ github.event_name }}"
echo "Modified files (push):"
echo "${{ toJSON(github.event.commits.*.modified) }}"
echo "Changed files (pull_request):"
echo "${{ toJSON(github.event.pull_request.changed_files.*.filename) }}"
- name: Check if Java or Kotlin files changed
id: check_files
run: |
if [[ "${{ github.event_name }}" == "push" ]]; then
MODIFIED_FILES="${{ toJSON(github.event.commits.*.modified) }}"
if [[ $MODIFIED_FILES == *".java"* ]] || [[ $MODIFIED_FILES == *".kt"* ]]; then
echo "run_check=true" >> $GITHUB_OUTPUT
fi
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
CHANGED_FILES="${{ toJSON(github.event.pull_request.changed_files.*.filename) }}"
if [[ $CHANGED_FILES == *".java"* ]] || [[ $CHANGED_FILES == *".kt"* ]]; then
echo "run_check=true" >> $GITHUB_OUTPUT
fi
fi
shell: bash
- name: Maven Checker Bugs
if: steps.check_files.outputs.run_check == 'true'
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Grant execute permission for mvnw
if: steps.check_files.outputs.run_check == 'true'
run: chmod +x mvnw
- name: Run SpotBugs skip server
if: steps.check_files.outputs.run_check == 'true'
env:
MAVEN_OPTS: -Xmx1024m
run: ./mvnw clean install spotbugs:spotbugs -pl '!core/datacap-server' -Dcheckstyle.skip -Dgpg.skip -Dskip.pnpm -DskipTests=true
- name: Run SpotBugs for server
if: steps.check_files.outputs.run_check == 'true'
run: ./mvnw clean install spotbugs:spotbugs -Dcheckstyle.skip -Dgpg.skip -Dskip.pnpm -DskipTests=true -f core/datacap-server/pom.xml
before_checker_test:
runs-on: ubuntu-latest
needs:
- before_checker_ui
- before_checker_style
- before_checker_bugs
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Maven Checker Style
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Add hosts
run: |
echo "156.238.128.11 cdn.north.devlive.org" | sudo tee -a /etc/hosts
echo "156.238.128.17 cdn.north.devlive.org" | sudo tee -a /etc/hosts
echo "156.238.128.19 cdn.north.devlive.org" | sudo tee -a /etc/hosts
echo "156.238.128.23 cdn.north.devlive.org" | sudo tee -a /etc/hosts
- run: chmod 755 ./mvnw
- name: Debug Environment Variables
env:
QINIU_ACCESS: ${{ secrets.QINIU_ACCESS }}
QINIU_SECRET: ${{ secrets.QINIU_SECRET }}
QINIU_BUCKET: ${{ secrets.QINIU_BUCKET }}
QINIU_ENDPOINT: ${{ secrets.QINIU_ENDPOINT }}
run: |
echo "QINIU_ENDPOINT is set: ${{ secrets.QINIU_ENDPOINT != '' }}"
echo "QINIU_ENDPOINT length: ${#QINIU_ENDPOINT}"
- name: Run Tests
if: ${{ env.QINIU_ENDPOINT != '' }}
env:
QINIU_ACCESS: ${{ secrets.QINIU_ACCESS }}
QINIU_SECRET: ${{ secrets.QINIU_SECRET }}
QINIU_BUCKET: ${{ secrets.QINIU_BUCKET }}
QINIU_ENDPOINT: ${{ secrets.QINIU_ENDPOINT }}
ALIOSS_ACCESS: ${{ secrets.ALIOSS_ACCESS }}
ALIOSS_SECRET: ${{ secrets.ALIOSS_SECRET }}
ALIOSS_BUCKET: ${{ secrets.ALIOSS_BUCKET }}
ALIOSS_ENDPOINT: ${{ secrets.ALIOSS_ENDPOINT }}
COS_ACCESS: ${{ secrets.COS_ACCESS }}
COS_SECRET: ${{ secrets.COS_SECRET }}
COS_BUCKET: ${{ secrets.COS_BUCKET }}
COS_ENDPOINT: ${{ secrets.COS_ENDPOINT }}
S3_ACCESS: ${{ secrets.S3_ACCESS }}
S3_SECRET: ${{ secrets.S3_SECRET }}
S3_BUCKET: ${{ secrets.S3_BUCKET }}
S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
run: |
./mvnw clean test -Dspotbugs.skip -Dgpg.skip -Dcheckstyle.skip -Dskip.pnpm \
-Dqiniu.access="$QINIU_ACCESS" -Dqiniu.secret="$QINIU_SECRET" -Dqiniu.bucket="$QINIU_BUCKET" -Dqiniu.endpoint="$QINIU_ENDPOINT" \
-Dalioss.access="$ALIOSS_ACCESS" -Dalioss.secret="$ALIOSS_SECRET" -Dalioss.bucket="$ALIOSS_BUCKET" -Dalioss.endpoint="$ALIOSS_ENDPOINT" \
-Dcos.access="$COS_ACCESS" -Dcos.secret="$COS_SECRET" -Dcos.bucket="$COS_BUCKET" -Dcos.endpoint="$COS_ENDPOINT" \
-Ds3.access="$S3_ACCESS" -Ds3.secret="$S3_SECRET" -Ds3.bucket="$S3_BUCKET" -Ds3.endpoint="$S3_ENDPOINT"
before_checker_package:
runs-on: ubuntu-latest
needs:
- before_checker_test
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Maven Checker Package
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- run: chmod 755 ./mvnw
- run: ./mvnw -T 1C clean install package -Dspotbugs.skip -Dgpg.skip -Dcheckstyle.skip -DskipTests=true