Skip to content

Commit

Permalink
fix(ci): remove coverage from downstream
Browse files Browse the repository at this point in the history
  • Loading branch information
squakez committed Apr 10, 2024
1 parent f7b2c0e commit 67325e8
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 46 deletions.
42 changes: 2 additions & 40 deletions .github/actions/e2e-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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 }}/
run: make
8 changes: 2 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ on:
- "release-*"
paths-ignore:
- 'docs/**'
- 'java/**'
- 'proposals/**'
- '**.adoc'
- '**.md'
Expand All @@ -40,7 +39,6 @@ on:
- "release-*"
paths-ignore:
- 'docs/**'
- 'java/**'
- 'proposals/**'
- '**.md'
- '**.adoc'
Expand All @@ -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
32 changes: 32 additions & 0 deletions ci/downstream/.github/actions/e2e-build/action.yml
Original file line number Diff line number Diff line change
@@ -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
71 changes: 71 additions & 0 deletions ci/downstream/.github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 67325e8

Please sign in to comment.