Skip to content

Bump GitHubActionsDotNet from 1.3.22 to 1.3.23 in /src/DCB.Tests in the tests group #1049

Bump GitHubActionsDotNet from 1.3.22 to 1.3.23 in /src/DCB.Tests in the tests group

Bump GitHubActionsDotNet from 1.3.22 to 1.3.23 in /src/DCB.Tests in the tests group #1049

Workflow file for this run

name: .NET
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
#Install and calculate the new version with GitVersion
version:
runs-on: ubuntu-latest
outputs:
Version: ${{ steps.gitversion.outputs.SemVer }}
CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 #fetch-depth is needed for GitVersion
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v1.1.1
with:
versionSpec: 5.x
- name: Determine Version
uses: gittools/actions/gitversion/execute@v1.1.1
id: gitversion # step id used as reference for output values
- name: Display GitVersion outputs
run: |
echo "Version: ${{ steps.gitversion.outputs.SemVer }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}"
#Setup, Build and Test .NET
build:
runs-on: windows-latest
needs: version
strategy:
matrix:
include:
- ChannelName: Windows_x64
RID: win-x64
- ChannelName: MacOS_x64
RID: osx-x64
- ChannelName: Linux_x64
RID: linux-x64
env:
BuildConfiguration: Release
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: 8.0.x
- name: Test projects
if: matrix.ChannelName == 'Linux_x64'
run: |
dotnet test src/DCB.Tests/DCB.Tests.csproj --configuration debug -e:CollectCoverage=true -e:CoverletOutput=TestResults/ -e:CoverletOutputFormat=lcov
- name: Publish coverage report to coveralls.io
if: matrix.ChannelName == 'Linux_x64'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: src/DCB.Tests/TestResults/coverage.info
- name: Create directory for channel
run: mkdir ${{ github.workspace }}\${{ matrix.ChannelName }}
shell: powershell
- name: dotnet publish ${{ matrix.RID }}
run: dotnet publish src/DCB/DCB.csproj -r ${{ matrix.RID }} --self-contained -c ${{ env.BuildConfiguration }} -o ${{ github.workspace }}\${{ needs.version.outputs.Version }}_${{ matrix.ChannelName }} /p:Version=${{ needs.version.outputs.Version }}
- name: zip files
run: |
Compress-Archive -Path '${{ github.workspace }}\${{ needs.version.outputs.Version }}_${{ matrix.ChannelName }}\' `
-DestinationPath ${{ github.workspace }}\${{ matrix.ChannelName }}\DCB.${{ matrix.ChannelName }}.${{ needs.version.outputs.Version }}.zip
shell: powershell
- name: Publish Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.ChannelName }}
path: ${{ github.workspace }}\${{ matrix.ChannelName }}
sonarCloud:
name: Run SonarCloud analysis
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Run Sonarcloud test
uses: samsmithnz/SamsDotNetSonarCloudAction@v2
with:
projects: 'src/DCB/DCB.csproj,src/DCB.Tests/DCB.Tests.csproj '
dotnet-version: '8.0.x'
sonarcloud-organization: samsmithnz-github
sonarcloud-project: samsmithnz_Dependabot-Configuration-Builder
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Release:
runs-on: ubuntu-latest
needs:
- version
- build
- sonarCloud
if: github.ref == 'refs/heads/main'
steps:
- name: Display GitVersion outputs
run: |
echo "Version: ${{ needs.version.outputs.Version }}"
echo "CommitsSinceVersionSource: ${{ needs.version.outputs.CommitsSinceVersionSource }}"
- name: Download package artifacts
uses: actions/download-artifact@v4
- name: Create Release
uses: ncipollo/release-action@v1
if: needs.version.outputs.CommitsSinceVersionSource > 0 #Only create a release if there has been a commit/version change
with:
artifacts: Linux_x64/DCB.Linux_x64.${{ needs.version.outputs.Version }}.zip,MacOS_x64/DCB.MacOS_x64.${{ needs.version.outputs.Version }}.zip,Windows_x64/DCB.Windows_x64.${{ needs.version.outputs.Version }}.zip
tag: "v${{ needs.version.outputs.Version }}"
name: "v${{ needs.version.outputs.Version }}"
token: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token