From e9bcfbf530e4a5f64d41bd19722de7a34c593b87 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 18 Sep 2026 15:23:50 +0530 Subject: [PATCH] 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 --- .github/workflows/ci.yml | 73 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2748218ff013..abfa453a2ad1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,68 @@ jobs: build: if: github.repository == 'apache/cloudstack' runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Set up JDK 17 + uses: actions/setup-java@v5 + with: + distribution: 'temurin' + java-version: '17' + cache: 'maven' + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: '3.10' + architecture: 'x64' + + - name: Install Build Dependencies + run: | + sudo apt-get update + 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 + + - name: Env details + run: | + uname -a + whoami + javac -version + mvn -v + python3 --version + free -m + nproc + + - name: Build with Maven + run: | + mvn -B -P developer,systemvm -Dsimulator clean install -DskipTests=true -T$(nproc) + + - name: Package build output + run: | + paths=($(find . -type d -name target)) + for p in engine/schema/dist systemvm/dist; do + [ -d "$p" ] && paths+=("$p") + done + tar --zstd -cf target-output.tar.zst "${paths[@]}" + tar --zstd -cf m2-cloudstack.tar.zst -C "$HOME" .m2/repository/org/apache/cloudstack + tar --zstd -cf marvin-dist.tar.zst tools/marvin/dist + + - name: Upload build output + uses: actions/upload-artifact@v4 + with: + name: simulator-ci-build-output + path: | + target-output.tar.zst + m2-cloudstack.tar.zst + marvin-dist.tar.zst + retention-days: 1 + compression-level: 0 + + test: + if: github.repository == 'apache/cloudstack' + needs: build + runs-on: ubuntu-24.04 strategy: fail-fast: false @@ -286,9 +348,16 @@ jobs: sudo systemctl restart mysql sudo mysql -uroot -e "SELECT VERSION();" - - name: Build with Maven + - name: Download build output + uses: actions/download-artifact@v4 + with: + name: simulator-ci-build-output + + - name: Extract build output run: | - mvn -B -P developer,systemvm -Dsimulator clean install -DskipTests=true -T$(nproc) + tar --zstd -xf target-output.tar.zst + tar --zstd -xf m2-cloudstack.tar.zst -C "$HOME" + tar --zstd -xf marvin-dist.tar.zst - name: Setup Simulator Prerequisites run: |