#8 Enable repeatable package restores using a lock file #44
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: CI/CD | |
on: | |
push: | |
branches: [ "*" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
configuration: [Debug, Release] | |
runs-on: windows-latest # For a list of available runner types, refer to | |
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on | |
env: | |
Solution_Name: FamilyShow.sln | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Install the .NET Core workload | |
- name: Install .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.x | |
# cache: true | |
# cache-dependency-path: '**/package-lock.json' | |
# Dotnet matcher | |
- name: Enable problem matchers | |
run: echo "::add-matcher::.github/matchers/dotnet.json" | |
# Restore the application to populate the obj folder with RuntimeIdentifiers | |
- name: Restore the application | |
run: dotnet restore $env:Solution_Name | |
# Build the application | |
- name: Build the application | |
run: dotnet build $env:Solution_Name --configuration $env:Configuration --no-restore | |
env: | |
Configuration: ${{ matrix.configuration }} | |
# Execute all unit tests in the solution | |
- name: Execute unit tests | |
run: dotnet test --configuration $env:Configuration --no-build --logger GitHubActions '/p:CollectCoverage=true;CoverletOutputFormat=\"json,lcov,cobertura,opencover\";MergeWith=${{github.workspace}}/coverage.json;CoverletOutput=${{github.workspace}}/coverage' -- RunConfiguration.CollectSourceInformation=true | |
env: | |
Configuration: ${{ matrix.configuration }} | |
# Create coverage badges | |
- name: OpenCover Badge Generator | |
uses: danpetitt/[email protected] | |
with: | |
path-to-opencover-xml: ${{github.workspace}}/coverage.opencover.xml | |
path-to-badges: ./ | |
minimum-coverage: 75 | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
# Archive the package | |
- name: Create archive | |
run: Compress-Archive -Path FamilyShow/bin/Release/* -DestinationPath FamilyShow/bin/Release/Family.Show-${{ github.ref_name }}.zip | |
if: startsWith(github.ref, 'refs/tags/') | |
# Release: https://github.com/softprops/action-gh-release | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: FamilyShow/bin/Release/Family.Show-${{ github.ref_name }}.zip |