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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
33+ with :
34+ fetch-depth : 0
35+ persist-credentials : false
36+ - name : Setup Environment
37+ uses : ./.github/actions/setup-env
38+ with :
39+ install-python : ' true'
40+ install-apt-deps : ' true'
41+ - name : Env details
42+ run : |
43+ uname -a
44+ whoami
45+ javac -version
46+ mvn -v
47+ python3 --version
48+ free -m
49+ nproc
50+ git status
51+ ipmitool -V
52+ - name : Build with Maven
53+ run : |
54+ mvn -B -P developer,systemvm -Dsimulator clean install -DskipTests=true -T$(nproc)
55+ - name : Archive artifacts
56+ run : |
57+ mkdir -p /tmp/artifacts
58+ tar -czf /tmp/artifacts/targets.tar.gz $(find . -name "target" -type d) tools/marvin/dist engine/schema/dist utils/conf
59+ tar -czf /tmp/artifacts/m2-cloudstack.tar.gz -C ~/.m2/repository org/apache/cloudstack
60+ - name : Upload artifacts
61+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
62+ with :
63+ name : build-artifacts
64+ path : /tmp/artifacts/
65+ test :
66+ needs : build
67+ if : github.repository == 'apache/cloudstack'
68+ runs-on : ubuntu-24.04
3469 strategy :
3570 fail-fast : false
3671 matrix :
@@ -215,30 +250,16 @@ jobs:
215250 smoke/test_list_service_offerings
216251 smoke/test_list_storage_pools
217252 smoke/test_list_volumes" ]
218-
219253 steps :
220- - uses : actions/checkout@v6
254+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
221255 with :
222256 fetch-depth : 0
223-
224- - name : Set up JDK 17
225- uses : actions/setup-java@v5
257+ persist-credentials : false
258+ - name : Setup Environment
259+ uses : ./.github/ actions/setup-env
226260 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-
261+ install-python : ' true'
262+ install-apt-deps : ' true'
242263 - name : Setup IPMI Tool for CloudStack
243264 run : |
244265 # Create cloudstack-common directory if it doesn't exist
@@ -256,55 +277,43 @@ jobs:
256277 /usr/share/cloudstack-common/ipmitool -C3 $@
257278 EOF
258279 sudo chmod 755 /usr/bin/ipmitool
259-
260280 - name : Install Python dependencies
261281 run : |
262282 python3 -m pip install --user --upgrade urllib3 lxml paramiko nose texttable ipmisim pyopenssl pycryptodome mock flask netaddr pylint pycodestyle six astroid pynose
263-
264283 - name : Install jacoco dependencies
265284 run : |
266285 wget https://github.com/jacoco/jacoco/releases/download/v0.8.10/jacoco-0.8.10.zip
267286 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-
281287 - name : Setup MySQL Server
282288 run : |
283289 # https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2004-Readme.md#mysql
284290 sudo apt-get install -y mysql-server
285291 sudo systemctl start mysql
286- sudo mysql -uroot -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ''; FLUSH PRIVILEGES;"
292+ sudo mysql -uroot -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY ''; FLUSH PRIVILEGES;"
287293 sudo systemctl restart mysql
288294 sudo mysql -uroot -e "SELECT VERSION();"
289-
290- - name : Build with Maven
295+ - name : Download artifacts
296+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
297+ with :
298+ name : build-artifacts
299+ path : /tmp/artifacts/
300+ - name : Extract artifacts
291301 run : |
292- mvn -B -P developer,systemvm -Dsimulator clean install -DskipTests=true -T$(nproc)
293-
302+ tar -xzf /tmp/artifacts/targets.tar.gz
303+ mkdir -p ~/.m2/repository
304+ tar -xzf /tmp/artifacts/m2-cloudstack.tar.gz -C ~/.m2/repository
294305 - name : Setup Simulator Prerequisites
295306 run : |
296307 sudo python3 -m pip install --upgrade netaddr mysql-connector-python
297308 python3 -m pip install --user --upgrade tools/marvin/dist/[mM]arvin-*.tar.gz
298309 mvn -q -Pdeveloper -pl developer -Ddeploydb
299310 mvn -q -Pdeveloper -pl developer -Ddeploydb-simulator
300-
301311 - name : Generate jacoco-coverage.sh
302312 run : |
303313 echo "java -jar jacoco/lib/jacococli.jar report jacoco-it.exec \\" > jacoco-report.sh
304314 find . | grep "target/classes" | sed 's/\/classes\//\/classes /g' | awk '{print "--classfiles", $1, "\\"}' | sort |uniq >> jacoco-report.sh
305315 find . | grep "src/main/java" | sed 's/\/java\//\/java /g' | awk '{print "--sourcefiles", $1, "\\"}' | sort | uniq >> jacoco-report.sh
306316 echo "--xml jacoco-coverage.xml" >> jacoco-report.sh
307-
308317 - name : Start CloudStack Management Server with Simulator
309318 run : |
310319 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 +324,6 @@ jobs:
315324 set -e
316325 echo -e "\nStarting Advanced Zone DataCenter deployment"
317326 python3 tools/marvin/marvin/deployDataCenter.py -i setup/dev/advdualzone.cfg 2>&1 || true
318-
319327 - name : Run Integration Tests with Simulator
320328 run : |
321329 mkdir -p integration-test-results/smoke/misc
@@ -335,13 +343,12 @@ jobs:
335343 bash jacoco-report.sh
336344 mvn -Dsimulator -pl client jetty:stop 2>&1
337345 find /tmp//MarvinLogs -type f -exec echo -e "Printing marvin logs {} :\n" \; -exec cat {} \;
338-
339346 - name : Integration Tests Result
340347 run : |
341348 echo -e "Simulator CI Test Results: (only failures listed)\n"
342349 python3 ./tools/marvin/xunit-reader.py integration-test-results/
343350
344- - uses : codecov/codecov-action@v4
351+ - uses : codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
345352 with :
346353 files : jacoco-coverage.xml
347354 fail_ci_if_error : true
0 commit comments