This repository has been archived by the owner on Jul 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added SonarCloud related properties - Added release workflow to test, release and push the package
- Loading branch information
Showing
2 changed files
with
105 additions
and
0 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,93 @@ | ||
name: Software release | ||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
tests: | ||
name: Tests and coverage | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
- name: Perform tests | ||
run: make | ||
- name: Prepare coverage report | ||
run: make coverage | ||
- name: Upload coverage report | ||
uses: actions/upload-artifact@v2.2.4 | ||
with: | ||
name: coverage | ||
path: "cover.out" | ||
codecov: | ||
name: Codecov | ||
runs-on: ubuntu-latest | ||
needs: [tests] | ||
if: (needs.tests.result == 'success') | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Download coverage report | ||
uses: actions/download-artifact@v2.0.10 | ||
with: | ||
name: coverage | ||
- uses: codecov/codecov-action@v2 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: ./cover.out | ||
sonarcloud: | ||
name: SonarCloud | ||
runs-on: ubuntu-latest | ||
needs: [tests] | ||
if: (needs.tests.result == 'success') | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Download coverage report | ||
uses: actions/download-artifact@v2.0.10 | ||
with: | ||
name: coverage | ||
- name: Perform SonarCloud scan | ||
uses: SonarSource/sonarcloud-github-action@master | ||
with: | ||
args: > | ||
-Dsonar.go.coverage.reportPaths=cover.out | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
release: | ||
name: Release steps | ||
runs-on: ubuntu-latest | ||
needs: [tests] | ||
if: (needs.tests.result == 'success') | ||
steps: | ||
- name: Release | ||
uses: marvinpinto/action-automatic-releases@v1.2.1 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
prerelease: false | ||
push: | ||
name: Push to pkg.go.dev | ||
runs-on: ubuntu-latest | ||
needs: [release] | ||
if: (needs.release.result == 'success') | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
- name: Create dummy package | ||
run: go mod init example.com/dummy | ||
- name: Download dependency | ||
run: GOPROXY=https://proxy.golang.org GO111MODULE=on go get github.com/Icikowski/kubeprobes@${GITHUB_REF/refs\/tags\//} |
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,12 @@ | ||
sonar.projectKey=Icikowski_kubeprobes | ||
sonar.organization=icikowski | ||
|
||
# This is the name and version displayed in the SonarCloud UI. | ||
#sonar.projectName=kubeprobes | ||
#sonar.projectVersion=1.0 | ||
|
||
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. | ||
#sonar.sources=. | ||
|
||
# Encoding of the source code. Default is default system encoding | ||
#sonar.sourceEncoding=UTF-8 |