Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions .github/actions/setup-maven-cache/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#
# 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: 'Setup Maven Cache'
description: 'Manages the third-party Maven dependency cache. Use action=restore (default) before the build and action=save after.'
inputs:
action:
description: 'restore (default) or save'
default: 'restore'
maven-properties:
description: 'Maven property expressions to evaluate for the cache key, one per line. Ignored when cache-key is provided. Only used for restore.'
default: ''
pom-path:
description: 'Path to the POM file or directory passed to Maven -f. Defaults to pom.xml. Only used for restore.'
default: 'pom.xml'
cache-key:
description: 'restore: pre-computed key override (skips property evaluation). save: the key to save under (required).'
default: ''
download-maven-repo:
description: 'Download and extract the maven-repo workflow artifact after restoring the cache. Only used for restore.'
default: 'false'
cache-paths:
description: 'Paths under ~/.m2/repository to cache, one per line. Defaults to the known third-party artifact groups.'
default: |
~/.m2/repository/com/atlassian
~/.m2/repository/io/atlassian
~/.m2/repository/org/opensaml
~/.m2/repository/net/shibboleth

outputs:
cache-key:
description: 'The resolved cache key (only set for action=restore)'
value: ${{ steps.resolve-key.outputs.key }}

runs:
using: "composite"
steps:
- name: Resolve cache key
id: resolve-key
if: ${{ inputs.action == 'restore' }}
shell: bash
env:
PROVIDED_KEY: ${{ inputs.cache-key }}
MAVEN_PROPERTIES: ${{ inputs.maven-properties }}
POM_PATH: ${{ inputs.pom-path }}
run: |
if [[ -n "${PROVIDED_KEY}" ]]; then
echo "key=${PROVIDED_KEY}" >> $GITHUB_OUTPUT
elif [[ -n "${MAVEN_PROPERTIES}" ]]; then
VALS=""
while IFS= read -r PROP; do
PROP="${PROP//[[:space:]]/}"
[[ -z "${PROP}" ]] && continue
VAL=$(./mvnw help:evaluate -f "${POM_PATH}" -Dexpression="${PROP}" -q -DforceStdout -N)
VALS="${VALS}${VAL}\n"
done <<< "${MAVEN_PROPERTIES}"
HASH=$(printf "${VALS}" | sha256sum | cut -c1-16)
echo "key=third-party-maven-${HASH}" >> $GITHUB_OUTPUT
else
CAMEL_VER=$(grep -m1 '<version>' "${POM_PATH}" | sed 's|.*<version>\(.*\)</version>.*|\1|' | tr -d ' ')
CXF_VER=$(grep -m1 '<quarkiverse-cxf\.version>' "${POM_PATH}" | sed 's|.*<quarkiverse-cxf\.version>\(.*\)</quarkiverse-cxf\.version>.*|\1|' | tr -d ' ')
HASH=$(printf "${CAMEL_VER}\n${CXF_VER}\n" | sha256sum | cut -c1-16)
echo "key=third-party-maven-${HASH}" >> $GITHUB_OUTPUT
fi
- name: Restore Maven Cache
if: ${{ inputs.action == 'restore' }}
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ${{ inputs.cache-paths }}
key: ${{ steps.resolve-key.outputs.key }}
- name: Download Maven Repo
if: ${{ inputs.action == 'restore' && inputs.download-maven-repo == 'true' }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: maven-repo
path: ..
- name: Extract Maven Repo
if: ${{ inputs.action == 'restore' && inputs.download-maven-repo == 'true' }}
shell: bash
run: |
df -h /
tar -xzf ../maven-repo.tgz -C ~
rm -f ../maven-repo.tgz
df -h /
- name: Save Maven Cache
if: ${{ inputs.action == 'save' }}
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ${{ inputs.cache-paths }}
key: ${{ inputs.cache-key }}
179 changes: 40 additions & 139 deletions .github/workflows/camel-master-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
outputs:
matrix: ${{ steps.set-native-matrix.outputs.matrix }}
examples-matrix: ${{ steps.set-examples-matrix.outputs.examples-matrix }}
alternate-jvm-matrix: ${{ steps.set-alternate-jvm-matrix.outputs.alternate-jvm-matrix }}
cache-key: ${{ steps.maven-cache.outputs.cache-key }}
env:
MAVEN_OPTS: -Xmx4600m
steps:
Expand All @@ -57,6 +57,9 @@ jobs:
with:
ref: camel-main
fetch-depth: 0
- name: Setup Maven Cache
id: maven-cache
uses: ./.github/actions/setup-maven-cache
- name: Rebase branch main onto camel-main
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
Expand Down Expand Up @@ -96,23 +99,17 @@ jobs:
name: maven-repo
path: ${{ runner.temp }}/maven-repo.tgz
retention-days: 1
- name: Save Maven Cache
uses: ./.github/actions/setup-maven-cache
if: always()
with:
action: save
cache-key: ${{ steps.maven-cache.outputs.cache-key }}
- name: Setup Native Test Matrix
id: set-native-matrix
run: |
CATEGORIES=$(yq -M -N -I 0 -o=json e 'keys' tooling/scripts/test-categories.yaml | tr '"' "'")
echo "matrix={'category': ${CATEGORIES}}" >> $GITHUB_OUTPUT
- name: Setup Alternate JVM Matrix
id: set-alternate-jvm-matrix
shell: bash
run: |
cd integration-tests
mvn help:evaluate -Dexpression=project.modules -N -q -DforceStdout | sed -e 's/<[^>]*>//g' -e 's/^[[:space:]]*//' -e '/^$/d' > ${{ runner.temp }}/itest-modules.txt
MODULE_COUNT=$(wc -l < ${{ runner.temp }}/itest-modules.txt)
GROUP1_COUNT=$((MODULE_COUNT / 2))
GROUP2_COUNT=$((MODULE_COUNT - GROUP1_COUNT))
GROUP1_MODULES=$(head -n $GROUP1_COUNT ${{ runner.temp }}/itest-modules.txt | tr '\n' ',' | sed 's/,$//')
GROUP2_MODULES=$(tail -n $GROUP2_COUNT ${{ runner.temp }}/itest-modules.txt | tr '\n' ',' | sed 's/,$//')
echo "alternate-jvm-matrix={'include': [{'name': 'group-01', 'modules': '${GROUP1_MODULES}'},{'name': 'group-02', 'modules': '${GROUP2_MODULES}'}]}" >> $GITHUB_OUTPUT
- name: Setup Examples Matrix
id: set-examples-matrix
run: |
Expand Down Expand Up @@ -144,23 +141,16 @@ jobs:
fail-fast: false
matrix: ${{ fromJson(needs.initial-mvn-install.outputs.matrix) }}
steps:
- name: Download Maven Repo
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: maven-repo
path: ..
- name: Extract Maven Repo
shell: bash
run: |
df -h /
tar -xzf ../maven-repo.tgz -C ~
rm -f ../maven-repo.tgz
df -h /
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: camel-main
fetch-depth: 0
- name: Setup Maven Cache
uses: ./.github/actions/setup-maven-cache
with:
cache-key: ${{ needs.initial-mvn-install.outputs.cache-key }}
download-maven-repo: 'true'
- name: Reclaim Disk Space
run: .github/reclaim-disk-space.sh
- name: Rebase branch main onto camel-main
Expand Down Expand Up @@ -231,23 +221,16 @@ jobs:
env:
MAVEN_OPTS: -Xmx3000m
steps:
- name: Download Maven Repo
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: maven-repo
path: ..
- name: Extract Maven Repo
shell: bash
run: |
df -h /
tar -xzf ../maven-repo.tgz -C ~
rm -f ../maven-repo.tgz
df -h /
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: camel-main
fetch-depth: 0
- name: Setup Maven Cache
uses: ./.github/actions/setup-maven-cache
with:
cache-key: ${{ needs.initial-mvn-install.outputs.cache-key }}
download-maven-repo: 'true'
- name: Rebase branch main onto camel-main
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
Expand Down Expand Up @@ -333,23 +316,16 @@ jobs:
env:
MAVEN_OPTS: -Xmx3000m
steps:
- name: Download Maven Repo
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: maven-repo
path: ..
- name: Extract Maven Repo
shell: bash
run: |
df -h /
tar -xzf ../maven-repo.tgz -C ~
rm -f ../maven-repo.tgz
df -h /
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: camel-main
fetch-depth: 0
- name: Setup Maven Cache
uses: ./.github/actions/setup-maven-cache
with:
cache-key: ${{ needs.initial-mvn-install.outputs.cache-key }}
download-maven-repo: 'true'
- name: Rebase branch main onto camel-main
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
Expand Down Expand Up @@ -378,62 +354,6 @@ jobs:
run: |
./mvnw ${CQ_MAVEN_ARGS} verify -N -Pbuild-notification -Dstatus=${{ job.status }} -DissueId=${{ env.ISSUE_ID }} -Dtoken=${{ secrets.GITHUB_TOKEN }} -DbuildId=$(cat ~/build-data/build-id.txt) -Drepo=${GITHUB_REPOSITORY} -Dbranch=camel-main -Dbranch-commit=$(cat ~/build-data/main-sha.txt)

integration-tests-alternative-jdk:
runs-on: ubuntu-latest
needs: initial-mvn-install
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.initial-mvn-install.outputs.alternate-jvm-matrix) }}
env:
MAVEN_OPTS: -Xmx3000m
steps:
- name: Download Maven Repo
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: maven-repo
path: ..
- name: Extract Maven Repo
shell: bash
run: |
df -h /
tar -xzf ../maven-repo.tgz -C ~
rm -f ../maven-repo.tgz
df -h /
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: camel-main
fetch-depth: 0
- name: Rebase branch main onto camel-main
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git fetch origin main
git rebase $(cat ~/build-data/main-sha.txt)
- name: Reclaim Disk Space
run: .github/reclaim-disk-space.sh
- name: Set up JDK 21
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: 'temurin'
java-version: '21'
- name: cd integration-tests && mvn clean verify
shell: bash
env:
TEST_MODULES: ${{matrix.modules}}
run: |
cd integration-tests
../mvnw ${CQ_MAVEN_ARGS} ${BRANCH_OPTIONS} \
-pl "${TEST_MODULES// /,}" \
-Dformatter.skip -Dimpsort.skip -Denforcer.skip \
--fail-at-end \
clean verify
- name: Report test failures
uses: ./.github/actions/test-summary-report
if: ${{ failure() }}
with:
test-report-xml-base-dir: integration-tests

integration-tests-alternative-platform:
runs-on: ${{ matrix.os }}
needs: initial-mvn-install
Expand All @@ -444,21 +364,16 @@ jobs:
env:
MAVEN_OPTS: -Xmx3000m
steps:
- name: Download Maven Repo
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: maven-repo
path: ..
- name: Extract Maven Repo
shell: bash
run: |
tar -xzf ../maven-repo.tgz -C ~
rm -f ../maven-repo.tgz
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: camel-main
fetch-depth: 0
- name: Setup Maven Cache
uses: ./.github/actions/setup-maven-cache
with:
cache-key: ${{ needs.initial-mvn-install.outputs.cache-key }}
download-maven-repo: 'true'
- name: Rebase branch main onto camel-main
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
Expand Down Expand Up @@ -502,23 +417,16 @@ jobs:
with:
distribution: 'temurin'
java-version: '17'
- name: Download Maven Repo
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: maven-repo
path: ..
- name: Extract Maven Repo
shell: bash
run: |
df -h /
tar -xzf ../maven-repo.tgz -C ~
rm -f ../maven-repo.tgz
df -h /
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: camel-main
fetch-depth: 0
- name: Setup Maven Cache
uses: ./.github/actions/setup-maven-cache
with:
cache-key: ${{ needs.initial-mvn-install.outputs.cache-key }}
download-maven-repo: 'true'
- name: Rebase branch main onto camel-main
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
Expand Down Expand Up @@ -587,23 +495,16 @@ jobs:
with:
distribution: 'temurin'
java-version: '17'
- name: Download Maven Repo
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: maven-repo
path: ..
- name: Extract Maven Repo
shell: bash
run: |
df -h /
tar -xzf ../maven-repo.tgz -C ~
rm -f ../maven-repo.tgz
df -h /
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: camel-main
fetch-depth: 0
- name: Setup Maven Cache
uses: ./.github/actions/setup-maven-cache
with:
cache-key: ${{ needs.initial-mvn-install.outputs.cache-key }}
download-maven-repo: 'true'
- name: Rebase branch main onto camel-main
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
Expand Down
Loading
Loading