Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: [OMV-616] Adds coverage checks and updates Renovate config #18

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/code_coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# **Note:** Please ignore `sonarlint(secrets:S6698)` until they add a way to
# suppress it for specific lines or files without having to disable the rule
# entirely.

name: Code Coverage
on:
push:
branches:
- 1.x.x
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
coverage:
name: Compute code coverage and send it to SonarCloud
runs-on: ubuntu-latest
container: docker://golang:1.22.0

steps:
- name: Checkout ui-backend
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_ACTION_CHECKOUT_TOKEN }}

- name: Run tests and compute code coverage
run: |
set -e
go clean -testcache
GOEXPERIMENT=nocoverageredesign go test -v -coverpkg=./... -coverprofile=.coverage.out ./...
go tool cover -func=.coverage.out
go tool cover -html=.coverage.out -o .coverage.html

- name: Upload coverage.html artifact
uses: actions/upload-artifact@v4
with:
name: coverage.html
path: .coverage.html

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@v2.1.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

merge-renovate-prs:
name: Auto-merge Renovate PRs if tests pass
needs: [coverage]
if: needs.coverage.result == 'success' && startsWith(github.head_ref , 'renovate/')
runs-on: ubuntu-latest
steps:
- name: Merge PR
uses: squalrus/merge-bot@v0.4.5
with:
# Set to true to test the action without merging
test: false
GITHUB_TOKEN: ${{ secrets.GH_ACTION_MERGE_RENOVATE_TOKEN }}
reviewers: false
labels: renovate
method: squash
delete_source_branch: true
20 changes: 5 additions & 15 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
],
"customManagers": [
{
"customType": "regex",
"fileMatch": [
"^.pre-commit-config.ya?ml$"
],
"matchStrings": [
" rev: [\"']?(?<currentValue>v\\d+(?:\\.\\d+)*)[\"']? # (?<datasource>[\\w-]+) (?<depName>[\\w\\.\\/-]+)"
]
}
],
"schedule": ["after 1am and before 9am every weekday", "every weekend"],
"timezone": "Europe/Berlin"
"github>omnipeak/infrastructure//renovate/base",
"github>omnipeak/infrastructure//renovate/pre-commit-config",
"github>omnipeak/infrastructure//renovate/github-workflows-config",
"github>omnipeak/infrastructure//renovate/sonarcloud"
]
}
Loading