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


##########
.github/workflows/test.yml:
##########
@@ -65,82 +53,202 @@ 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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a 
# v7.0.1
+        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
+          - os: ubuntu-latest
+            compose_service: ubuntu-test-prebuilt
+          - name: AArch64 macOS latest Java JDK 17
+            os: macos-latest
             jdk: 17
-            macos: latest
+            compose_service: ''
+          - name: AMD64 Windows Server 2022 Java JDK 17
+            os: windows-latest
+            jdk: 17
+            compose_service: ''
+    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 }}-
+      - name: Download reusable artifacts
+        uses: 
actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
+        with:
+          name: java-build
+      - name: Restore reusable artifacts
+        shell: bash
+        run: |
+          rm -rf \
+            .docker/java-build \
+            .docker/maven-cache/repository/org/apache/arrow
+          tar -xzf java-build.tgz
+      - name: Restore reusable artifacts for hosted runner
+        if: ${{ !matrix.compose_service }}
+        shell: bash
+        run: |
+          cp -a .docker/java-build/build build
+          rm -rf "${HOME}/.m2/repository/org/apache/arrow"
+          mkdir -p "${HOME}/.m2/repository/org/apache"
+          cp -a .docker/maven-cache/repository/org/apache/arrow 
"${HOME}/.m2/repository/org/apache/"
+      - name: Test prebuilt artifacts on macOS/Windows
+        if: ${{ !matrix.compose_service }}
         shell: bash
         env:
+          ARROW_JAVA_TEST_PREBUILT: "ON"
           DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
-        run: ci/scripts/build.sh . build jni
-      - name: Test
+        run: ci/scripts/test.sh . build jni

Review Comment:
   Windows now runs its own build.sh and test.sh. I removed it from the 
prebuilt-test matrix, so Windows builds and tests



-- 
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