Add command to show msi info #254
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: | |
api: | |
name: π€ Wake api | |
runs-on: ubuntu-latest | |
steps: | |
- name: β Load OpenAPI specs | |
shell: pwsh | |
run: | | |
$homepage = iwr -Uri https://proxy.wintuner.app | |
$specs = Iwr -Uri https://proxy.wintuner.app/api/swagger.json | |
test: | |
name: π οΈ Build and Test C# | |
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: π Install Kiota | |
run: dotnet tool install --global Microsoft.OpenApi.Kiota | |
- name: π Load packages (and generate api client) | |
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.2.5 | |
reportgenerator -reports:${{github.workspace}}/coverage.cobertura.xml -targetdir:${{github.workspace}}/report -reporttypes:MarkdownSummaryGithub -filefilters:-*.g.cs "-classfilters:-WingetIntune.Os.*;-WingetIntune.Internal.MsStore.Models.*" -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 | |
testps: | |
name: π οΈ Build and Test PowerShell | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
issues: read | |
checks: write | |
pull-requests: 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: π Install Kiota | |
run: dotnet tool install --global Microsoft.OpenApi.Kiota | |
- name: π Load packages (and generate api client) | |
run: dotnet restore | |
- name: π οΈ Build module | |
shell: pwsh | |
run: | |
dotnet build ./src/Svrooij.WinTuner.CmdLets/Svrooij.WinTuner.CmdLets.csproj --configuration Release --no-restore -p:Version="0.0.1-dev" -o ./dist/WinTuner | |
- name: π¦ Install Pester | |
shell: pwsh | |
run: Install-Module -Name Pester -Force -SkipPublisherCheck -Scope CurrentUser | |
- name: π΅οΈ Import module and list commands | |
shell: pwsh | |
run: | | |
Import-Module ./dist/WinTuner/WinTuner.psd1 | |
Get-Command -Module WinTuner | |
- name: π§ͺ Run test | |
shell: pwsh | |
run: | | |
Import-Module Pester | |
Import-Module ./dist/WinTuner/WinTuner.psd1 | |
$pesterConfig = [PesterConfiguration]@{ | |
Output = @{ | |
Verbosity = "Normal" | |
CIFormat = "Auto" | |
StackTraceVerbosity = "FirstLine" | |
} | |
TestResult = @{ | |
Enabled = $true | |
OutputPath = "${{ github.workspace }}/testresults/TestResults.xml" | |
OutputFormat = "JUnitXml" | |
} | |
Run = @{ | |
Path = "./tests/WinTuner.Cmdlets.Tests" | |
Exit = $true | |
} | |
Should = @{ | |
ErrorAction = "Continue" | |
} | |
} | |
Invoke-Pester -Configuration $pesterConfig | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
files: ${{ github.workspace }}/testresults/*.xml | |
publish-nuget: | |
name: π¦ Publish WinTuner to nuget | |
runs-on: ubuntu-latest | |
#if: startsWith(github.ref, 'refs/tags/') | |
if: ${{ false }} | |
needs: [test, testps] | |
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: π Install Kiota | |
run: dotnet tool install --global Microsoft.OpenApi.Kiota | |
- name: π Load packages (and generate api client) | |
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, testps] | |
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: π Install Kiota | |
run: dotnet tool install --global Microsoft.OpenApi.Kiota | |
- name: π Load packages (and generate api client) | |
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 | |
$startupContent = Get-Content -Path src/Svrooij.WinTuner.CmdLets/Startup.cs | |
$startupContent = $startupContent -replace '\*REPLACED_AT_BUILD\*', $env:WINTUNER_PROXY_TOKEN | |
$startupContent | Set-Content -Path src/Svrooij.WinTuner.CmdLets/Startup.cs | |
env: | |
WINTUNER_PROXY_TOKEN: ${{ secrets.WINTUNER_PROXY_TOKEN }} | |
- 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: π§ͺ Import module | |
shell: pwsh | |
run: | | |
Import-Module ./dist/WinTuner/WinTuner.psd1 | |
Get-Command -Module WinTuner | |
- 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 }} |