generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Misc] Operator: sonar workflow added
Sonar workflow added
- Loading branch information
Showing
2 changed files
with
67 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: CAP Operator Manager (Build & Unit test) | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
|
||
env: | ||
CGO_ENABLED: 0 | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: read # allows SonarCloud to decorate PRs with analysis results | ||
|
||
jobs: | ||
build: | ||
name: Build and Test | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: 'go.mod' | ||
cache: true | ||
|
||
- name: Download module and all dependencies | ||
run: go mod download | ||
|
||
- name: Build all relevant packages | ||
run: go build -v . | ||
|
||
- name: Test relevant packages | ||
run: go test -v -cover -coverprofile=coverage.out ./... | ||
|
||
- name: Upload Test results | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: test-coverage | ||
path: coverage.out | ||
|
||
analysis: | ||
name: Analyze with Sonar Cloud | ||
needs: build | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
|
||
- name: Check out code for Sonar Analysis | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Download Test results | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: test-coverage | ||
|
||
- name: SonarCloud Scan | ||
uses: SonarSource/sonarcloud-github-action@master | ||
Check warning on line 64 in .github/workflows/build.yml In Solidarity / Inclusive LanguageMatch Found
Raw output
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
This file was deleted.
Oops, something went wrong.