blob: 72874d587623a24555c42f16906fc6466e04c7a6 [file] [log] [blame]
#
# 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: Daily Build Camel Master
on:
schedule:
# Run every day at midnight
- cron: '0 0 * * *'
env:
LANG: en_US
MAVEN_OPTS: -Xmx3000m
MAVEN_ARGS: -V -ntp -Dhttp.keepAlive=false -e
jobs:
build:
if: github.repository == 'apache/camel-quarkus'
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-native-matrix.outputs.matrix }}
steps:
- name: Clean VM
run: |
echo "Removing unwanted SDKs"
sudo rm -rf /usr/local/lib/android \
rm -rf /usr/local/share/boost \
rm -rf /usr/local/go \
rm -rf /usr/share/dotnet \
rm -rf /usr/share/rust
echo "Available disk space:"
df -h
- name: Set Workflow Build ID
run: |
[ ! -d ~/build-data ] && mkdir -p ~/build-data
echo "${{ github.run_id }}-${{ github.run_number }}-$(uuidgen)" > ~/build-data/build-id.txt
- name: Checkout
uses: actions/checkout@v2
with:
ref: camel-master
fetch-depth: 0
- name: Rebase branch master onto camel-master
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 master
git rebase origin/master
git rev-parse origin/master > ~/build-data/master-sha.txt
- name: Set up JDK 11
uses: AdoptOpenJDK/install-jdk@v1
with:
version: '11'
- name: Build Camel Quarkus
run: |
./mvnw ${MAVEN_ARGS} clean install -Papache-snapshots -pl '!docs'
- name: Tar Maven Repo
shell: bash
run: tar -czvf maven-repo.tgz -C ~ build-data .m2/repository
- name: Persist Maven Repo
uses: actions/upload-artifact@v2
with:
name: maven-repo
path: maven-repo.tgz
retention-days: 1
- name: Setup Native Test Matrix
id: set-native-matrix
run: |
sudo wget -O /usr/local/bin/yq "https://github.com/mikefarah/yq/releases/download/3.2.1/yq_linux_amd64"
sudo chmod +x /usr/local/bin/yq
CATEGORIES=$(cat tooling/scripts/test-categories.yaml | yq r - --printMode p "*." | sed "s/\(.*\)/'\1'/" | sed ':a;N;$!ba;s/\n/,/g')
echo "::set-output name=matrix::{'category': [${CATEGORIES}]}"
- name: Report Build Failure
if: failure()
run: |
# Abort rebase in case something went wrong as we may have broken pom.xml files
if [[ -e ".git/rebase" || -e ".git/rebase-apply" || -e ".git/rebase-merge" ]]; then
git rebase --abort
fi
./mvnw ${MAVEN_ARGS} verify -N -Pbuild-notification -Dstatus=${{ job.status }} -Dtoken=${{ secrets.GITHUB_TOKEN }} -DbuildId=$(cat ~/build-data/build-id.txt) -Drepo=${GITHUB_REPOSITORY} -Dbranch=camel-master -Dbranch-commit=$(cat ~/build-data/master-sha.txt)
native-tests:
name: Native Tests - ${{matrix.category}}
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.build.outputs.matrix) }}
steps:
- name: Download Maven Repo
uses: actions/download-artifact@v2
with:
name: maven-repo
path: .
- name: Extract Maven Repo
shell: bash
run: tar -xzvf maven-repo.tgz -C ~
- name: Checkout
uses: actions/checkout@v2
with:
ref: camel-master
fetch-depth: 0
- name: Rebase branch master onto camel-master
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 master
git rebase $(cat ~/build-data/master-sha.txt)
- name: Install yq
run: |
sudo wget -O /usr/local/bin/yq "https://github.com/mikefarah/yq/releases/download/3.2.1/yq_linux_amd64"
sudo chmod +x /usr/local/bin/yq
- name: Set up JDK 11
uses: AdoptOpenJDK/install-jdk@v1
with:
version: '11'
- name: Integration Tests
run: |
TEST_MODULES=""
for MODULE in $(cat tooling/scripts/test-categories.yaml | yq r - "${{ matrix.category }}.*"); do
if [ "${MODULE}" == "-" ]; then
continue
fi
TEST_MODULES="${TEST_MODULES} ${MODULE}"
done
TEST_MODULES=$(echo ${TEST_MODULES} | sed 's/^[ \t]*//;s/[ \t]*$//')
if [ -z "${TEST_MODULES}" ]; then
echo "No test modules were found for category ${{ matrix.category }}"
exit 1
fi
for i in ${TEST_MODULES}
do modules+=("integration-tests/$i");
done
IFS=,
eval ./mvnw clean verify \
-Papache-snapshots \
-Dnative \
-Ddocker \
-pl "${modules[*]}"
- name: Report Build Failure
if: failure()
run: |
./mvnw ${MAVEN_ARGS} verify -N -Pbuild-notification -Dstatus=${{ job.status }} -Dtoken=${{ secrets.GITHUB_TOKEN }} -DbuildId=$(cat ~/build-data/build-id.txt) -Drepo=${GITHUB_REPOSITORY} -Dbranch=camel-master -Dbranch-commit=$(cat ~/build-data/master-sha.txt)
handle-build-status:
needs: native-tests
runs-on: ubuntu-latest
steps:
- name: Download Maven Repo
uses: actions/download-artifact@v2
with:
name: maven-repo
path: .
- name: Extract Maven Repo
shell: bash
run: tar -xzvf maven-repo.tgz -C ~
- name: Checkout
uses: actions/checkout@v2
with:
ref: camel-master
fetch-depth: 0
- name: Rebase branch master onto camel-master
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 master
git rebase $(cat ~/build-data/master-sha.txt)
- name: Report build status
id: report
run: |
./mvnw ${MAVEN_ARGS} verify -N -Pbuild-notification -Dstatus=verify -Dtoken=${{ secrets.GITHUB_TOKEN }} -DbuildId=$(cat ~/build-data/build-id.txt) -Drepo=${GITHUB_REPOSITORY} -Dbranch=camel-master -Dbranch-commit=$(cat ~/build-data/master-sha.txt)
- name: Sync branch Master to Camel Master
if: steps.report.outputs.overall_build_status == 'success'
run: |
git push --force-with-lease origin camel-master