-
Notifications
You must be signed in to change notification settings - Fork 18
185 lines (156 loc) · 5.5 KB
/
ci.yml
File metadata and controls
185 lines (156 loc) · 5.5 KB
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: CI
on:
push:
branches:
- develop
- neo
pull_request:
branches:
- develop
- neo
workflow_dispatch:
jobs:
ci-core:
name: Run core tests on JDK ${{ matrix.jdk }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
jdk: [ 8, 11, 19 ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.jdk }}
distribution: 'zulu'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
with:
# Only write to the cache for builds on the specific branches. (Default is 'main' only.)
# Builds on other branches will only read existing entries from the cache.
cache-read-only: ${{ github.ref != 'refs/heads/develop' && github.ref != 'ref/heads/neo' }}
- name: Build and run tests
run: ./gradlew --scan build -x :jacodb-ets:build
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: (!cancelled())
with:
files: "**/build/test-results/**/*.xml"
check_name: "Test results on JDK ${{ matrix.jdk }}"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload Gradle reports
if: (!cancelled())
uses: actions/upload-artifact@v4
with:
name: gradle-reports-jdk${{ matrix.jdk }}
path: '**/build/reports/'
ci-lifecycle:
name: Run lifecycle tests
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
with:
# Only write to the cache for builds on the specific branches. (Default is 'main' only.)
# Builds on other branches will only read existing entries from the cache.
cache-read-only: ${{ github.ref != 'refs/heads/develop' && github.ref != 'refs/heads/neo' }}
- name: Build and run lifecycle tests
run: ./gradlew --scan lifecycleTest
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: (!cancelled())
with:
files: "**/build/test-results/**/*.xml"
check_name: "Lifecycle test results"
ci-ets:
name: Run ETS tests
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'zulu'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
with:
# Only write to the cache for builds on the specific branches. (Default is 'main' only.)
# Builds on other branches will only read existing entries from the cache.
cache-read-only: ${{ github.ref != 'refs/heads/develop' && github.ref != 'ref/heads/neo' }}
- name: Set up ArkAnalyzer
run: |
REPO_URL="https://gitcode.com/Lipen/arkanalyzer"
DEST_DIR="arkanalyzer"
MAX_RETRIES=10
RETRY_DELAY=3 # Delay between retries in seconds
BRANCH="neo/2025-05-30b"
for ((i=1; i<=MAX_RETRIES; i++)); do
git clone --depth=1 --branch $BRANCH $REPO_URL $DEST_DIR && break
echo "Clone failed, retrying in $RETRY_DELAY seconds..."
sleep "$RETRY_DELAY"
done
if [[ $i -gt $MAX_RETRIES ]]; then
echo "Failed to clone the repository after $MAX_RETRIES attempts."
exit 1
else
echo "Repository cloned successfully."
fi
echo "ARKANALYZER_DIR=$(realpath $DEST_DIR)" >> $GITHUB_ENV
cd $DEST_DIR
npm install
npm run build
- name: Start ArkAnalyzer server
run: |
nohup npm --prefix $ARKANALYZER_DIR run server:start > grpc-server.log 2>&1 &
PID=$!
echo $PID > grpc-server.pid
echo "Started gRPC server with PID $PID"
- name: Wait for gRPC server to start
run: |
echo "Waiting for gRPC server to be ready..."
for i in {1..10}; do
nc -z localhost 50051 && echo "Server is up!" && exit 0
sleep 1
done
echo "Server failed to start" >&2
cat grpc-server.log
exit 1
- name: Run ETS tests
run: ./gradlew --scan :jacodb-ets:generateTestResources :jacodb-ets:test
- name: Upload Gradle reports
if: (!cancelled())
uses: actions/upload-artifact@v4
with:
name: gradle-reports-ets
path: '**/build/reports/'
- name: Upload gRPC server logs
if: (!cancelled())
uses: actions/upload-artifact@v4
with:
name: grpc-server-log
path: grpc-server.log
- name: Kill gRPC server
if: always()
run: |
if [ -f grpc-server.pid ]; then
PID=$(cat grpc-server.pid)
echo "Killing gRPC server with PID $PID"
kill $PID || echo "Process already terminated"
fi