1616# under the License.
1717
1818name : Simulator CI
19-
20- on : [push, pull_request]
21-
19+ on :
20+ - push
21+ - pull_request
2222concurrency :
2323 group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
24- cancel-in-progress : true
25-
24+ cancel-in-progress : ${{ github.ref != 'refs/heads/main' }}
2625permissions :
2726 contents : read
28-
2927jobs :
3028 build :
3129 if : github.repository == 'apache/cloudstack'
3230 runs-on : ubuntu-24.04
33-
31+ steps :
32+ - uses : actions/checkout@v6
33+ with :
34+ fetch-depth : 0
35+ - name : Setup Environment
36+ uses : ./.github/actions/setup-env
37+ with :
38+ install-python : ' true'
39+ install-apt-deps : ' true'
40+ - name : Env details
41+ run : |
42+ uname -a
43+ whoami
44+ javac -version
45+ mvn -v
46+ python3 --version
47+ free -m
48+ nproc
49+ git status
50+ ipmitool -V
51+ - name : Build with Maven
52+ run : |
53+ mvn -B -P developer,systemvm -Dsimulator clean install -DskipTests=true -T$(nproc)
54+ - name : Archive artifacts
55+ run : |
56+ mkdir -p /tmp/artifacts
57+ tar -czf /tmp/artifacts/targets.tar.gz $(find . -name "target" -type d) tools/marvin/dist engine/schema/dist utils/conf
58+ tar -czf /tmp/artifacts/m2-cloudstack.tar.gz -C ~/.m2/repository org/apache/cloudstack
59+ - name : Upload artifacts
60+ uses : actions/upload-artifact@v7
61+ with :
62+ name : build-artifacts
63+ path : /tmp/artifacts/
64+ test :
65+ needs : build
66+ if : github.repository == 'apache/cloudstack'
67+ runs-on : ubuntu-24.04
3468 strategy :
3569 fail-fast : false
3670 matrix :
@@ -215,30 +249,15 @@ jobs:
215249 smoke/test_list_service_offerings
216250 smoke/test_list_storage_pools
217251 smoke/test_list_volumes" ]
218-
219252 steps :
220253 - uses : actions/checkout@v6
221254 with :
222255 fetch-depth : 0
223-
224- - name : Set up JDK 17
225- uses : actions/setup-java@v5
256+ - name : Setup Environment
257+ uses : ./.github/actions/setup-env
226258 with :
227- distribution : ' temurin'
228- java-version : ' 17'
229- cache : ' maven'
230-
231- - name : Set up Python
232- uses : actions/setup-python@v6
233- with :
234- python-version : ' 3.10'
235- architecture : ' x64'
236-
237- - name : Install Build Dependencies
238- run : |
239- sudo apt-get update
240- sudo apt-get install -y git uuid-runtime genisoimage netcat-openbsd ipmitool build-essential libgcrypt20 libgpg-error-dev libgpg-error0 libopenipmi0 ipmitool libpython3-dev libssl-dev libffi-dev python3-openssl python3-dev python3-setuptools
241-
259+ install-python : ' true'
260+ install-apt-deps : ' true'
242261 - name : Setup IPMI Tool for CloudStack
243262 run : |
244263 # Create cloudstack-common directory if it doesn't exist
@@ -256,28 +275,13 @@ jobs:
256275 /usr/share/cloudstack-common/ipmitool -C3 $@
257276 EOF
258277 sudo chmod 755 /usr/bin/ipmitool
259-
260278 - name : Install Python dependencies
261279 run : |
262280 python3 -m pip install --user --upgrade urllib3 lxml paramiko nose texttable ipmisim pyopenssl pycryptodome mock flask netaddr pylint pycodestyle six astroid pynose
263-
264281 - name : Install jacoco dependencies
265282 run : |
266283 wget https://github.com/jacoco/jacoco/releases/download/v0.8.10/jacoco-0.8.10.zip
267284 unzip jacoco-0.8.10.zip -d jacoco
268-
269- - name : Env details
270- run : |
271- uname -a
272- whoami
273- javac -version
274- mvn -v
275- python3 --version
276- free -m
277- nproc
278- git status
279- ipmitool -V
280-
281285 - name : Setup MySQL Server
282286 run : |
283287 # https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2004-Readme.md#mysql
@@ -286,25 +290,28 @@ jobs:
286290 sudo mysql -uroot -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ''; FLUSH PRIVILEGES;"
287291 sudo systemctl restart mysql
288292 sudo mysql -uroot -e "SELECT VERSION();"
289-
290- - name : Build with Maven
293+ - name : Download artifacts
294+ uses : actions/download-artifact@v8
295+ with :
296+ name : build-artifacts
297+ path : /tmp/artifacts/
298+ - name : Extract artifacts
291299 run : |
292- mvn -B -P developer,systemvm -Dsimulator clean install -DskipTests=true -T$(nproc)
293-
300+ tar -xzf /tmp/artifacts/targets.tar.gz
301+ mkdir -p ~/.m2/repository
302+ tar -xzf /tmp/artifacts/m2-cloudstack.tar.gz -C ~/.m2/repository
294303 - name : Setup Simulator Prerequisites
295304 run : |
296305 sudo python3 -m pip install --upgrade netaddr mysql-connector-python
297306 python3 -m pip install --user --upgrade tools/marvin/dist/[mM]arvin-*.tar.gz
298307 mvn -q -Pdeveloper -pl developer -Ddeploydb
299308 mvn -q -Pdeveloper -pl developer -Ddeploydb-simulator
300-
301309 - name : Generate jacoco-coverage.sh
302310 run : |
303311 echo "java -jar jacoco/lib/jacococli.jar report jacoco-it.exec \\" > jacoco-report.sh
304312 find . | grep "target/classes" | sed 's/\/classes\//\/classes /g' | awk '{print "--classfiles", $1, "\\"}' | sort |uniq >> jacoco-report.sh
305313 find . | grep "src/main/java" | sed 's/\/java\//\/java /g' | awk '{print "--sourcefiles", $1, "\\"}' | sort | uniq >> jacoco-report.sh
306314 echo "--xml jacoco-coverage.xml" >> jacoco-report.sh
307-
308315 - name : Start CloudStack Management Server with Simulator
309316 run : |
310317 export MAVEN_OPTS="-Xmx4096m -XX:MaxMetaspaceSize=800m -Djava.security.egd=file:/dev/urandom -javaagent:jacoco/lib/jacocoagent.jar=address=*,port=36320,output=tcpserver --add-opens=java.base/java.lang=ALL-UNNAMED --add-exports=java.base/sun.security.x509=ALL-UNNAMED --add-opens=java.base/jdk.internal.reflect=ALL-UNNAMED"
@@ -315,7 +322,6 @@ jobs:
315322 set -e
316323 echo -e "\nStarting Advanced Zone DataCenter deployment"
317324 python3 tools/marvin/marvin/deployDataCenter.py -i setup/dev/advdualzone.cfg 2>&1 || true
318-
319325 - name : Run Integration Tests with Simulator
320326 run : |
321327 mkdir -p integration-test-results/smoke/misc
@@ -335,13 +341,11 @@ jobs:
335341 bash jacoco-report.sh
336342 mvn -Dsimulator -pl client jetty:stop 2>&1
337343 find /tmp//MarvinLogs -type f -exec echo -e "Printing marvin logs {} :\n" \; -exec cat {} \;
338-
339344 - name : Integration Tests Result
340345 run : |
341346 echo -e "Simulator CI Test Results: (only failures listed)\n"
342347 python3 ./tools/marvin/xunit-reader.py integration-test-results/
343-
344- - uses : codecov/codecov-action@v4
348+ - uses : codecov/codecov-action@v5
345349 with :
346350 files : jacoco-coverage.xml
347351 fail_ci_if_error : true
0 commit comments