Skip to content

Commit

Permalink
fix: update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dnitsch committed Feb 1, 2023
1 parent 6403008 commit 0ca1c9a
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 23 deletions.
41 changes: 40 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,38 @@ name: CI

on:
push:
branches: [ master ]
branches: [ master, main ]

jobs:
set-deps-dotnet-poop-here:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:6.0
outputs:
semVer: ${{ steps.gitversion.outputs.semVer }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.15
with:
versionSpec: '5.x'
- name: Set SemVer Version
uses: gittools/actions/gitversion/execute@v0.9.15
id: gitversion

- name: echo VERSIONS
run: |
echo "REVISION -> $GITHUB_SHA"
echo "VERSION -> $GITVERSION_SEMVER"
build:
runs-on: ubuntu-latest
container:
image: golang:1.19-bullseye
needs: set-deps-dotnet-poop-here
env:
SEMVER: ${{ needs.set-deps-dotnet-poop-here.outputs.semVer }}
steps:
- uses: actions/checkout@v3
- name: install deps
Expand All @@ -23,3 +48,17 @@ jobs:
if: always() # always run even if the previous step fails
with:
report_paths: '**/report-junit.xml'
- name: Analyze with SonarCloud
# You can pin the exact commit or the version.
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret)
with:
# Additional arguments for the sonarcloud scanner
args:
# Unique keys of your project and organization. You can find them in SonarCloud > Information (bottom-left menu)
# mandatory
-Dsonar.projectVersion=$SEMVER
-Dsonar.go.coverage.reportPaths=/github/workspace/.coverage/out
-X
48 changes: 40 additions & 8 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,36 @@ on:
branches: [ master, main ]

jobs:
set-deps-dotnet-poop-here:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:6.0
outputs:
semVer: ${{ steps.gitversion.outputs.semVer }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.15
with:
versionSpec: '5.x'
- name: Set SemVer Version
uses: gittools/actions/gitversion/execute@v0.9.15
id: gitversion

- name: echo VERSIONS
run: |
echo "REVISION -> $GITHUB_SHA"
echo "VERSION -> $GITVERSION_SEMVER"
pr:
runs-on: ubuntu-latest
container:
image: golang:1.19-bullseye
env:
FOO: Bar
REVISION: $GITHUB_SHA
# ports:
# - 80
# volumes:
# - my_docker_volume:/volume_mount
# options: --cpus 1
needs: set-deps-dotnet-poop-here
env:
REVISION: $GITHUB_SHA
SEMVER: ${{ needs.set-deps-dotnet-poop-here.outputs.semVer }}
steps:
- uses: actions/checkout@v3
- name: install deps
Expand All @@ -31,3 +49,17 @@ jobs:
if: always() # always run even if the previous step fails
with:
report_paths: '**/report-junit.xml'
- name: Analyze with SonarCloud
# You can pin the exact commit or the version.
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret)
with:
# Additional arguments for the sonarcloud scanner
args:
# Unique keys of your project and organization. You can find them in SonarCloud > Information (bottom-left menu)
# mandatory
-Dsonar.projectVersion=$SEMVER
-Dsonar.go.coverage.reportPaths=/github/workspace/.coverage/out
-X
14 changes: 0 additions & 14 deletions configmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,6 @@ func Test_retrieve(t *testing.T) {
}
}

var (
strT4 = `
export FOO='FOO#/test'
export FOO1=FOO#/test
export FOO2='FOO#/test'
export FOO3=FOO#/test
export FOO4=FOO#/test
[[section]]
foo23 = FOO#/test
`
)

func Test_retrieveWithInputReplaced(t *testing.T) {
tests := map[string]struct {
name string
Expand Down
17 changes: 17 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
sonar.projectKey=dnitsch_configmanager
sonar.organization=dnitsch
# This is the name and version displayed in the SonarCloud UI.
sonar.projectName=configmanager

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
sonar.sources=.
sonar.exclusions=**/*_test.go,**/*_generated*.go,**/*_generated/**,**/vendor/**
sonar.inclusions=**/*.go

# Encoding of the source code. Default is default system encoding

sonar.tests=.
sonar.test.inclusions=**/*_test.go
sonar.test.exclusions=**/*_generated*.go,**/*_generated/**,**/vendor/**

sonar.sourceEncoding=UTF-8

0 comments on commit 0ca1c9a

Please sign in to comment.