This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch camel-4.4.x in repository https://gitbox.apache.org/repos/asf/camel.git
commit 738ca25dbcadbb811b764b8a4492e6f096710ae5 Author: Otavio Rodolfo Piske <angusyo...@gmail.com> AuthorDate: Wed Jan 8 10:16:08 2025 +0100 (chores) ci: removed quick-test and older Camel 3 automation --- .github/actions/quick-test/action.yaml | 57 -------- .github/actions/quick-test/quick-test.sh | 216 ----------------------------- .github/workflows/component-pr.yaml | 101 +------------- .github/workflows/push-build-camel-3.yml | 82 ----------- .github/workflows/push-build-camel-40x.yml | 82 ----------- 5 files changed, 1 insertion(+), 537 deletions(-) diff --git a/.github/actions/quick-test/action.yaml b/.github/actions/quick-test/action.yaml deleted file mode 100644 index ea802873dd8..00000000000 --- a/.github/actions/quick-test/action.yaml +++ /dev/null @@ -1,57 +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: "Quick Test Runner" -description: "Runs a tests only for the changed components" -inputs: - start-commit: # id of input - description: 'Starting commit' - required: true - end-commit: # id of input - description: 'End commit' - required: true - github-token: # id of input - description: 'Github hub token' - required: true -outputs: - result: - description: "Quick test result" - value: ${{ steps.quick-test.outputs.result }} - component-count: - description: "Number of modified components" - value: ${{ steps.quick-test.outputs.component-count }} - failures-count: - description: "Number of errors" - value: ${{ steps.quick-test.outputs.failures-count }} -runs: - using: "composite" - steps: - - id: quick-test - run: ${{ github.action_path }}/quick-test.sh ${{ inputs.start-commit }} ${{ inputs.end-commit }} - shell: bash - - name: Save PR number - if: always() - env: - PR_NUMBER: ${{ github.event.number }} - shell: bash - run: echo $PR_NUMBER > ./automated-build-log/pr_number - - name: archive logs - uses: actions/upload-artifact@v3 - if: always() - with: - name: test-logs - path: automated-build-log/**/* diff --git a/.github/actions/quick-test/quick-test.sh b/.github/actions/quick-test/quick-test.sh deleted file mode 100755 index 036d41d319f..00000000000 --- a/.github/actions/quick-test/quick-test.sh +++ /dev/null @@ -1,216 +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. -# - -# This script runs a quick test for modified components -# It receives a starting and end commit IDs and verifies if any component was modified between them. -# It iterates through the list of components, running a unit and integration tests with -Psourcecheck -# The result and other important data is saved on log files (i.e.: test log, the PR number and the result message). -# The log file is archived by the action (see: action.yaml file) - -echo "Using MVND_OPTS=$MVND_OPTS" - -# Script variables -failures=0 -successes=0 -maxNumberOfTestableComponents=20 -basedir=$(pwd) -testDate=$(date '+%Y-%m-%d-%H%M%S') -logDir=${basedir}/automated-build-log -testHost=$(hostname) - -# How to test this code: -# -# Set the GITHUB_STEP_SUMMARY variable and select a commit range containing changes core, components or both: -# GITHUB_STEP_SUMMARY=$HOME/tmp/step-summary.txt ./.github/actions/quick-test/quick-test.sh beginning end. -# -# For instance: -# GITHUB_STEP_SUMMARY=$HOME/tmp/step-summary.txt ./.github/actions/quick-test/quick-test.sh 74e90da8ec55afe5065d5de495df7fe7a 9e05505d7eaad98c55d67a09cae8aa9505253c72 - -function notifySuccess() { - local component=$1 - local total=$2 - local current=$3 - - echo "${component} test completed successfully: ${current} verified / ${failures} failed" - echo "| ${component} | :white_check_mark: pass" >> $GITHUB_STEP_SUMMARY -} - -function notifyError() { - local component=$1 - local total=$2 - local current=$3 - - echo "Failed ${component} test: ${current} verified / ${failures} failed" - echo "| ${component} | :x: fail" >> $GITHUB_STEP_SUMMARY -} - -function resetCounters() { - current=0 - failures=0 - successes=0 -} - -function setResultValue() { - local value=$1 - local file=$2 - - echo "$1" > "$file" -} - -function setComponentTestResults() { - local tested=$1 - local failures=$2 - local successes=$3 - - setResultValue "$tested" "${logDir}/components-tested" - setResultValue "$failures" "${logDir}/components-failures" - setResultValue "$successes" "${logDir}/components-successes" -} - -function setCoreTestResults() { - local tested=$1 - local failures=$2 - local successes=$3 - - setResultValue "$tested" "${logDir}/core-tested" - setResultValue "$failures" "${logDir}/core-failures" - setResultValue "$successes" "${logDir}/core-successes" -} - -function runTest() { - local component=$1 - local total=$2 - local current=$3 - - echo "############################################################" - echo "Testing component ${current} of ${total}: ${component}" - echo "############################################################" - echo "" - - echo "Logging test to ${logDir}/${component/\//-}.log" - ${basedir}/mvnw -l "${logDir}/${component/\//-}.log" -Psourcecheck ${MVND_OPTS} verify - if [[ $? -ne 0 ]]; then - ((failures++)) - notifyError "${component}" "${total}" "${current}" "${failures}" - else - ((successes++)) - notifySuccess "${component}" "${total}" "${current}" "${failures}" - fi - - local shortName=$(basename "${component}") - local testLog="target/${shortName}-test.log" - if [[ -f "$testLog" ]] ; then - echo "Copying test log file at ${testLog} to the log directory" - mv "${testLog}" "${logDir}"/ - else - echo "There is no log file to copy at ${testLog}" - fi -} - -function componentTest() { - local component=$1 - local total=$2 - local current=$3 - - if [[ -d "${basedir}/${component}" ]] ; then - cd "${basedir}/${component}" - runTest "${component}" "${total}" "${current}" - else - echo "Skipping modified entity ${basedir}/${component} because it's not a directory" - fi -} - -function coreTest() { - echo "| Core | Result |" >> $GITHUB_STEP_SUMMARY - echo "| --- | --- |" >> $GITHUB_STEP_SUMMARY - - cd "core" - runTest "core" "1" "1" - find . -iname '*test*.log' -exec mv {} "${logDir}"/ \; -} - -function testComponents() { - local current=0 - local startCommit=${1:-""} - local endCommit=${2:-""} - - mkdir -p "${logDir}" - - echo "Searching for modified components" - local components=$(git diff "${startCommit}..${endCommit}" --name-only --pretty=format:"" | grep -e '^components' | grep -v "camel-aws" | grep -v -e '^$' | cut -d / -f 1-2 | uniq | sort) - local componentsAws=$(git diff "${startCommit}..${endCommit}" --name-only --pretty=format:"" | grep -e '^components' | grep "camel-aws" | grep -v -e '^$' | cut -d / -f 1-3 | uniq | sort) - - if [[ -z "${components}" ]] ; then - components="${componentsAws}" - else - components=$(printf '%s\n%s' "${components}" "${componentsAws}") - fi - - local total=$(echo "${components}" | grep -v -e '^$' | wc -l) - - echo "${total}" > "${logDir}/components-total" - if [[ ${total} -eq 0 ]]; then - setComponentTestResults 0 0 0 - exit 0 - else - if [[ ${total} -gt ${maxNumberOfTestableComponents} ]]; then - setComponentTestResults 0 0 0 - exit 0 - fi - fi - - echo "It will test the following ${total} components:" - echo "${components}" - - echo "" >> $GITHUB_STEP_SUMMARY - echo "| Component | Result |" >> $GITHUB_STEP_SUMMARY - echo "| --- | --- |" >> $GITHUB_STEP_SUMMARY - - resetCounters - for component in $(echo $components); do - ((current++)) - componentTest "${component}" "${total}" "${current}" - done - - setComponentTestResults "$total" "$failures" "$successes" - - exit "${failures}" -} - -function testCore() { - local current=0 - local startCommit=${1:-""} - local endCommit=${2:-""} - - mkdir -p "${logDir}" - resetCounters - - setCoreTestResults 0 0 0 - echo "Searching for camel core changes" - local core=$(git diff "${startCommit}..${endCommit}" --name-only --pretty=format:"" | grep -e '^core' | grep -v -e '^$' | cut -d / -f 1 | uniq | sort) - if [[ ! -z "${core}" ]] ; then - coreTest - setCoreTestResults "1" "$failures" "$successes" - fi -} - -function main() { - testCore "$@" - testComponents "$@" -} - -main "$@" diff --git a/.github/workflows/component-pr.yaml b/.github/workflows/component-pr.yaml index 9d47b7fcadf..310074efdf2 100644 --- a/.github/workflows/component-pr.yaml +++ b/.github/workflows/component-pr.yaml @@ -26,10 +26,6 @@ on: - 'parent/**' - 'core/**' - 'components/**' - workflow_run: - workflows: [ "PR Build (Camel 3.x)" ] - types: - - completed permissions: {} jobs: @@ -70,99 +66,4 @@ jobs: * :warning: Be careful when sharing logs. Review their contents before sharing them publicly.` - }) - - name: 'Download artifact' - uses: actions/github-script@v7 - if: | - github.event_name == 'workflow_run' - with: -# Secure download based on: -# - https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ -# - https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run - script: | - var artifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: ${{github.event.workflow_run.id }}, - }); - var matchArtifact = artifacts.data.artifacts.filter((artifact) => { - return artifact.name == "test-logs" - })[0]; - var download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - var fs = require('fs'); - fs.writeFileSync('${{github.workspace}}/test-logs.zip', Buffer.from(download.data)); - - run: unzip test-logs.zip - if: | - github.event_name == 'workflow_run' - - uses: actions/github-script@v7 - if: | - github.event_name == 'workflow_run' - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - let fs = require('fs'); - let issue_number = Number(fs.readFileSync('./pr_number')); - let componentsTotal = Number(fs.readFileSync('./components-total')); - let componentsTested = Number(fs.readFileSync('./components-tested')); - let componentsFailures = Number(fs.readFileSync('./components-failures')); - let componentsSuccesses = Number(fs.readFileSync('./components-successes')); - - var message = "" - - if (componentsTested === 0) { - if (componentsTotal === 0) { - message = ":no_entry_sign: There are (likely) no components to be tested in this PR" - } else { - if (componentsTotal > 20) { - message = `:leftwards_arrow_with_hook: There are either **too many** changes to be tested in this PR or the code **needs be rebased**: (${componentsTotal} components likely to be affected)` - } - } - } else { - message = `### Components test results: - - | Total | Tested | Failed :x: | Passed :white_check_mark: | - | --- | --- | --- | --- | - | ${componentsTotal} | ${componentsTested} | ${componentsFailures} | ${componentsSuccesses} |` - } - - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: issue_number, - body: message - }); - - uses: actions/github-script@v7 - if: | - github.event_name == 'workflow_run' - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - let fs = require('fs'); - let issue_number = Number(fs.readFileSync('./pr_number')); - let coreTested = Number(fs.readFileSync('./core-tested')); - let coreFailures = Number(fs.readFileSync('./core-failures')); - let coreSuccesses = Number(fs.readFileSync('./core-successes')); - - var message = "" - - if (coreTested === 0) { - message = ":no_entry_sign: There are (likely) no changes in core core to be tested in this PR" - } else { - message = `### Core test results: - - | Tested | Failed :x: | Passed :white_check_mark: | - | --- | --- | --- | - | ${coreTested} | ${coreFailures} | ${coreSuccesses} |` - } - - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: issue_number, - body: message - }); + }) \ No newline at end of file diff --git a/.github/workflows/push-build-camel-3.yml b/.github/workflows/push-build-camel-3.yml deleted file mode 100644 index 229f29ea59a..00000000000 --- a/.github/workflows/push-build-camel-3.yml +++ /dev/null @@ -1,82 +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: Reformat and Build (Camel 3.x) - -on: - push: - branches: - - camel-3.x - paths-ignore: - - .github/**/* - - README.md - - SECURITY.md - - Jenkinsfile - - Jenkinsfile.* - - NOTICE.txt - -permissions: {} -jobs: - build: - if: github.repository == 'apache/camel' - permissions: - contents: write # to create branch (peter-evans/create-pull-request) - pull-requests: write # to create a PR (peter-evans/create-pull-request) - - runs-on: ubuntu-latest - strategy: - matrix: - java: [ '11' ] - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - id: install-mvnd - uses: ./.github/actions/install-mvnd - - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: ${{ matrix.java }} - cache: 'maven' - - name: mvn formatter and build - run: ${{ steps.install-mvnd.outputs.mvnd-dir }}/mvnd -l build.log $MVND_OPTS -Pformat,fastinstall -DskipTests verify - - name: archive logs - uses: actions/upload-artifact@v4 - if: always() - with: - name: build.log - path: build.log - - name: Create Pull Request - uses: peter-evans/create-pull-request@v6 - with: - base: camel-3.x - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: "Regen for commit ${{ github.sha }}" - committer: GitHub <nore...@github.com> - author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> - signoff: true - branch: regen_bot_3x - title: "Generated sources regen (Camel 3)" - body: | - Regen bot :robot: found some uncommitted changes after running build on :camel: `camel-3` branch. - Please do not delete `regen_bot` branch after merge/rebase. - labels: | - regen - automated pr - camel-3 - assignees: oscerd diff --git a/.github/workflows/push-build-camel-40x.yml b/.github/workflows/push-build-camel-40x.yml deleted file mode 100644 index 7e887f4470e..00000000000 --- a/.github/workflows/push-build-camel-40x.yml +++ /dev/null @@ -1,82 +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: Reformat and Build (Camel 4) - -on: - push: - branches: - - camel-4.0.x - paths-ignore: - - .github/**/* - - README.md - - SECURITY.md - - Jenkinsfile - - Jenkinsfile.* - - NOTICE.txt - -permissions: {} -jobs: - build: - if: github.repository == 'apache/camel' - permissions: - contents: write # to create branch (peter-evans/create-pull-request) - pull-requests: write # to create a PR (peter-evans/create-pull-request) - - runs-on: ubuntu-latest - strategy: - matrix: - java: [ '17' ] - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - id: install-mvnd - uses: ./.github/actions/install-mvnd - - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: ${{ matrix.java }} - cache: 'maven' - - name: mvn formatter and build - run: ${{ steps.install-mvnd.outputs.mvnd-dir }}/mvnd -l build.log -Dquickly package - - name: archive logs - uses: actions/upload-artifact@v4 - if: always() - with: - name: build.log - path: build.log - - name: Create Pull Request - uses: peter-evans/create-pull-request@v6 - with: - base: main - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: "Regen for commit ${{ github.sha }}" - committer: GitHub <nore...@github.com> - author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> - signoff: true - branch: regen_bot_40x - title: "Generated sources regen" - body: | - Regen bot :robot: found some uncommitted changes after running build on :camel: `camel-4.0.x` branch. - Please do not delete `regen_bot` branch after merge/rebase. - labels: | - regen - automated pr - camel-4.0 - assignees: oscerd