From fb168e3f627b70d31aeb180a0c83f25d39fc3e3c Mon Sep 17 00:00:00 2001 From: Jan Steffen Date: Thu, 30 Jun 2022 12:06:39 +0200 Subject: [PATCH 1/5] Update workflows Signed-off-by: Jan Steffen --- .github/workflows/dependabot-auto-merge.yaml | 5 +- .github/workflows/golang.yaml | 54 +++++++++++++++----- .github/workflows/greetings.yaml | 13 +++++ 3 files changed, 57 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/greetings.yaml diff --git a/.github/workflows/dependabot-auto-merge.yaml b/.github/workflows/dependabot-auto-merge.yaml index 9256f58..6ae9da0 100644 --- a/.github/workflows/dependabot-auto-merge.yaml +++ b/.github/workflows/dependabot-auto-merge.yaml @@ -1,5 +1,8 @@ name: Dependabot auto-merge -on: pull_request +on: + check_suite: + types: + - completed permissions: contents: write diff --git a/.github/workflows/golang.yaml b/.github/workflows/golang.yaml index 632f485..9051586 100644 --- a/.github/workflows/golang.yaml +++ b/.github/workflows/golang.yaml @@ -15,10 +15,8 @@ name: Go on: - push: - branches: [ main, develop ] pull_request: - branches: [ main, develop ] + branches: [ main ] env: GO_MODULE: github.com/finleap-connect/backup-operator @@ -45,22 +43,50 @@ jobs: needs: lint runs-on: ubuntu-latest steps: - - name: Install Go + - name: Checkout Project + uses: actions/checkout@v3 + with: + fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. + + - name: Setup Go uses: actions/setup-go@v3 with: go-version: ${{ env.GO_VERSION }} - - name: Checkout Project - uses: actions/checkout@v3 - - name: test + + - uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Run Test run: | make test make coverage - - name: Convert coverage to lcov - uses: jandelgado/gcov2lcov-action@v1.0.9 + + - name: Go Coverage Badge + uses: tj-actions/coverage-badge-go@v1.2 + with: + filename: .coverprofile + + - name: Verify Changed files + uses: tj-actions/verify-changed-files@v9.1 + id: verify-changed-files with: - infile: .coverprofile - - name: Coveralls GitHub Action - uses: coverallsapp/github-action@1.1.3 + files: README.md + + - name: Commit changes + if: steps.verify-changed-files.outputs.files_changed == 'true' + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add README.md + git commit -m "chore: Updated coverage badge." + + - name: Push changes + if: steps.verify-changed-files.outputs.files_changed == 'true' + uses: ad-m/github-push-action@master with: - github-token: ${{ secrets.github_token }} - path-to-lcov: coverage.lcov + github_token: ${{ github.token }} + branch: ${{ github.head_ref }} \ No newline at end of file diff --git a/.github/workflows/greetings.yaml b/.github/workflows/greetings.yaml new file mode 100644 index 0000000..a5508d3 --- /dev/null +++ b/.github/workflows/greetings.yaml @@ -0,0 +1,13 @@ +name: Greetings + +on: [pull_request_target, issues] + +jobs: + greeting: + runs-on: ubuntu-latest + steps: + - uses: actions/first-interaction@v1.1.0 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: "Thanks for reporting this issue, don't forget to star this project to help us reach a wider audience." + pr-message: "Thanks for implementing a fix, could you ensure that the test covers your changes." \ No newline at end of file From bbdc368b74269e985a94a2cf2acd8ef1b6cf665b Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 30 Jun 2022 10:10:40 +0000 Subject: [PATCH 2/5] chore: Updated coverage badge. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9215cf2..ddd2682 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Backup Operator +![Coverage](https://img.shields.io/badge/Coverage-1-red) [![Build status](https://github.com/finleap-connect/backup-operator/actions/workflows/golang.yaml/badge.svg)](https://github.com/finleap-connect/backup-operator/actions/workflows/golang.yaml) [![Coverage Status](https://coveralls.io/repos/github/finleap-connect/backup-operator/badge.svg?branch=main)](https://coveralls.io/github/finleap-connect/backup-operator?branch=main) From 841927b8b8fbb95aed5e3bdd30445c84f1cd60cc Mon Sep 17 00:00:00 2001 From: Jan Steffen Date: Thu, 30 Jun 2022 12:12:46 +0200 Subject: [PATCH 3/5] Fix caching Signed-off-by: Jan Steffen --- .github/workflows/golang.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/golang.yaml b/.github/workflows/golang.yaml index 9051586..5c59eef 100644 --- a/.github/workflows/golang.yaml +++ b/.github/workflows/golang.yaml @@ -55,7 +55,9 @@ jobs: - uses: actions/cache@v2 with: - path: ~/go/pkg/mod + path: | + ~/.cache/go-build + ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- From c1c118c02dffbda4355f2b498bc1500daf36b406 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 30 Jun 2022 10:17:09 +0000 Subject: [PATCH 4/5] chore: Updated coverage badge. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ddd2682..d60fd3e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Backup Operator -![Coverage](https://img.shields.io/badge/Coverage-1-red) +![Coverage](https://img.shields.io/badge/Coverage-0-red) [![Build status](https://github.com/finleap-connect/backup-operator/actions/workflows/golang.yaml/badge.svg)](https://github.com/finleap-connect/backup-operator/actions/workflows/golang.yaml) [![Coverage Status](https://coveralls.io/repos/github/finleap-connect/backup-operator/badge.svg?branch=main)](https://coveralls.io/github/finleap-connect/backup-operator?branch=main) From 80a49b8180fe6f8b61327647d49decc2b7944fa9 Mon Sep 17 00:00:00 2001 From: Jan Steffen Date: Thu, 30 Jun 2022 12:17:55 +0200 Subject: [PATCH 5/5] Fix readme Signed-off-by: Jan Steffen --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index ddd2682..b976c20 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ # Backup Operator -![Coverage](https://img.shields.io/badge/Coverage-1-red) +![Coverage](https://img.shields.io/badge/Coverage-1-red) [![Build status](https://github.com/finleap-connect/backup-operator/actions/workflows/golang.yaml/badge.svg)](https://github.com/finleap-connect/backup-operator/actions/workflows/golang.yaml) -[![Coverage Status](https://coveralls.io/repos/github/finleap-connect/backup-operator/badge.svg?branch=main)](https://coveralls.io/github/finleap-connect/backup-operator?branch=main) [![Go Report Card](https://goreportcard.com/badge/github.com/finleap-connect/backup-operator)](https://goreportcard.com/report/github.com/finleap-connect/backup-operator) [![Go Reference](https://pkg.go.dev/badge/github.com/finleap-connect/backup-operator.svg)](https://pkg.go.dev/github.com/finleap-connect/backup-operator) [![GitHub release](https://img.shields.io/github/release/finleap-connect/backup-operator.svg)](https://github.com/finleap-connect/backup-operator/releases)