You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2023/07/10 17:46:43 UTC
[camel] 01/01: incmental-build - Replace quick-test with incremental test
This is an automated email from the ASF dual-hosted git repository.
nfilotto pushed a commit to branch github-actions-incremental-build
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 6d715ed7f906d760326b435ee479f7d3c3015524
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Mon Jul 10 19:46:21 2023 +0200
incmental-build - Replace quick-test with incremental test
---
.github/actions/component-test/action.yaml | 88 ------------------------
.github/actions/component-test/component-test.sh | 53 --------------
.github/workflows/pr-build-main.yml | 33 ---------
.github/workflows/pr-comment.yml | 75 --------------------
4 files changed, 249 deletions(-)
diff --git a/.github/actions/component-test/action.yaml b/.github/actions/component-test/action.yaml
deleted file mode 100644
index 2d7737a038c..00000000000
--- a/.github/actions/component-test/action.yaml
+++ /dev/null
@@ -1,88 +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: "Component Test Runner"
-description: "Runs tests of corresponding to the given comment"
-inputs:
- github-token:
- description: 'GitHub token to use to update the comment'
- required: true
- run-id:
- description: 'Id of the job'
- required: true
- pr-id:
- description: 'Id of the pull request to update'
- required: true
- comment-id:
- description: 'Id of the comment to process'
- required: true
- comment-body:
- description: 'Body of the comment to process'
- required: true
-runs:
- using: "composite"
- steps:
- - id: install-mvnd
- uses: ./.github/actions/install-mvnd
- - name: maven build
- shell: bash
- run: ${{ github.action_path }}/component-test.sh ${{ steps.install-mvnd.outputs.mvnd-dir }}/mvnd "${{ inputs.comment-body }}" true build.log
- - name: archive logs
- uses: actions/upload-artifact@v3
- if: always()
- with:
- name: build.log
- path: build.log
- - name: maven test
- shell: bash
- run: ${{ github.action_path }}/component-test.sh ${{ steps.install-mvnd.outputs.mvnd-dir }}/mvnd "${{ inputs.comment-body }}" false tests.log
- - name: archive logs
- uses: actions/upload-artifact@v3
- if: always()
- with:
- name: tests.log
- path: tests.log
- - name: Success comment
- if: success()
- uses: actions/github-script@v6
- with:
- github-token: ${{ inputs.github-token }}
- script: |
- await github.rest.issues.updateComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: ${{ inputs.pr-id }},
- comment_id: ${{ inputs.comment-id }},
- body: `${{ inputs.comment-body }}
-
- **Result** :white_check_mark: The tests passed successfully`
- });
- - name: Failure comment
- if: failure()
- uses: actions/github-script@v6
- with:
- github-token: ${{ inputs.github-token }}
- script: |
- await github.rest.issues.updateComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: ${{ inputs.pr-id }},
- comment_id: ${{ inputs.comment-id }},
- body: `${{ inputs.comment-body }}
-
- **Result** :x: The tests failed please [check the logs](https://github.com/apache/camel/actions/runs/${{ inputs.run-id }})`
- });
diff --git a/.github/actions/component-test/component-test.sh b/.github/actions/component-test/component-test.sh
deleted file mode 100755
index 68efe60e73a..00000000000
--- a/.github/actions/component-test/component-test.sh
+++ /dev/null
@@ -1,53 +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.
-#
-
-echo "Using MVND_OPTS=$MVND_OPTS"
-
-function main() {
- local mavenBinary=${1}
- local commentBody=${2}
- local fastBuild=${3}
- local log=${4}
-
- if [[ ${commentBody} = /component-test* ]] ; then
- local componentList="${commentBody:16}"
- echo "The list of components to test is ${componentList}"
- else
- echo "No components has been detected, the expected format is '/component-test (camel-)component-name1 (camel-)component-name2...'"
- exit 1
- fi
- local pl=""
- for component in ${componentList}
- do
- if [[ ${component} = camel-* ]] ; then
- pl="$pl,components/${component}"
- else
- pl="$pl,components/camel-${component}"
- fi
- done
- pl="${pl:1}"
-
- if [[ ${fastBuild} = "true" ]] ; then
- echo "Launching a fast build against the projects ${pl} and their dependencies"
- $mavenBinary -l $log $MVND_OPTS -Dquickly install -pl "$pl" -am
- else
- echo "Launching tests of the projects ${pl}"
- $mavenBinary -l $log $MVND_OPTS install -pl "$pl"
- fi
-}
-
-main "$@"
diff --git a/.github/workflows/pr-build-main.yml b/.github/workflows/pr-build-main.yml
index 078eab2a9b8..c24b0823900 100644
--- a/.github/workflows/pr-build-main.yml
+++ b/.github/workflows/pr-build-main.yml
@@ -64,39 +64,6 @@ jobs:
shell: bash
run: |
[[ -z $(git status --porcelain) ]] || { echo 'There are uncommitted changes'; git status; echo; echo; git diff; exit 1; }
- - id: test
- name: Quick test execution for affected components
- uses: ./.github/actions/quick-test
- with:
- github-token: ${{ secrets.GITHUB_TOKEN }}
- start-commit: ${{ github.event.pull_request.base.sha }}
- end-commit: ${{ github.event.after }}
- incremental-build:
- if: github.repository == 'apache/camel'
- # Mark as optional since it is experimental
- continue-on-error: true
- runs-on: ubuntu-latest
- strategy:
- matrix:
- java: [ '17' ]
- steps:
- - uses: actions/checkout@v3
- with:
- persist-credentials: false
- - id: install-packages
- uses: ./.github/actions/install-packages
- - name: Set up JDK ${{ matrix.java }}
- uses: actions/setup-java@v3
- with:
- distribution: 'temurin'
- java-version: ${{ matrix.java }}
- cache: 'maven'
- - name: mvn build
- uses: ./.github/actions/incremental-build
- with:
- mode: build
- pr-id: ${{ github.event.number }}
- github-token: ${{ secrets.GITHUB_TOKEN }}
- name: mvn test
uses: ./.github/actions/incremental-build
with:
diff --git a/.github/workflows/pr-comment.yml b/.github/workflows/pr-comment.yml
deleted file mode 100644
index 9463ab2d2e0..00000000000
--- a/.github/workflows/pr-comment.yml
+++ /dev/null
@@ -1,75 +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: PR Comment Build
-
-on:
- issue_comment:
- types: [created]
-jobs:
- pr_commented:
- name: PR comment
- if: ${{ github.repository == 'apache/camel' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/component-test') }}
- permissions:
- pull-requests: write # to comment on a pull request
- actions: read # to download artifact
- runs-on: ubuntu-latest
- strategy:
- matrix:
- java: [ '17' ]
- steps:
- - uses: actions/github-script@v6
- with:
- github-token: ${{ secrets.GITHUB_TOKEN }}
- script: |
- github.rest.issues.createComment({
- issue_number: context.issue.number,
- owner: context.repo.owner,
- repo: context.repo.repo,
- body: `:robot: The Apache Camel test robot will run the tests for you :+1:`
- })
- - name: Retrieve sha
- uses: actions/github-script@v6
- with:
- github-token: ${{ secrets.GITHUB_TOKEN }}
- script: |
- const pr = await github.rest.pulls.get({
- owner: context.repo.owner,
- repo: context.repo.repo,
- pull_number: context.issue.number
- });
- core.exportVariable('pr_sha', pr.data.head.sha)
- - uses: actions/checkout@v3
- with:
- ref: ${{ env.pr_sha }}
- - id: install-packages
- uses: ./.github/actions/install-packages
- - name: Set up JDK ${{ matrix.java }}
- uses: actions/setup-java@v3
- with:
- distribution: 'temurin'
- java-version: ${{ matrix.java }}
- cache: 'maven'
- - id: test
- name: Component test execution
- uses: ./.github/actions/component-test
- with:
- github-token: ${{ secrets.GITHUB_TOKEN }}
- run-id: ${{ github.run_id }}
- pr-id: ${{ github.event.issue.number }}
- comment-id: ${{ github.event.comment.id }}
- comment-body: ${{ github.event.comment.body }}