fix test #56
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
name: Default ViennaNET release pipeline | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
- 'feature/**' | |
- 'bug/**' | |
- 'hotfix/**' | |
- 'refactoring/**' | |
release: | |
types: | |
- released | |
jobs: | |
default: | |
name: Default Job | |
runs-on: ubuntu-latest | |
env: | |
PROJECT_KEY: 'Raiffeisen-DGTL_ViennaNET' | |
PROJECT_NAME: 'ViennaNET.sln' | |
ARTIFACTS_DIR: '${{ github.workspace }}/artifacts' | |
REPORTS_DIR: '${{ github.workspace }}/artifacts/reports' | |
steps: | |
- name: Setup GitVersion | |
uses: gittools/actions/gitversion/setup@v0.9.7 | |
with: | |
versionSpec: '5.x' | |
- name: Setup JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 21 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v1 | |
with: | |
path: ~/sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Cache SonarCloud scanner | |
id: cache-sonar-scanner | |
uses: actions/cache@v1 | |
with: | |
path: ./.sonar/scanner | |
key: ${{ runner.os }}-sonar-scanner | |
restore-keys: ${{ runner.os }}-sonar-scanner | |
- name: Install SonarCloud scanner | |
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p -v ./.sonar/scanner | |
dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner | |
- name: Calculate version | |
uses: gittools/actions/gitversion/execute@v0.9.7 | |
- name: Begin SonarCloud scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_ORG: 'raiffeisen-dgtl' | |
SONAR_HOST_URL: https://sonarcloud.io | |
run: | | |
./.sonar/scanner/dotnet-sonarscanner begin /k:$PROJECT_KEY \ | |
/o:$SONAR_ORG \ | |
/v:$GITVERSION_FULLSEMVER \ | |
/s:"${{ github.workspace }}/SonarQube.Analysis.xml" \ | |
/d:sonar.login=$SONAR_TOKEN \ | |
/d:sonar.host.url=$SONAR_HOST_URL | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: | | |
dotnet build "$PROJECT_NAME" -c Release --nologo --no-restore | |
- name: Test | |
run: | | |
dotnet tool update -g dotnet-reportgenerator-globaltool; | |
dotnet test "$PROJECT_NAME" -c Release --nologo --no-restore --no-build \ | |
--logger "nunit;LogFilePath=$REPORTS_DIR/{assembly}-nunit-tests-result.xml"; | |
reportgenerator "-reports:${{ github.workspace }}/**/*.cobertura.xml" \ | |
"-targetdir:$REPORTS_DIR/" \ | |
"-reporttypes:SonarQube;TextSummary"; | |
- name: End sonarscanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: ./.sonar/scanner/dotnet-sonarscanner end /d:sonar.login=$SONAR_TOKEN | |
- name: Pack | |
if: github.ref == 'refs/heads/master' | |
run: dotnet pack $PROJECT_NAME -c Release -o ./nupkgs --nologo --no-build | |
- name: Push nuget packages | |
if: github.ref == 'refs/heads/master' | |
env: | |
NUGET_URL: https://api.nuget.org/v3/index.json | |
run: dotnet nuget push ./nupkgs/**/*.nupkg -s $NUGET_URL -k ${{secrets.NUGETKEY}} --skip-duplicate --no-symbols |