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

jbonofre pushed a commit to branch enhance-github-actions-workflows
in repository https://gitbox.apache.org/repos/asf/karaf-decanter.git

commit 54af6a0fa422afa77f26c726e69ed2618988bbba
Author: JB Onofré <[email protected]>
AuthorDate: Fri Mar 20 05:52:43 2026 +0100

    ci: enhance GitHub Actions workflows
    
    Split the single build workflow into separate build and test jobs
    with Maven cache sharing, matching the pattern used in Apache Karaf.
    
    - Replace build.yml with ci.yml containing build and test jobs
    - Add Maven local repository caching between jobs
    - Pin runner to ubuntu-24.04
    - Add test timeout (180 minutes)
    - Upload surefire test results and event file as artifacts
    - Add ci-test-results.yml to publish test results as PR annotations
---
 .github/workflows/build.yml           | 46 ------------------
 .github/workflows/ci-test-results.yml | 64 ++++++++++++++++++++++++
 .github/workflows/ci.yml              | 91 +++++++++++++++++++++++++++++++++++
 3 files changed, 155 insertions(+), 46 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
deleted file mode 100644
index ec138fcb..00000000
--- a/.github/workflows/build.yml
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-name: Build
-
-on:
-  push:
-    branches: [ "main" ]
-  pull_request:
-    branches: [ "main" ]
-
-jobs:
-  build:
-
-    runs-on: ubuntu-latest
-    permissions:
-      contents: read
-
-    steps:
-      - uses: actions/checkout@v6
-      - name: Set up JDK 11
-        uses: actions/setup-java@v5
-        with:
-          java-version: '11'
-          distribution: 'temurin'
-          architecture: 'x64'
-      - name: Building
-        run: mvn -U -B -e clean install -DskipTests -Prat
-      - name: Tests
-        run: mvn -B -fae -e test -Pci
diff --git a/.github/workflows/ci-test-results.yml 
b/.github/workflows/ci-test-results.yml
new file mode 100644
index 00000000..e9c4b75b
--- /dev/null
+++ b/.github/workflows/ci-test-results.yml
@@ -0,0 +1,64 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+name: CI Test Results
+
+on:
+  workflow_run:
+    workflows: ["CI"]
+    types:
+      - completed
+
+permissions:
+  contents: read
+  checks: write
+  pull-requests: write
+  actions: read
+
+jobs:
+  test-results:
+    name: Publish Test Results
+    runs-on: ubuntu-24.04
+    if: github.event.workflow_run.conclusion != 'skipped'
+
+    steps:
+      - name: Download Test Results
+        uses: dawidd6/action-download-artifact@v19
+        with:
+          run_id: ${{ github.event.workflow_run.id }}
+          name: test-results
+          path: artifacts
+
+      - name: Download Event File
+        uses: dawidd6/action-download-artifact@v19
+        with:
+          run_id: ${{ github.event.workflow_run.id }}
+          name: event-file
+          path: event
+
+      - name: Publish Test Results
+        uses: EnricoMi/publish-unit-test-result-action@v2
+        with:
+          commit: ${{ github.event.workflow_run.head_sha }}
+          event_file: event/event.json
+          event_name: ${{ github.event.workflow_run.event }}
+          large_files: true
+          report_individual_runs: true
+          report_suite_logs: error
+          files: 'artifacts/**/*.xml'
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 00000000..b28730e9
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,91 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+name: CI
+
+on:
+  push:
+    branches: [ "main" ]
+  pull_request:
+    branches: [ "main" ]
+
+jobs:
+  build:
+    name: build
+
+    permissions:
+      contents: read
+
+    runs-on: ubuntu-24.04
+
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v6
+      - name: Set up JDK 11
+        uses: actions/setup-java@v5
+        with:
+          java-version: '11'
+          distribution: 'temurin'
+          cache: 'maven'
+      - name: Build
+        run: mvn -U -B -e clean install -Prat -DskipTests
+      - name: Save Maven Local Repository
+        uses: actions/cache/save@v5
+        with:
+          path: ~/.m2/repository
+          key: maven-local-repo-${{ github.run_id }}
+
+  test:
+    name: test
+    needs: build
+
+    permissions:
+      contents: read
+
+    runs-on: ubuntu-24.04
+
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v6
+      - name: Set up JDK 11
+        uses: actions/setup-java@v5
+        with:
+          java-version: '11'
+          distribution: 'temurin'
+          cache: 'maven'
+      - name: Restore Maven Local Repository
+        uses: actions/cache/restore@v5
+        with:
+          path: ~/.m2/repository
+          key: maven-local-repo-${{ github.run_id }}
+      - name: Test
+        run: mvn -B -fae -e test -Pci
+        timeout-minutes: 180
+      - name: Upload Test Results
+        if: always()
+        uses: actions/upload-artifact@v7
+        with:
+          name: test-results
+          path: '**/target/surefire-reports/*.xml'
+      - name: Upload Event File
+        if: always()
+        uses: actions/upload-artifact@v7
+        with:
+          name: event-file
+          path: ${{ github.event_path }}

Reply via email to