This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/main by this push:
     new b066e23b5f fix(ci): make test job depend on build to resolve SNAPSHOT 
artifacts (#2320)
b066e23b5f is described below

commit b066e23b5f9bf637920e45a9fde3b7c8ebe4c3f8
Author: JB Onofré <[email protected]>
AuthorDate: Sat Mar 14 08:35:11 2026 +0100

    fix(ci): make test job depend on build to resolve SNAPSHOT artifacts (#2320)
    
    The test job runs with -Ptest profile which disables assembly packaging
    (install-kar, package phases set to none). This means artifacts like
    apache-karaf:tar.gz are never built during the test job. Previously,
    build and test ran as independent parallel jobs on separate runners,
    so the test job could not resolve these SNAPSHOT artifacts.
    
    Fix by:
    - Adding needs: build to make test run after build completes
    - Saving the Maven local repository from build via actions/cache/save
    - Restoring it in the test job via actions/cache/restore
    - Removing clean from the test Maven command so local repo is preserved
---
 .github/workflows/ci.yml | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 493256320f..d32a2f8b1d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -45,15 +45,21 @@ jobs:
           cache: 'maven'
       - name: Build
         run: mvn -U -B -e clean install -Prat -DskipTests "-Dinvoker.skip=true"
+      - name: Save Maven Local Repository
+        uses: actions/cache/save@v4
+        with:
+          path: ~/.m2/repository
+          key: maven-local-repo-${{ github.run_id }}
 
   test:
     name: test
+    needs: build
 
     permissions:
       contents: read
       checks: write
       pull-requests: write
-  
+
     runs-on: ubuntu-24.04
 
     steps:
@@ -65,8 +71,13 @@ jobs:
           java-version: '17'
           distribution: 'temurin'
           cache: 'maven'
+      - name: Restore Maven Local Repository
+        uses: actions/cache/restore@v4
+        with:
+          path: ~/.m2/repository
+          key: maven-local-repo-${{ github.run_id }}
       - name: Test
-        run: mvn -U -B -e clean install -Ptest
+        run: mvn -B -e install -Ptest
       - name: Upload Test Results
         if: (!cancelled())
         uses: actions/upload-artifact@v4

Reply via email to