Skip to content
This repository has been archived by the owner on Jul 22, 2023. It is now read-only.

Commit

Permalink
Add CI/CD automation
Browse files Browse the repository at this point in the history
- Added SonarCloud related properties
- Added release workflow to test, release and push the package
  • Loading branch information
Icikowski committed Mar 6, 2022
1 parent 0d677f4 commit f81e96f
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 0 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/release.yml
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\//}
12 changes: 12 additions & 0 deletions sonar-project.properties
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

0 comments on commit f81e96f

Please sign in to comment.