Skip to content

Bump the tests group in /src/PuzzleSolver.Tests with 3 updates #374

Bump the tests group in /src/PuzzleSolver.Tests with 3 updates

Bump the tests group in /src/PuzzleSolver.Tests with 3 updates #374

Workflow file for this run

name: CI/CD
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
configuration: Debug
jobs:
build:
name: Build job
runs-on: ubuntu-latest
outputs:
Version: ${{ steps.gitversion.outputs.SemVer }}
CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup GitVersion
uses: gittools/actions/gitversion/setup@v1.1.1
with:
versionSpec: 5.x
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v1.1.1
- name: Display GitVersion outputs
run: |
echo "Version: ${{ steps.gitversion.outputs.SemVer }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}"
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: .NET test
run: dotnet test src/PuzzleSolver.Tests/PuzzleSolver.Tests.csproj -c Debug --logger trx -e:CollectCoverage=true -e:CoverletOutput=TestResults/ -e:CoverletOutputFormat=lcov
- name: Publish coverage report to coveralls.io
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: src/PuzzleSolver.Tests/TestResults/coverage.info
continue-on-error: true
- name: .NET publish
run: dotnet publish src/PuzzleSolver/PuzzleSolver.csproj -c ${{ env.configuration }} -p:Version='${{ steps.gitversion.outputs.SemVer }}'
- name: Upload package back to GitHub
uses: actions/upload-artifact@v4
with:
name: drop
path: src/PuzzleSolver/bin/${{ env.configuration }}/netstandard2.0
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/PuzzleSolver/PuzzleSolver.csproj,src/PuzzleSolver.Tests/PuzzleSolver.Tests.csproj'
dotnet-version: '8.0.x'
sonarcloud-organization: samsmithnz-github
sonarcloud-project: samsmithnz_PuzzleSolver
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
release:
runs-on: ubuntu-latest
needs:
- build
- sonarCloud
if: github.ref == 'refs/heads/main'
steps:
- name: Download artifacts
uses: actions/download-artifact@v4.1.7
with:
name: drop
path: drop
#- run: dir ${{ github.workspace }}/drop/netstandard2.0/*.*
- name: Display GitVersion outputs
run: |
echo "Version: ${{ needs.build.outputs.Version }}"
echo "CommitsSinceVersionSource: ${{ needs.build.outputs.CommitsSinceVersionSource }}"
- name: Create Release
uses: ncipollo/release-action@v1.14.0
if: needs.build.outputs.CommitsSinceVersionSource > 0 #Only create a release if there has been a commit/version change
with:
tag: "v${{ needs.build.outputs.Version }}"
name: "v${{ needs.build.outputs.Version }}"
token: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
artifacts: "drop/PuzzleSolver.dll,drop/PuzzleSolver.pdb,drop/PuzzleSolver.deps.json"