Skip to content

Kickstart development of powershell module #88

Kickstart development of powershell module

Kickstart development of powershell module #88

Workflow file for this run

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: πŸ› οΈ Build code
shell: pwsh
run: dotnet build ./src/Svrooij.WinTuner.CmdLets/Svrooij.WinTuner.CmdLets.csproj --configuration Release --no-restore -p:Version=$("${{ github.ref_name }}".Substring(1))