Skip to content

Commit e9bcfbf

Browse files
committed
ci: improve setup
Earlier CI workflow was doing the build as many times as the number of tests set. If the build fails, it is kind of not optimal use os resources. This change allows building once and then sharing the built artifacts to all test runners. Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent d0d49bc commit e9bcfbf

1 file changed

Lines changed: 71 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,68 @@ jobs:
3030
build:
3131
if: github.repository == 'apache/cloudstack'
3232
runs-on: ubuntu-24.04
33+
steps:
34+
- uses: actions/checkout@v5
35+
with:
36+
fetch-depth: 0
37+
38+
- name: Set up JDK 17
39+
uses: actions/setup-java@v5
40+
with:
41+
distribution: 'temurin'
42+
java-version: '17'
43+
cache: 'maven'
44+
45+
- name: Set up Python
46+
uses: actions/setup-python@v6
47+
with:
48+
python-version: '3.10'
49+
architecture: 'x64'
50+
51+
- name: Install Build Dependencies
52+
run: |
53+
sudo apt-get update
54+
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
55+
56+
- name: Env details
57+
run: |
58+
uname -a
59+
whoami
60+
javac -version
61+
mvn -v
62+
python3 --version
63+
free -m
64+
nproc
65+
66+
- name: Build with Maven
67+
run: |
68+
mvn -B -P developer,systemvm -Dsimulator clean install -DskipTests=true -T$(nproc)
69+
70+
- name: Package build output
71+
run: |
72+
paths=($(find . -type d -name target))
73+
for p in engine/schema/dist systemvm/dist; do
74+
[ -d "$p" ] && paths+=("$p")
75+
done
76+
tar --zstd -cf target-output.tar.zst "${paths[@]}"
77+
tar --zstd -cf m2-cloudstack.tar.zst -C "$HOME" .m2/repository/org/apache/cloudstack
78+
tar --zstd -cf marvin-dist.tar.zst tools/marvin/dist
79+
80+
- name: Upload build output
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: simulator-ci-build-output
84+
path: |
85+
target-output.tar.zst
86+
m2-cloudstack.tar.zst
87+
marvin-dist.tar.zst
88+
retention-days: 1
89+
compression-level: 0
90+
91+
test:
92+
if: github.repository == 'apache/cloudstack'
93+
needs: build
94+
runs-on: ubuntu-24.04
3395

3496
strategy:
3597
fail-fast: false
@@ -286,9 +348,16 @@ jobs:
286348
sudo systemctl restart mysql
287349
sudo mysql -uroot -e "SELECT VERSION();"
288350
289-
- name: Build with Maven
351+
- name: Download build output
352+
uses: actions/download-artifact@v4
353+
with:
354+
name: simulator-ci-build-output
355+
356+
- name: Extract build output
290357
run: |
291-
mvn -B -P developer,systemvm -Dsimulator clean install -DskipTests=true -T$(nproc)
358+
tar --zstd -xf target-output.tar.zst
359+
tar --zstd -xf m2-cloudstack.tar.zst -C "$HOME"
360+
tar --zstd -xf marvin-dist.tar.zst
292361
293362
- name: Setup Simulator Prerequisites
294363
run: |

0 commit comments

Comments
 (0)