From 593549c6026bf419b8fa452f3e04bef9ccb8d4c7 Mon Sep 17 00:00:00 2001 From: Stephan van Rooij <1292510+svrooij@users.noreply.github.com> Date: Wed, 24 Jul 2024 22:30:18 +0200 Subject: [PATCH 1/6] =?UTF-8?q?Have=20to=20checkout=20=F0=9F=A4=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/proxy.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/proxy.yml b/.github/workflows/proxy.yml index 1a4bc68..392eb21 100644 --- a/.github/workflows/proxy.yml +++ b/.github/workflows/proxy.yml @@ -11,6 +11,9 @@ jobs: name: โœ… Check proxy runs-on: ubuntu-latest steps: + - name: ๐Ÿ‘จโ€๐Ÿ’ป Check-out code + uses: actions/checkout@v4 + - name: ๐Ÿ“ฆ Install Pester shell: pwsh run: Install-Module -Name Pester -Force -SkipPublisherCheck -Scope CurrentUser From 335022f4a46aaf360bd472aa2a7b20bfe30712e2 Mon Sep 17 00:00:00 2001 From: Stephan van Rooij <1292510+svrooij@users.noreply.github.com> Date: Wed, 24 Jul 2024 22:33:43 +0200 Subject: [PATCH 2/6] =?UTF-8?q?Have=20to=20set=20a=20secret=20=F0=9F=94=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/proxy.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/proxy.yml b/.github/workflows/proxy.yml index 392eb21..0ca73be 100644 --- a/.github/workflows/proxy.yml +++ b/.github/workflows/proxy.yml @@ -42,6 +42,8 @@ jobs: } } Invoke-Pester -Configuration $pesterConfig + env: + WINTUNER_PROXY_TOKEN: ${{ secrets.WINTUNER_PROXY_TOKEN }} - name: Publish Test Results uses: EnricoMi/publish-unit-test-result-action@v2 From f6f076ed86b6b164f1cd8ecfd83f60eba7be5447 Mon Sep 17 00:00:00 2001 From: Stephan van Rooij <1292510+svrooij@users.noreply.github.com> Date: Wed, 24 Jul 2024 22:35:51 +0200 Subject: [PATCH 3/6] Again .... --- tests/WinTuner.Proxy.Tests/WinTunerProxy.Tests.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/WinTuner.Proxy.Tests/WinTunerProxy.Tests.ps1 b/tests/WinTuner.Proxy.Tests/WinTunerProxy.Tests.ps1 index c7c0454..cbbc412 100644 --- a/tests/WinTuner.Proxy.Tests/WinTunerProxy.Tests.ps1 +++ b/tests/WinTuner.Proxy.Tests/WinTunerProxy.Tests.ps1 @@ -12,7 +12,7 @@ Describe 'WinTunerProxy' { Describe 'Package' { It 'Should return package information for "9NZVDKPMR9RD"' { - $response = Invoke-RestMethod -Uri https://proxy.wintuner.app/api/store/package/9NZVDKPMR9RD -Headers @{ 'x-functions-key' = $env:WINTUNER_PROXY_CODE } + $response = Invoke-RestMethod -Uri https://proxy.wintuner.app/api/store/package/9NZVDKPMR9RD -Headers @{ 'x-functions-key' = $env:WINTUNER_PROXY_TOKEN } $response.packageIdentifier | Should -Be '9NZVDKPMR9RD' $response.displayName | Should -Be 'Mozilla Firefox' $response.publisher | Should -Be 'Mozilla' @@ -25,7 +25,7 @@ Describe 'WinTunerProxy' { } It 'Should return package information for "XP9KHM4BK9FZ7Q"' { - $response = Invoke-RestMethod -Uri https://proxy.wintuner.app/api/store/package/XP9KHM4BK9FZ7Q -Headers @{ 'x-functions-key' = $env:WINTUNER_PROXY_CODE } + $response = Invoke-RestMethod -Uri https://proxy.wintuner.app/api/store/package/XP9KHM4BK9FZ7Q -Headers @{ 'x-functions-key' = $env:WINTUNER_PROXY_TOKEN } $response.packageIdentifier | Should -Be 'XP9KHM4BK9FZ7Q' $response.displayName | Should -Be 'Visual Studio Code' $response.publisher | Should -Be 'Microsoft Corporation' @@ -40,7 +40,7 @@ Describe 'WinTunerProxy' { Describe 'Search' { It 'Should find packageIdentifier for "Visual Studio Code"' { - $response = Invoke-RestMethod -Uri https://proxy.wintuner.app/api/store/search?searchString=Visual+Studio+Code -Headers @{ 'x-functions-key' = $env:WINTUNER_PROXY_CODE } + $response = Invoke-RestMethod -Uri https://proxy.wintuner.app/api/store/search?searchString=Visual+Studio+Code -Headers @{ 'x-functions-key' = $env:WINTUNER_PROXY_TOKEN } # The response looks like: # [{"packageIdentifier": "string","displayName": "string","publisher": "string"}] # and is valid JSON with an array of objects From 74b8526fcb23cdc2e5b6be27619a629d9e3cd217 Mon Sep 17 00:00:00 2001 From: Stephan van Rooij <1292510+svrooij@users.noreply.github.com> Date: Wed, 24 Jul 2024 22:43:08 +0200 Subject: [PATCH 4/6] Nicer tests --- .github/workflows/proxy.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/proxy.yml b/.github/workflows/proxy.yml index 0ca73be..28122ba 100644 --- a/.github/workflows/proxy.yml +++ b/.github/workflows/proxy.yml @@ -24,15 +24,15 @@ jobs: Import-Module Pester $pesterConfig = [PesterConfiguration]@{ Output = @{ - Verbosity = "Normal" - CIFormat = "Auto" + Verbosity = "Detailed" + CIFormat = "GithubActions" StackTraceVerbosity = "FirstLine" } - TestResult = @{ - Enabled = $true - OutputPath = "${{ github.workspace }}/testresults/TestResults.xml" - OutputFormat = "JUnitXml" - } + # TestResult = @{ + # Enabled = $true + # OutputPath = "${{ github.workspace }}/testresults/TestResults.xml" + # OutputFormat = "JUnitXml" + # } Run = @{ Path = "./tests/WinTuner.Proxy.Tests" Exit = $true @@ -45,8 +45,8 @@ jobs: env: WINTUNER_PROXY_TOKEN: ${{ secrets.WINTUNER_PROXY_TOKEN }} - - name: Publish Test Results - uses: EnricoMi/publish-unit-test-result-action@v2 - if: always() - with: - files: ${{ github.workspace }}/testresults/*.xml + # - name: Publish Test Results + # uses: EnricoMi/publish-unit-test-result-action@v2 + # if: always() + # with: + # files: ${{ github.workspace }}/testresults/*.xml From 9502bde93363403dac7e54eb31357f4cd3bbace6 Mon Sep 17 00:00:00 2001 From: Stephan van Rooij <1292510+svrooij@users.noreply.github.com> Date: Wed, 24 Jul 2024 22:56:04 +0200 Subject: [PATCH 5/6] nice test results --- .github/workflows/proxy.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/proxy.yml b/.github/workflows/proxy.yml index 28122ba..497ba3e 100644 --- a/.github/workflows/proxy.yml +++ b/.github/workflows/proxy.yml @@ -45,8 +45,12 @@ jobs: env: WINTUNER_PROXY_TOKEN: ${{ secrets.WINTUNER_PROXY_TOKEN }} - # - name: Publish Test Results - # uses: EnricoMi/publish-unit-test-result-action@v2 - # if: always() - # with: - # files: ${{ github.workspace }}/testresults/*.xml + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + if: always() + with: + files: ${{ github.workspace }}/testresults/*.xml + check_run: false + job_summary: true + compare_to_earlier_commit: false + From 23b2d3e586edc72f4b3bec2e155251d5f1f4f486 Mon Sep 17 00:00:00 2001 From: Stephan van Rooij <1292510+svrooij@users.noreply.github.com> Date: Wed, 24 Jul 2024 23:09:12 +0200 Subject: [PATCH 6/6] Awesome tests --- .github/workflows/proxy.yml | 15 +++++++-------- .../WinTuner.Proxy.Tests/WinTunerProxy.Tests.ps1 | 6 +++--- tests/WinTuner.Proxy.Tests/run.ps1 | 3 +-- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/proxy.yml b/.github/workflows/proxy.yml index 497ba3e..c64e286 100644 --- a/.github/workflows/proxy.yml +++ b/.github/workflows/proxy.yml @@ -1,4 +1,4 @@ -name: ๐Ÿงช Test Proxy +name: ๐Ÿงช WinTuner proxy on: workflow_dispatch: schedule: @@ -28,11 +28,11 @@ jobs: CIFormat = "GithubActions" StackTraceVerbosity = "FirstLine" } - # TestResult = @{ - # Enabled = $true - # OutputPath = "${{ github.workspace }}/testresults/TestResults.xml" - # OutputFormat = "JUnitXml" - # } + TestResult = @{ + Enabled = $true + OutputPath = "${{ github.workspace }}/testresults/TestResults.xml" + OutputFormat = "JUnitXml" + } Run = @{ Path = "./tests/WinTuner.Proxy.Tests" Exit = $true @@ -43,7 +43,7 @@ jobs: } Invoke-Pester -Configuration $pesterConfig env: - WINTUNER_PROXY_TOKEN: ${{ secrets.WINTUNER_PROXY_TOKEN }} + WINTUNER_PROXY_CODE: ${{ secrets.WINTUNER_PROXY_TOKEN }} - name: Publish Test Results uses: EnricoMi/publish-unit-test-result-action@v2 @@ -53,4 +53,3 @@ jobs: check_run: false job_summary: true compare_to_earlier_commit: false - diff --git a/tests/WinTuner.Proxy.Tests/WinTunerProxy.Tests.ps1 b/tests/WinTuner.Proxy.Tests/WinTunerProxy.Tests.ps1 index cbbc412..c7c0454 100644 --- a/tests/WinTuner.Proxy.Tests/WinTunerProxy.Tests.ps1 +++ b/tests/WinTuner.Proxy.Tests/WinTunerProxy.Tests.ps1 @@ -12,7 +12,7 @@ Describe 'WinTunerProxy' { Describe 'Package' { It 'Should return package information for "9NZVDKPMR9RD"' { - $response = Invoke-RestMethod -Uri https://proxy.wintuner.app/api/store/package/9NZVDKPMR9RD -Headers @{ 'x-functions-key' = $env:WINTUNER_PROXY_TOKEN } + $response = Invoke-RestMethod -Uri https://proxy.wintuner.app/api/store/package/9NZVDKPMR9RD -Headers @{ 'x-functions-key' = $env:WINTUNER_PROXY_CODE } $response.packageIdentifier | Should -Be '9NZVDKPMR9RD' $response.displayName | Should -Be 'Mozilla Firefox' $response.publisher | Should -Be 'Mozilla' @@ -25,7 +25,7 @@ Describe 'WinTunerProxy' { } It 'Should return package information for "XP9KHM4BK9FZ7Q"' { - $response = Invoke-RestMethod -Uri https://proxy.wintuner.app/api/store/package/XP9KHM4BK9FZ7Q -Headers @{ 'x-functions-key' = $env:WINTUNER_PROXY_TOKEN } + $response = Invoke-RestMethod -Uri https://proxy.wintuner.app/api/store/package/XP9KHM4BK9FZ7Q -Headers @{ 'x-functions-key' = $env:WINTUNER_PROXY_CODE } $response.packageIdentifier | Should -Be 'XP9KHM4BK9FZ7Q' $response.displayName | Should -Be 'Visual Studio Code' $response.publisher | Should -Be 'Microsoft Corporation' @@ -40,7 +40,7 @@ Describe 'WinTunerProxy' { Describe 'Search' { It 'Should find packageIdentifier for "Visual Studio Code"' { - $response = Invoke-RestMethod -Uri https://proxy.wintuner.app/api/store/search?searchString=Visual+Studio+Code -Headers @{ 'x-functions-key' = $env:WINTUNER_PROXY_TOKEN } + $response = Invoke-RestMethod -Uri https://proxy.wintuner.app/api/store/search?searchString=Visual+Studio+Code -Headers @{ 'x-functions-key' = $env:WINTUNER_PROXY_CODE } # The response looks like: # [{"packageIdentifier": "string","displayName": "string","publisher": "string"}] # and is valid JSON with an array of objects diff --git a/tests/WinTuner.Proxy.Tests/run.ps1 b/tests/WinTuner.Proxy.Tests/run.ps1 index fc7d1e6..ff5efde 100644 --- a/tests/WinTuner.Proxy.Tests/run.ps1 +++ b/tests/WinTuner.Proxy.Tests/run.ps1 @@ -1,10 +1,9 @@ $pesterConfig = [PesterConfiguration]@{ Output = @{ - Verbosity = "Normal" + Verbosity = "Detailed" CIFormat = "Auto" StackTraceVerbosity = "FirstLine" } - OutputFormat = "NUnitXML" TestResult = @{ Enabled = $true OutputPath = "TestResults.xml"