Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2eefe95
Add GitHub Actions workflow for PR tests
Chizaruu Oct 18, 2025
84bea95
Update pr-tests.yml
Chizaruu Oct 18, 2025
f515c6a
Optimize CI workflows and improve version handling
Chizaruu Oct 18, 2025
100bddc
Fix async context usage and test method signature
Chizaruu Oct 18, 2025
04f7c0c
Improve test DLL discovery in PR test workflow
Chizaruu Oct 18, 2025
865f06a
Add explicit permissions to GitHub workflows
Chizaruu Oct 18, 2025
54d8706
Add checks: write permission to workflow
Chizaruu Oct 18, 2025
c638388
Merge pull request #1 from Chizaruu/pr-tests
Chizaruu Oct 18, 2025
4f9c7f8
Refine CI scripts for test and release workflows
Chizaruu Oct 18, 2025
47ba98c
Trigger release workflow on testing branches
Chizaruu Oct 18, 2025
993e441
Remove testing branch trigger from release workflow
Chizaruu Oct 18, 2025
f39ca0a
Enforce warnings as errors in CI and add environment approval
Chizaruu Oct 18, 2025
62c2926
Update .github/workflows/release.yml
Chizaruu Oct 18, 2025
bc79e7a
Add environment URL to release workflow
Chizaruu Oct 18, 2025
99a00e0
Improve manifest version extraction in release workflow
Chizaruu Oct 18, 2025
2f3e9e7
Refactor version bump step to PowerShell
Chizaruu Oct 18, 2025
6950819
Trigger release workflow on testing branches
Chizaruu Oct 18, 2025
f87ae31
Improve prerelease and dev tag parsing in release workflow
Chizaruu Oct 18, 2025
82ad18b
Remove testing branch trigger from release workflow
Chizaruu Oct 18, 2025
380d76b
Ignore docs and release workflow in PR tests
Chizaruu Oct 18, 2025
b26c809
Revert "Ignore docs and release workflow in PR tests"
Chizaruu Oct 18, 2025
cdd59da
Merge pull request #2 from Chizaruu/release-testing
Chizaruu Oct 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 200 additions & 0 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
name: Pull Request Tests

permissions:
contents: read # Needed for checkout and caching
checks: write # Needed for publishing test results as check runs
pull-requests: write # Needed for publishing test results to PR

on:
pull_request:
branches:
- main
- dev
types: [opened, synchronize, reopened]
paths:
- '**.cs'
- '**.csproj'
- '**.xaml'
- '**.vsct'
- '**.vsixmanifest'
- '.github/workflows/pr-tests.yml'

# Cancel in-progress runs when new commits are pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2

- name: Setup NuGet
uses: NuGet/setup-nuget@v2

# Cache NuGet packages to speed up builds
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: |
~/.nuget/packages
${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json', '**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: Restore NuGet packages
run: |
nuget restore InterfaceExtractor.Extension/InterfaceExtractor.Extension.csproj
nuget restore InterfaceExtractor.Tests/InterfaceExtractor.Tests.csproj
shell: pwsh

# Build with warnings as errors for quality
- name: Build Extension
run: msbuild InterfaceExtractor.Extension/InterfaceExtractor.Extension.csproj /p:Configuration=Debug /v:minimal /m /warnaserror

- name: Build Tests
run: msbuild InterfaceExtractor.Tests/InterfaceExtractor.Tests.csproj /p:Configuration=Debug /v:minimal /m /warnaserror

- name: Setup VSTest
uses: darenm/Setup-VSTest@v1.2

- name: Run Tests
shell: pwsh
run: |
# Find the test DLL (might be in net48 subdirectory)
$testDll = Get-ChildItem -Path "InterfaceExtractor.Tests\bin\Debug" -Filter "InterfaceExtractor.Tests.dll" -Recurse | Select-Object -First 1

if ($null -eq $testDll) {
Write-Host "❌ Test DLL not found!"
exit 1
}

Write-Host "✅ Found test DLL at: $($testDll.FullName)"

# Run tests
vstest.console.exe $testDll.FullName /logger:trx /ResultsDirectory:TestResults

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/windows@v2
if: always()
with:
files: |
TestResults/**/*.trx
check_name: Test Results
comment_title: Test Results
compare_to_earlier_commit: false

- name: Upload Test Results as Artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: TestResults/
retention-days: 7

- name: Test Summary
if: always()
shell: pwsh
run: |
$trxFiles = Get-ChildItem -Path TestResults -Filter *.trx -Recurse

if ($trxFiles.Count -eq 0) {
Write-Host "❌ No test results found!"
exit 1
}

foreach ($trxFile in $trxFiles) {
[xml]$trx = Get-Content $trxFile.FullName
$summary = $trx.TestRun.ResultSummary
$counters = $summary.Counters

$total = [int]$counters.total
$passed = [int]$counters.passed
$failed = [int]$counters.failed
$skipped = [int]$counters.total - [int]$counters.executed

Write-Host ""
Write-Host "📊 Test Summary"
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
Write-Host "✅ Passed: $passed"
Write-Host "❌ Failed: $failed"
Write-Host "⏭️ Skipped: $skipped"
Write-Host "📝 Total: $total"
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

if ($failed -gt 0) {
Write-Host ""
Write-Host "❌ Tests Failed!"
exit 1
} else {
Write-Host ""
Write-Host "✅ All Tests Passed!"
}
}

code-quality:
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2

- name: Setup NuGet
uses: NuGet/setup-nuget@v2

# Cache NuGet packages
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: |
~/.nuget/packages
${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json', '**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: Restore NuGet packages
run: |
nuget restore InterfaceExtractor.Extension/InterfaceExtractor.Extension.csproj
nuget restore InterfaceExtractor.Tests/InterfaceExtractor.Tests.csproj
shell: pwsh

- name: Build Solution (Release)
run: msbuild InterfaceExtractor.Extension/InterfaceExtractor.Extension.csproj /p:Configuration=Release /v:minimal /m /warnaserror

- name: Check for Build Warnings
shell: pwsh
run: |
Write-Host "✅ Build completed successfully with no warnings!"

status-check:
runs-on: ubuntu-latest
needs: [test, code-quality]
if: always()

steps:
- name: Check Test Status
if: needs.test.result != 'success'
run: |
echo "❌ Tests failed or were cancelled"
exit 1

- name: Check Code Quality Status
if: needs.code-quality.result != 'success'
run: |
echo "❌ Code quality checks failed or were cancelled"
exit 1

- name: All Checks Passed
run: |
echo "✅ All checks passed successfully!"
Loading