Skip to content

Bump coverlet.msbuild from 6.0.4 to 8.0.1 #765

Bump coverlet.msbuild from 6.0.4 to 8.0.1

Bump coverlet.msbuild from 6.0.4 to 8.0.1 #765

Workflow file for this run

name: CI/CD
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
name: Build .NET
runs-on: windows-latest
outputs: # https://stackoverflow.com/questions/59175332/using-output-from-a-previous-job-in-a-new-one-in-a-github-action
Version: ${{ steps.gitversion.outputs.MajorMinorPatch }}
CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 #fetch-depth is needed for GitVersion
#Install and calculate the new version with GitVersion
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v4.2.0
with:
versionSpec: 6.x
- name: Determine Version
uses: gittools/actions/gitversion/execute@v4.2.0
id: gitversion # step id used as reference for output values
- name: Display GitVersion outputs
run: |
echo "Version: ${{ steps.gitversion.outputs.MajorMinorPatch }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}"
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5.0.1
with:
dotnet-version: 10.0.x
- name: Test
run: dotnet test src/MandMCounter.Tests/MandMCounter.Tests.csproj --configuration Debug -e:CollectCoverage=true -e:CoverletOutput=TestResults/ -e:CoverletOutputFormat=lcov #-l:"trx;LogFileName=${{ github.workspace }}/TestOutput.xml"
- uses: samsmithnz/DotNetTestResults@v0.2
if: false
with:
fileName: ${{ github.workspace }}/TestOutput.xml
- name: Publish coverage report to coveralls.io
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: src/MandMCounter.Tests/TestResults/coverage.info
- name: PublishService
run: dotnet publish src/MandMCounter.Service/MandMCounter.Service.csproj --configuration release --output ${{ github.workspace }}/service -p:Version='${{ steps.gitversion.outputs.MajorMinorPatch }}'
- name: Pack dll to NuGet package
run: dotnet pack src/MandMCounter.Core/MandMCounter.Core.csproj --configuration release -p:Version='${{ steps.gitversion.outputs.MajorMinorPatch }}'
- name: Publish Artifact
uses: actions/upload-artifact@v6
with:
name: service
path: ${{ github.workspace }}/service
- name: Upload NuGet package to GitHub
uses: actions/upload-artifact@v6
with:
name: nugetPackage
path: src/MandMCounter.Core/bin/Release/
sonarCloud:
name: Run SonarCloud analysis
runs-on: ubuntu-latest
if: false && github.ref == 'refs/heads/main'
steps:
- name: Run Sonarcloud test
uses: samsmithnz/SamsDotNetSonarCloudAction@v2
with:
projects: 'src/MandMCounter.Core/MandMCounter.Core.csproj,src/MandMCounter.Service/MandMCounter.Service.csproj, src/MandMCounter.Tests/MandMCounter.Tests.csproj'
dotnet-version: '10.0.x'
sonarcloud-organization: samsmithnz-github
sonarcloud-project: samsmithnz_MandMCounter
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
deploy:
name: Deploy web service
runs-on: ubuntu-latest
needs:
- build
# - sonarCloud
if: github.ref == 'refs/heads/main' # only run job if on the main branch
steps:
- name: Download the build artifacts
uses: actions/download-artifact@v7
- name: Azure Login
uses: azure/login@v2
with:
creds: ${{ secrets.ORG_AZURE_SP }}
#- name: Deploy infrastructure with ARM templates
# uses: azure/cli@v1.0.0
# with:
# inlineScript: EnvironmentARMTemplate\PowerShell\DeployInfrastructureWebService.ps1 -appPrefix "samsapp" -environment "prod" -webAppEnvironment "prod" -resourceGroupName "SamSmithNZ.com" -resourceGroupLocation "East US" -resourceGroupLocationShort "eu" -dataKeyVaultName "tbd" -templatesLocation "${{ github.workspace }}\drop\EnvironmentARMTemplate\Templates" -sqlDatabaseName "ssnzdb" -sqlAdministratorLoginUser "" -sqlAdministratorLoginPassword ""
# azcliversion: latest
- name: 'App Service Deploy: M&M counter web service'
uses: Azure/webapps-deploy@v3
with:
app-name: mandm-prod-eu-service
package: service
slot-name: production #staging
release:
runs-on: ubuntu-latest
needs: [ build, deploy ]
if: github.ref == 'refs/heads/main' # only run job if on the main branch
steps:
#Push NuGet package to GitHub packages
- name: Download nuget package artifact
uses: actions/download-artifact@v7
- name: Prep packages
run: dotnet nuget add source --username samsmithnz --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/SamSmithNZ-dotcom/index.json"
- name: Push package to GitHub packages
if: needs.build.outputs.CommitsSinceVersionSource > 0 #Only release if there has been a commit/version change
run: dotnet nuget push nugetPackage/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "github"
#Create release
- name: Create Release
if: needs.build.outputs.CommitsSinceVersionSource > 0 #Only release if there has been a commit/version change
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ needs.build.outputs.Version }}
release_name: Release ${{ needs.build.outputs.Version }}