Skip to content

Commit

Permalink
Feature/store proxy (#88)
Browse files Browse the repository at this point in the history
* Scrape store details in a proxy
* Pacakge updates
* Temporary remove AppAssignmentUpdate (since it seems to be removed from the graph sdk)
* Testing the proxy
  • Loading branch information
svrooij authored Jul 24, 2024
1 parent d824037 commit 070062c
Show file tree
Hide file tree
Showing 36 changed files with 1,005 additions and 2,249 deletions.
35 changes: 31 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ on:
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
Expand Down Expand Up @@ -40,7 +49,10 @@ jobs:
restore-keys: |
${{ runner.os }}-nuget
- name: 🎒 Load packages
- name: 🎒 Install Kiota
run: dotnet tool install --global Microsoft.OpenApi.Kiota

- name: 🎒 Load packages (and generate api client)
run: dotnet restore

- name: 🛠️ Build code
Expand Down Expand Up @@ -90,7 +102,10 @@ jobs:
restore-keys: |
${{ runner.os }}-nuget
- name: 🎒 Load packages
- name: 🎒 Install Kiota
run: dotnet tool install --global Microsoft.OpenApi.Kiota

- name: 🎒 Load packages (and generate api client)
run: dotnet restore

- name: 🛠️ Build module
Expand Down Expand Up @@ -168,7 +183,10 @@ jobs:
restore-keys: |
${{ runner.os }}-nuget
- name: 🎒 Load packages
- name: 🎒 Install Kiota
run: dotnet tool install --global Microsoft.OpenApi.Kiota

- name: 🎒 Load packages (and generate api client)
run: dotnet restore

- name: 🛠️ Build code
Expand Down Expand Up @@ -212,7 +230,10 @@ jobs:
restore-keys: |
${{ runner.os }}-nuget
- name: 🎒 Load packages
- 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
Expand All @@ -223,6 +244,12 @@ jobs:
$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
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/proxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: 🧪 Test Proxy
on:
workflow_dispatch:
schedule:
- cron: '28 7 * * 1,4,6'

jobs:
proxy:
permissions:
checks: write
name: ✅ Check proxy
runs-on: ubuntu-latest
steps:
- name: 📦 Install Pester
shell: pwsh
run: Install-Module -Name Pester -Force -SkipPublisherCheck -Scope CurrentUser

- name: 🧪 Run test
shell: pwsh
run: |
Import-Module Pester
$pesterConfig = [PesterConfiguration]@{
Output = @{
Verbosity = "Normal"
CIFormat = "Auto"
StackTraceVerbosity = "FirstLine"
}
TestResult = @{
Enabled = $true
OutputPath = "${{ github.workspace }}/testresults/TestResults.xml"
OutputFormat = "JUnitXml"
}
Run = @{
Path = "./tests/WinTuner.Proxy.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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -368,4 +368,7 @@ dist
# LUT config file from Visual Studio
*.lutconfig

TestResults.xml
TestResults.xml

# Ignore all files that are generated by Kiota before restore
/src/WinTuner.Proxy.Client/Generated
7 changes: 7 additions & 0 deletions WingetIntune.sln
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Winget.CommunityRepository.
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Apps", "Apps", "{4D1367F6-2076-481E-A7BD-0BFA6BEFCA3D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinTuner.Proxy.Client", "src\WinTuner.Proxy.Client\WinTuner.Proxy.Client.csproj", "{1074A148-FDB2-48B1-91C6-1D37A5D139A6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -63,6 +65,10 @@ Global
{516169B3-872B-443B-8736-27E2A08E7091}.Debug|Any CPU.Build.0 = Debug|Any CPU
{516169B3-872B-443B-8736-27E2A08E7091}.Release|Any CPU.ActiveCfg = Release|Any CPU
{516169B3-872B-443B-8736-27E2A08E7091}.Release|Any CPU.Build.0 = Release|Any CPU
{1074A148-FDB2-48B1-91C6-1D37A5D139A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1074A148-FDB2-48B1-91C6-1D37A5D139A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1074A148-FDB2-48B1-91C6-1D37A5D139A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1074A148-FDB2-48B1-91C6-1D37A5D139A6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -74,6 +80,7 @@ Global
{C32DB1BC-299E-4742-8372-278C8843026C} = {4D1367F6-2076-481E-A7BD-0BFA6BEFCA3D}
{050B8AB3-6232-4220-950F-578D9E3E2203} = {4D1367F6-2076-481E-A7BD-0BFA6BEFCA3D}
{516169B3-872B-443B-8736-27E2A08E7091} = {70C0FC9B-4495-43AC-AB67-331201AEAA52}
{1074A148-FDB2-48B1-91C6-1D37A5D139A6} = {70C0FC9B-4495-43AC-AB67-331201AEAA52}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {94A78033-8BE6-4A61-BC28-66CE040924C8}
Expand Down
2 changes: 1 addition & 1 deletion src/Svrooij.WinTuner.CmdLets/Commands/DeployWtWin32App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ await batch.AddBatchRequestStepAsync(graphServiceClient.DeviceAppManagement.Mobi
{
if (assignment.Intent == GraphModels.InstallIntent.Available && assignment.Settings is null)
{
assignment.Settings = new GraphModels.Win32LobAppAssignmentSettings { AutoUpdateSettings = new GraphModels.Win32LobAppAutoUpdateSettings { AutoUpdateSupersededApps = GraphModels.Win32LobAppAutoUpdateSupersededApps.Enabled } };
//assignment.Settings = new GraphModels.Win32LobAppAssignmentSettings { AutoUpdateSettings = new GraphModels.Win32LobAppAutoUpdateSettings { AutoUpdateSupersededApps = GraphModels.Win32LobAppAutoUpdateSupersededApps.Enabled } };
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/Svrooij.WinTuner.CmdLets/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public override void ConfigureServices(IServiceCollection services)
{
services.AddTransient<SvRooij.ContentPrep.Packager>();
services.AddTransient<Winget.CommunityRepository.WingetRepository>();
services.AddWingetServices();
const string code = "*REPLACED_AT_BUILD*";
services.AddWingetServices(code);
}

/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.11.4" />
<PackageReference Include="Azure.Identity" Version="1.12.0" />
<PackageReference Include="Svrooij.PowerShell.DependencyInjection" Version="1.1.4" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.2.19">
<PrivateAssets>All</PrivateAssets>
Expand Down
Loading

0 comments on commit 070062c

Please sign in to comment.