Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
167 changes: 73 additions & 94 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
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
contents: read
checks: write
pull-requests: write

on:
pull_request:
branches:
- main
- dev
branches: [main, dev]
types: [opened, synchronize, reopened]
paths:
- '**.cs'
Expand All @@ -19,57 +17,65 @@ on:
- '**.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

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true

jobs:
test:
build-and-test:
runs-on: windows-latest
timeout-minutes: 30 # Job-level timeout
timeout-minutes: 30

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed for better caching
Comment on lines +36 to +37
Copy link

Copilot AI Oct 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment states fetch-depth: 0 is 'Needed for better caching', but fetch-depth doesn't affect caching. This parameter retrieves full git history and is typically used for changelog generation or git-based versioning. Consider clarifying the actual purpose or removing fetch-depth if not needed.

Suggested change
with:
fetch-depth: 0 # Needed for better caching

Copilot uses AI. Check for mistakes.

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

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

# Cache NuGet packages to speed up builds
# Improved caching with better key strategy
- 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') }}
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-

# Restore once for the entire solution
- name: Restore NuGet packages
run: |
Write-Host "🔄 Restoring NuGet packages..."
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
# Build Debug configuration (for tests)
- name: Build Solution (Debug)
run: |
Write-Host "🔨 Building Debug configuration..."
msbuild InterfaceExtractor.Extension/InterfaceExtractor.Extension.csproj /p:Configuration=Debug /v:minimal /m /warnaserror
msbuild InterfaceExtractor.Tests/InterfaceExtractor.Tests.csproj /p:Configuration=Debug /v:minimal /m /warnaserror
shell: pwsh

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

- name: Run Tests
timeout-minutes: 10
shell: pwsh
run: |
# Find the test DLL (might be in net48 subdirectory)
Write-Host "🧪 Running tests..."

$testDll = Get-ChildItem -Path "InterfaceExtractor.Tests\bin\Debug" -Filter "InterfaceExtractor.Tests.dll" -Recurse | Select-Object -First 1

if ($null -eq $testDll) {
Expand All @@ -79,30 +85,25 @@ jobs:

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()
timeout-minutes: 5 # Step-level timeout
with:
files: |
TestResults/**/*.trx
check_name: Test Results
comment_title: Test Results
compare_to_earlier_commit: false

- name: Upload Test Results as Artifact
# Run tests with detailed logging
vstest.console.exe $testDll.FullName `
/logger:trx `
/logger:"console;verbosity=normal" `
/ResultsDirectory:TestResults `
/Parallel
Comment on lines +92 to +93
Copy link

Copilot AI Oct 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The /Parallel flag may cause issues with test isolation or resource contention in CI environments. Consider testing without this flag first, or document why parallel execution is safe for these tests.

Suggested change
/ResultsDirectory:TestResults `
/Parallel
/ResultsDirectory:TestResults

Copilot uses AI. Check for mistakes.

# Simplified test results - just use artifacts
- name: Upload Test Results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: TestResults/
path: TestResults/*.trx
retention-days: 7

- name: Test Summary
if: always()
timeout-minutes: 2
shell: pwsh
run: |
$trxFiles = Get-ChildItem -Path TestResults -Filter *.trx -Recurse
Expand Down Expand Up @@ -131,74 +132,52 @@ jobs:
Write-Host "📝 Total: $total"
Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

# Output to GitHub Actions summary
echo "## 📊 Test Results" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "| Metric | Count |" >> $env:GITHUB_STEP_SUMMARY
echo "|--------|-------|" >> $env:GITHUB_STEP_SUMMARY
echo "| ✅ Passed | $passed |" >> $env:GITHUB_STEP_SUMMARY
echo "| ❌ Failed | $failed |" >> $env:GITHUB_STEP_SUMMARY
echo "| ⏭️ Skipped | $skipped |" >> $env:GITHUB_STEP_SUMMARY
echo "| 📝 Total | $total |" >> $env:GITHUB_STEP_SUMMARY

if ($failed -gt 0) {
Write-Host ""
Write-Host "❌ Tests Failed!"

# Show failed tests
$failedTests = $trx.TestRun.Results.UnitTestResult | Where-Object { $_.outcome -eq "Failed" }
if ($failedTests) {
Write-Host ""
Write-Host "Failed Tests:"
foreach ($test in $failedTests) {
Write-Host " - $($test.testName)"
if ($test.Output.ErrorInfo.Message) {
Write-Host " Error: $($test.Output.ErrorInfo.Message)"
}
}
}

exit 1
} else {
Write-Host ""
Write-Host "✅ All Tests Passed!"
}
}

code-quality:
runs-on: windows-latest
timeout-minutes: 20 # Job-level timeout

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

# Build Release configuration
- 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()
timeout-minutes: 5 # Job-level timeout

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
Write-Host "🔨 Building Release configuration..."
msbuild InterfaceExtractor.Extension/InterfaceExtractor.Extension.csproj /p:Configuration=Release /v:minimal /m /warnaserror
shell: pwsh

- name: All Checks Passed
- name: Final Status
if: success()
run: |
echo "✅ All checks passed successfully!"
Write-Host "✅ All checks passed successfully!"
echo "## ✅ Build and Test Successful" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "All builds completed and all tests passed!" >> $env:GITHUB_STEP_SUMMARY
shell: pwsh
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ jobs:
BUMP_TYPE="patch"
CONVENTIONAL_COMMIT_FOUND="true"
echo "🔧 Maintenance commit detected → PATCH version bump"
elif echo "$COMMITS" | grep -qiE "^*(patch)(\(.*\))?:"; then
BUMP_TYPE="patch"
CONVENTIONAL_COMMIT_FOUND="true"
echo "🔧 Patch commit detected → PATCH version bump"
else
BUMP_TYPE="none"
CONVENTIONAL_COMMIT_FOUND="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.14.0" />
</ItemGroup>
<ItemGroup>
<Content Include="Resources\InterfaceExtractor-logo.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="Exists('$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets')" />
</Project>
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion InterfaceExtractor.Extension/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="InterfaceExtractor.6fa7b9f2-c586-4bd2-8735-939937fa55d6" Version="1.2.1.0" Language="en-US" Publisher="Chizaruu" />
<Identity Id="InterfaceExtractor.6fa7b9f2-c586-4bd2-8735-939937fa55d6" Version="1.2.2.0" Language="en-US" Publisher="Chizaruu" />
<DisplayName>Interface Extractor</DisplayName>
<Description xml:space="preserve">Extract interfaces from C# files directly from Solution Explorer. Right-click any C# file to automatically generate interface files with all public methods and properties.</Description>
<Icon>Resources\InterfaceExtractor-logo.png</Icon>
<Tags>interface, extract, refactor, C#, productivity</Tags>
</Metadata>
<Installation>
Expand Down