You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2023/04/15 16:32:40 UTC
[camel-k] branch main updated: Feat/coverage badge (#4260)
This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/main by this push:
new 769c62507 Feat/coverage badge (#4260)
769c62507 is described below
commit 769c625075dd18cff277bcf20a2c81a1b184d568
Author: Martin Olšiak <56...@users.noreply.github.com>
AuthorDate: Sat Apr 15 18:32:34 2023 +0200
Feat/coverage badge (#4260)
chore: nightly coverage badge
---------
Co-authored-by: Martin Olsiak <ma...@gmail.com>
Co-authored-by: github-actions[bot] <41...@users.noreply.github.com>
---
.github/workflows/nightly-coverage.yml | 93 ++++++++++++++++++++++++++++++++++
README.adoc | 1 +
2 files changed, 94 insertions(+)
diff --git a/.github/workflows/nightly-coverage.yml b/.github/workflows/nightly-coverage.yml
new file mode 100644
index 000000000..a6a0632aa
--- /dev/null
+++ b/.github/workflows/nightly-coverage.yml
@@ -0,0 +1,93 @@
+# ---------------------------------------------------------------------------
+# 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: coverage
+
+on:
+ schedule:
+ - cron: '45 1 * * *'
+ workflow_dispatch:
+
+jobs:
+ test:
+ runs-on: ubuntu-20.04
+ name: Update Coverage Badge
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ persist-credentials: false
+ fetch-depth: 0
+
+ - name: Setup go
+ uses: actions/setup-go@v3
+ with:
+ go-version: '1.18'
+ check-latest: true
+
+ - uses: actions/cache@v3
+ with:
+ path: ~/go/pkg/mod
+ key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
+ restore-keys: |
+ ${{ runner.os }}-go-
+
+ - name: Run Test
+ run: |
+ go test -v ./... -covermode=count -coverprofile=coverage.out
+ go tool cover -func=coverage.out -o=coverage.out
+ touch badge.out
+
+ - name: Go Coverage Badge
+
+ uses: tj-actions/coverage-badge-go@v2
+ with:
+ filename: coverage.out
+ target: badge.out
+
+ - name: Convert Badge to adoc
+ run: |
+ replacement=$(grep -o 'https://[^)]*' badge.out)
+ target="(?:https:\/\/img\.shields\.io\/badge\/Coverage).*?(?=\.svg)"
+ perl -i -pe "s|${target}|${replacement}|g" README.adoc
+
+
+ - name: Verify Changed files
+ uses: tj-actions/verify-changed-files@v12
+ id: verify-changed-files
+ with:
+ files: README.adoc
+
+ - name: Commit changes
+ shell: bash
+ env:
+ CI_USER: "github-actions[bot]"
+ CI_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
+ run: |
+ git config --local user.email "$CI_EMAIL"
+ git config --local user.name "$CI_USER"
+ git add -A && git commit -m 'chore: nightly coverage badge' && echo "refresh=1" >> $GITHUB_ENV || echo "No changes to make update-docs"
+
+ - name: Push changes
+ shell: bash
+ if: env.changelog == 1 || env.refresh == 1
+ env:
+ CI_USER: "github-actions[bot]"
+ CI_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
+ CI_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ git push "https://$CI_USER:$CI_TOKEN@github.com/$GITHUB_REPOSITORY.git" '${{ github.ref_name }}'
\ No newline at end of file
diff --git a/README.adoc b/README.adoc
index 4e501fa38..d07ad3186 100644
--- a/README.adoc
+++ b/README.adoc
@@ -11,6 +11,7 @@ image:https://github.com/apache/camel-k/workflows/kubernetes/badge.svg["Kubernet
image:https://github.com/apache/camel-k/workflows/knative/badge.svg["Knative", link="https://github.com/apache/camel-k/actions/workflows/knative.yml"]
image:https://github.com/apache/camel-k/actions/workflows/nightly-release.yml/badge.svg["Nightly releases", link="https://github.com/apache/camel-k/actions/workflows/nightly-release.yml"]
image:https://github.com/apache/camel-k/actions/workflows/nightly-native-test.yml/badge.svg["Quarkus native", link="https://github.com/apache/camel-k/actions/workflows/nightly-native-test.yml"]
+image:https://img.shields.io/badge/Coverage-39.6%25-yellow.svg["Go coverage", link="https://github.com/apache/camel-k/actions/workflows/nightly-coverage.yml"]
image:https://img.shields.io/badge/zulip-join_chat-brightgreen.svg["Chat on Zulip", link="https://camel.zulipchat.com"]
Apache Camel K is a lightweight integration framework built from **Apache Camel** that runs natively on Kubernetes and is specifically designed for serverless and microservice architectures. Users of `Camel K` can instantly run integration code written in Camel DSL on their preferred **Cloud** provider.