From 67325e8d19eba744b575ca4c2092fa82000eca62 Mon Sep 17 00:00:00 2001 From: Pasquale Congiusti Date: Wed, 10 Apr 2024 09:55:34 +0200 Subject: [PATCH] fix(ci): remove coverage from downstream --- .github/actions/e2e-build/action.yml | 42 +---------- .github/workflows/build.yml | 8 +-- .../.github/actions/e2e-build/action.yml | 32 +++++++++ ci/downstream/.github/workflows/build.yml | 71 +++++++++++++++++++ 4 files changed, 107 insertions(+), 46 deletions(-) create mode 100644 ci/downstream/.github/actions/e2e-build/action.yml create mode 100644 ci/downstream/.github/workflows/build.yml diff --git a/.github/actions/e2e-build/action.yml b/.github/actions/e2e-build/action.yml index 5dda564d52..2b330c6d0b 100644 --- a/.github/actions/e2e-build/action.yml +++ b/.github/actions/e2e-build/action.yml @@ -18,11 +18,6 @@ name: e2e-build description: 'End-to-End tests for build use-cases' -inputs: - artifact-name: - description: 'The name of the artifact to store coverage results' - required: true - runs: using: "composite" @@ -32,39 +27,6 @@ runs: name: Prepare Test Environment uses: ./.github/actions/kamel-prepare-env - - name: Test new branch - shell: bash - run: | - COVERAGE_OPTS="-covermode=count -coverprofile=coverage.out" make build - - # Only run these on pull request events - - name: Save new coverage value - if: github.event_name == 'pull_request' + - name: Test shell: bash - run: | - mkdir -p /tmp/${{ inputs.artifact-name }} - go tool cover -func=coverage.out -o=coverage.out - grep -o -P '(?<=\(statements\))(.+)(?=%)' coverage.out | xargs > /tmp/${{ inputs.artifact-name }}/coverage_new - echo ${{ github.event.number }} > /tmp/${{ inputs.artifact-name }}/id - - - name: Checkout target branch code - if: github.event_name == 'pull_request' - uses: actions/checkout@v4 - with: - persist-credentials: false - submodules: recursive - ref: ${{ github.event.pull_request.base.ref }} - - - name: Test and save target coverage value - if: github.event_name == 'pull_request' - shell: bash - run: | - COVERAGE_OPTS="-covermode=count -coverprofile=coverage.out" make build - go tool cover -func=coverage.out -o=coverage.out - grep -o -P '(?<=\(statements\))(.+)(?=%)' coverage.out | xargs > /tmp/${{ inputs.artifact-name }}/coverage_old - - - uses: actions/upload-artifact@v4 - if: github.event_name == 'pull_request' - with: - name: ${{ inputs.artifact-name }} - path: /tmp/${{ inputs.artifact-name }}/ \ No newline at end of file + run: make \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4671baa0c7..f1d3264ffa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,7 +27,6 @@ on: - "release-*" paths-ignore: - 'docs/**' - - 'java/**' - 'proposals/**' - '**.adoc' - '**.md' @@ -40,7 +39,6 @@ on: - "release-*" paths-ignore: - 'docs/**' - - 'java/**' - 'proposals/**' - '**.md' - '**.adoc' @@ -65,11 +63,9 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: persist-credentials: false submodules: recursive - name: Execute Build (make) - uses: ./.github/actions/e2e-build - with: - artifact-name: pr + uses: ./.github/actions/e2e-build \ No newline at end of file diff --git a/ci/downstream/.github/actions/e2e-build/action.yml b/ci/downstream/.github/actions/e2e-build/action.yml new file mode 100644 index 0000000000..2b330c6d0b --- /dev/null +++ b/ci/downstream/.github/actions/e2e-build/action.yml @@ -0,0 +1,32 @@ +# --------------------------------------------------------------------------- +# 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: e2e-build +description: 'End-to-End tests for build use-cases' + +runs: + using: "composite" + + steps: + + - id: prepare-env + name: Prepare Test Environment + uses: ./.github/actions/kamel-prepare-env + + - name: Test + shell: bash + run: make \ No newline at end of file diff --git a/ci/downstream/.github/workflows/build.yml b/ci/downstream/.github/workflows/build.yml new file mode 100644 index 0000000000..f1d3264ffa --- /dev/null +++ b/ci/downstream/.github/workflows/build.yml @@ -0,0 +1,71 @@ +# --------------------------------------------------------------------------- +# 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 + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +on: + pull_request: + branches: + - main + - "release-*" + paths-ignore: + - 'docs/**' + - 'proposals/**' + - '**.adoc' + - '**.md' + - 'KEYS' + - 'LICENSE' + - 'NOTICE' + push: + branches: + - main + - "release-*" + paths-ignore: + - 'docs/**' + - 'proposals/**' + - '**.md' + - '**.adoc' + - 'KEYS' + - 'LICENSE' + - 'NOTICE' + workflow_dispatch: + inputs: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + +jobs: + build: + strategy: + matrix: + # TODO: test an all the supported OS + # [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest] + + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + persist-credentials: false + submodules: recursive + - name: Execute Build (make) + uses: ./.github/actions/e2e-build \ No newline at end of file