Improved documentation with badges #110
Workflow file for this run
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: ποΈπ§ͺπ¦ WinTuner | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
test: | |
name: π οΈ Build and Test | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
issues: read | |
checks: write | |
steps: | |
- name: π¨βπ» Check-out code | |
uses: actions/checkout@v4 | |
- name: π¨βπ§ Setup .NET Core SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.x | |
- name: π Enable problem matchers | |
run: echo "::add-matcher::.github/matchers/dotnet.json" | |
- name: π¦ΈββοΈ Restore steriods | |
uses: actions/cache@v4 | |
with: | |
path: ~/.nuget/packages | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-nuget | |
- name: π Load packages | |
run: dotnet restore | |
- name: π οΈ Build code | |
run: dotnet build --configuration Release --no-restore | |
- name: βοΈ Testing code | |
run: dotnet test --configuration Release -v minimal --no-build --logger GitHubActions '/p:CollectCoverage=true;CoverletOutputFormat="json,lcov,cobertura";MergeWith=${{github.workspace}}/coverage.json;CoverletOutput=${{github.workspace}}/coverage' -- RunConfiguration.CollectSourceInformation=true | |
- name: π Code Coverage report | |
run: | | |
dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.1.23 | |
reportgenerator -reports:${{github.workspace}}/coverage.cobertura.xml -targetdir:${{github.workspace}}/report -reporttypes:MarkdownSummaryGithub -filefilters:-*.g.cs "-classfilters:-WixSharp.*;-WingetIntune.Os.*;-WingetIntune.Internal.MsStore.*" -verbosity:Warning | |
sed -i 's/# Summary/## π Code Coverage/g' ${{github.workspace}}/report/SummaryGithub.md | |
sed -i 's/## Coverage/### π Code Coverage details/g' ${{github.workspace}}/report/SummaryGithub.md | |
cat ${{github.workspace}}/report/*.md >> $GITHUB_STEP_SUMMARY | |
- name: π Check code formatting | |
if: always() | |
run: dotnet format --verify-no-changes | |
publish-nuget: | |
name: π¦ Publish WinTuner to nuget | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [test] | |
steps: | |
- name: π¨βπ» Check-out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: π¨βπ§ Setup .NET Core SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.x | |
- name: π Enable problem matchers | |
run: echo "::add-matcher::.github/matchers/dotnet.json" | |
- name: π¦ΈββοΈ Restore steriods | |
uses: actions/cache@v4 | |
with: | |
path: ~/.nuget/packages | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-nuget | |
- name: π Load packages | |
run: dotnet restore | |
- name: π οΈ Build code | |
shell: pwsh | |
run: dotnet build ./src/WingetIntune.Cli/WingetIntune.Cli.csproj --configuration Release --no-restore -p:Version=$("${{ github.ref_name }}".Substring(1)) | |
- name: π¦ Pack WinTuner CLI | |
shell: pwsh | |
run: dotnet pack ./src/WingetIntune.Cli/WingetIntune.Cli.csproj --configuration Release --no-build -p:Version=$("${{ github.ref_name }}".Substring(1)) | |
- name: βοΈ Publish Svrooij.Winget-Intune.Cli to nuget.org | |
run: dotnet nuget push ./src/WingetIntune.Cli/bin/Release/SvRooij.Winget-Intune.Cli.*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }} | |
publish-psgallery: | |
name: π¦ Publish WinTuner to PowerShell Gallery | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [test] | |
steps: | |
- name: π¨βπ» Check-out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: π¨βπ§ Setup .NET Core SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.x | |
- name: π Enable problem matchers | |
run: echo "::add-matcher::.github/matchers/dotnet.json" | |
- name: π¦ΈββοΈ Restore steriods | |
uses: actions/cache@v4 | |
with: | |
path: ~/.nuget/packages | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-nuget | |
- name: π Load packages | |
run: dotnet restore | |
- name: π Set module version | |
shell: pwsh | |
id: version | |
run: | | |
$version = "${{ github.ref_name }}".Substring(1) | |
$module = Get-Content -Path src/Svrooij.WinTuner.CmdLets/WinTuner.psd1 | |
$module = $module -replace 'ModuleVersion = ''\d+\.\d+\.\d+''', "ModuleVersion = '$version'" | |
$module | Set-Content -Path src/Svrooij.WinTuner.CmdLets/WinTuner.psd1 | |
- name: π οΈ Build module | |
shell: pwsh | |
run: dotnet build ./src/Svrooij.WinTuner.CmdLets/Svrooij.WinTuner.CmdLets.csproj --configuration Release --no-restore -p:Version=$("${{ github.ref_name }}".Substring(1)) -o ./dist/WinTuner | |
- name: π§ͺ Run tests (import module) | |
shell: pwsh | |
run: | | |
Import-Module ./dist/WinTuner/WinTuner.psd1 | |
Get-Command -Module WinTuner | |
Get-Command -Module WinTuner | Select-Object -ExpandProperty Name | ForEach-Object { Get-Help -Name $_ -Full } | |
- name: π¦ Publish WinTuner to PowerShell Gallery | |
shell: pwsh | |
run: | | |
Import-Module ./dist/WinTuner/WinTuner.psd1 | |
Publish-Module -Path ./dist/WinTuner -NuGetApiKey $env:PSGALLERY_TOKEN -Repository PSGallery -Force | |
env: | |
PSGALLERY_TOKEN: ${{ secrets.PSGALLERY_TOKEN }} |