xborder commented on code in PR #1284:
URL: https://github.com/apache/arrow-java/pull/1284#discussion_r4160280219


##########
.github/workflows/test.yml:
##########
@@ -65,82 +53,197 @@ jobs:
       - name: Cache Docker Volumes
         uses: actions/cache@v6
         with:
-          path: .docker
-          key: maven-${{ matrix.jdk }}-${{ matrix.maven }}-${{ 
hashFiles('compose.yaml', '**/pom.xml') }}
-          restore-keys: maven-${{ matrix.jdk }}-${{ matrix.maven }}-
-      - name: Execute Docker Build
+          path: .docker/maven-cache
+          key: java-build-${{ env.BUILD_JDK }}-${{ env.MAVEN }}-${{ 
hashFiles('compose.yaml', '**/pom.xml') }}
+          restore-keys: java-build-${{ env.BUILD_JDK }}-${{ env.MAVEN }}-
+      - name: Build without tests
         env:
-          # Enables build caching, but not strictly required
           DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
+          JDK: ${{ env.BUILD_JDK }}
         run: |
           docker compose run \
+            --rm \
             -e CI=true \
             -e "DEVELOCITY_ACCESS_KEY=$DEVELOCITY_ACCESS_KEY" \
-            ${{ matrix.image }}
+            ubuntu-artifacts
+          sudo chown -R "$(id -u):$(id -g)" .docker
+      - name: Pack reusable artifacts
+        run: |
+          tar -czf java-build.tgz \
+            .docker/java-build \
+            .docker/maven-cache/repository/org/apache/arrow
+      - name: Upload reusable artifacts
+        uses: actions/upload-artifact@v5
+        with:
+          name: java-build
+          path: java-build.tgz
+          retention-days: 1
+      - name: Exclude reactor artifacts from Maven dependency cache
+        run: rm -rf .docker/maven-cache/repository/org/apache/arrow

Review Comment:
   It is removed so the cache doesn’t carry old Arrow binaries into future 
runs. The binaries are already in the build artifacts used by every test job



##########
.github/workflows/test.yml:
##########
@@ -65,82 +53,197 @@ jobs:
       - name: Cache Docker Volumes
         uses: actions/cache@v6
         with:
-          path: .docker
-          key: maven-${{ matrix.jdk }}-${{ matrix.maven }}-${{ 
hashFiles('compose.yaml', '**/pom.xml') }}
-          restore-keys: maven-${{ matrix.jdk }}-${{ matrix.maven }}-
-      - name: Execute Docker Build
+          path: .docker/maven-cache
+          key: java-build-${{ env.BUILD_JDK }}-${{ env.MAVEN }}-${{ 
hashFiles('compose.yaml', '**/pom.xml') }}
+          restore-keys: java-build-${{ env.BUILD_JDK }}-${{ env.MAVEN }}-
+      - name: Build without tests
         env:
-          # Enables build caching, but not strictly required
           DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
+          JDK: ${{ env.BUILD_JDK }}
         run: |
           docker compose run \
+            --rm \
             -e CI=true \
             -e "DEVELOCITY_ACCESS_KEY=$DEVELOCITY_ACCESS_KEY" \
-            ${{ matrix.image }}
+            ubuntu-artifacts
+          sudo chown -R "$(id -u):$(id -g)" .docker
+      - name: Pack reusable artifacts
+        run: |
+          tar -czf java-build.tgz \
+            .docker/java-build \
+            .docker/maven-cache/repository/org/apache/arrow
+      - name: Upload reusable artifacts
+        uses: actions/upload-artifact@v5
+        with:
+          name: java-build
+          path: java-build.tgz
+          retention-days: 1
+      - name: Exclude reactor artifacts from Maven dependency cache
+        run: rm -rf .docker/maven-cache/repository/org/apache/arrow
 
-  macos:
-    name: ${{ matrix.arch }} macOS ${{ matrix.macos }} Java JDK ${{ matrix.jdk 
}}
-    runs-on: macos-${{ matrix.macos }}
+  test-java:
+    name: ${{ matrix.name || format('AMD64 Ubuntu JDK {0} Maven 3.9.16', 
matrix.jdk) }}
+    needs: build-java
+    runs-on: ${{ matrix.os }}
     if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
     timeout-minutes: 30
     strategy:
       fail-fast: false
       matrix:
+        jdk: [17, 21, 25]
+        os: [ubuntu-latest]
         include:
           - arch: AArch64
             jdk: 17
-            macos: latest
+          - name: AMD64 Windows Server 2022 Java JDK 17
+            os: windows-latest
+            jdk: 17
+    env:
+      JDK: ${{ matrix.jdk }}
     steps:
       - name: Checkout Arrow
         uses: actions/checkout@v7
         with:
-          fetch-depth: 0
           submodules: recursive
       - name: Set up Java
+        if: ${{ !matrix.compose_service }}
         uses: actions/setup-java@v6
         with:
           distribution: 'temurin'
           java-version: ${{ matrix.jdk }}
           cache: 'maven'
-      - name: Build
+      - name: Cache Docker Volumes
+        if: ${{ matrix.compose_service }}
+        uses: actions/cache@v6
+        with:
+          path: .docker/maven-cache
+          key: java-build-${{ env.BUILD_JDK }}-${{ env.MAVEN }}-${{ 
hashFiles('compose.yaml', '**/pom.xml') }}
+          restore-keys: java-build-${{ env.BUILD_JDK }}-${{ env.MAVEN }}-

Review Comment:
   this avoids downloading external dependencies again in each job. 
`download-artifacts` only contains the compiled Arrow output and installed 
org/apache/arrow artifacts



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to