Skip to content

Merge remote-tracking branch 'origin/dependabot/nuget/Microsoft.CodeC… #689

Merge remote-tracking branch 'origin/dependabot/nuget/Microsoft.CodeC…

Merge remote-tracking branch 'origin/dependabot/nuget/Microsoft.CodeC… #689

Workflow file for this run

name: Build
on:
push:
tags: ["v*"]
branches: ["**"]
pull_request:
branches: [master]
env:
SOLUTION: src/AddUp.FakeRabbitMQ.sln
BUILD_CONFIGURATION: Release
DOTNET_ROLL_FORWARD: Major
jobs:
build:
runs-on: windows-latest
steps:
- name: Dump Environment
run: |
echo "Solution : ${{ env.SOLUTION }}"
echo "Configuration: ${{ env.BUILD_CONFIGURATION }}"
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0 # See https://github.com/GitTools/GitVersion/issues/2301
# Java 17 is needed by Sonar analyzer
- uses: actions/setup-java@v1
with:
java-version: 17
java-package: jdk
architecture: x64
- name: Setup .NET 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: "5.11.1"
- name: Use GitVersion
id: gitversion # step id used as reference for output values
uses: gittools/actions/gitversion/[email protected]
- name: Install SonarScanner
if: ${{ github.actor != 'dependabot[bot]' }}
run: dotnet tool install --global dotnet-sonarscanner
- name: Restore
run: dotnet restore "${{ env.SOLUTION }}" --configfile ./nuget.config
- name: Begin Sonar Analysis
if: ${{ github.actor != 'dependabot[bot]' }}
run: dotnet sonarscanner begin /key:"addupsolutions_AddUp.FakeRabbitMQ" /name:"AddUp.FakeRabbitMQ" /version:"${{ steps.gitversion.outputs.majorMinorPatch }}" /organization:"addupsolutions-oss" /d:sonar.cs.vstest.reportsPaths="**/TestResults/**/*.trx" /d:sonar.cs.opencover.reportsPaths="**/TestResults/**/*.opencover.xml" /d:sonar.coverage.exclusions="**Tests.cs" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.verbose=true /d:sonar.host.url=https://sonarcloud.io
- name: Build
run: dotnet build "${{ env.SOLUTION }}" --configuration "${{ env.BUILD_CONFIGURATION }}" --no-restore
- name: Test
run: dotnet test "${{ env.SOLUTION }}" --configuration "${{ env.BUILD_CONFIGURATION }}" --no-restore --no-build --logger trx --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=./TestResults/
- name: End Sonar Analysis
if: ${{ github.actor != 'dependabot[bot]' }}
run: dotnet sonarscanner end /d:sonar.login="${{secrets.SONAR_TOKEN}}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Collect Nuget Packages (nupkg)
uses: actions/upload-artifact@v2
with:
name: nuget-packages
path: ./src/AddUp.FakeRabbitMQ/bin/${{ env.BUILD_CONFIGURATION }}/*.nupkg
- name: Collect Nuget Packages (snupkg)
uses: actions/upload-artifact@v2
with:
name: nuget-packages
path: ./src/AddUp.FakeRabbitMQ/bin/${{ env.BUILD_CONFIGURATION }}/*.snupkg
###########################################
# Release creation / publication
- name: Create Release
if: startsWith(github.ref, 'refs/tags/v')
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false
- name: Upload Nuget Package to Release
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./src/AddUp.FakeRabbitMQ/bin/${{ env.BUILD_CONFIGURATION }}/AddUp.FakeRabbitMQ.${{ steps.gitversion.outputs.SemVer }}.nupkg
asset_name: AddUp.FakeRabbitMQ.${{ steps.gitversion.outputs.SemVer }}.nupkg
asset_content_type: application/zip
- name: Upload Symbols Nuget Package to Release
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./src/AddUp.FakeRabbitMQ/bin/${{ env.BUILD_CONFIGURATION }}/AddUp.FakeRabbitMQ.${{ steps.gitversion.outputs.SemVer }}.snupkg
asset_name: AddUp.FakeRabbitMQ.${{ steps.gitversion.outputs.SemVer }}.snupkg
asset_content_type: application/zip