Skip to content

Actually ignore the logo #231

Actually ignore the logo

Actually ignore the logo #231

Workflow file for this run

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:-WixSharp.*;-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 }}