Feature/ipc hardened draft final #24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Simplified CI for Fork | |
| # This workflow runs basic build validation without requiring secrets | |
| name: Fork CI | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - 'assets/**' | |
| - 'builds/**' | |
| - 'docs/**' | |
| - '*.md' | |
| # Auto-cancel previous runs when a new commit is pushed to the same PR | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write # Allow pushing formatting fixes | |
| pull-requests: write # Allow PR comments | |
| env: | |
| SOLUTION_PATH: '${{ github.workspace }}\Files.slnx' | |
| PACKAGE_PROJECT_PATH: '${{ github.workspace }}\src\Files.App (Package)\Files.Package.wapproj' | |
| PACKAGE_PROJECT_DIR: '${{ github.workspace }}\src\Files.App (Package)' | |
| APPX_PACKAGE_DIR: '${{ github.workspace }}\artifacts\AppxPackages' | |
| APPX_SELFSIGNED_CERT_PATH: '${{ github.workspace }}\.github\workflows\FilesApp_SelfSigned.pfx' | |
| ARTIFACTS_STAGING_DIR: '${{ github.workspace }}\artifacts' | |
| AUTOMATED_TESTS_ASSEMBLY_DIR: '${{ github.workspace }}\artifacts\TestsAssembly' | |
| AUTOMATED_TESTS_PROJECT_DIR: '${{ github.workspace }}\tests\Files.InteractionTests' | |
| AUTOMATED_TESTS_PROJECT_PATH: '${{ github.workspace }}\tests\Files.InteractionTests\Files.InteractionTests.csproj' | |
| WINAPPDRIVER_EXE86_PATH: 'C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe' | |
| jobs: | |
| check-and-fix-formatting: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout PR head | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| fetch-depth: 2 | |
| token: ${{ github.token }} | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| - name: Install XamlStyler.Console | |
| run: 'dotnet tool install --global XamlStyler.Console' | |
| - name: Check and fix XAML formatting | |
| id: format-xaml | |
| shell: pwsh | |
| run: | | |
| $changedFiles = (git diff --diff-filter=d --name-only HEAD~1) -split "\n" | Where-Object {$_ -like "*.xaml"} | |
| $hasChanges = $false | |
| foreach ($file in $changedFiles) | |
| { | |
| Write-Host "Checking: $file" | |
| xstyler -f $file | |
| if (git diff --name-only $file) { | |
| $hasChanges = $true | |
| Write-Host " ✓ Fixed formatting" | |
| } | |
| } | |
| if ($hasChanges) { | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add *.xaml | |
| git commit -m "Auto-fix XAML formatting [skip ci]" | |
| git push | |
| echo "::notice::XAML files were auto-formatted and committed" | |
| } else { | |
| echo "::notice::All XAML files are properly formatted" | |
| } | |
| build: | |
| needs: [check-and-fix-formatting] | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Setup MSBuild | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Setup NuGet | |
| uses: NuGet/setup-nuget@v2 | |
| - name: Restore Files | |
| shell: pwsh | |
| run: | | |
| msbuild $env:SOLUTION_PATH ` | |
| -t:Restore ` | |
| -p:Platform=x64 ` | |
| -p:Configuration=Release ` | |
| -p:PublishReadyToRun=true ` | |
| -v:quiet | |
| - name: Create self signed cert | |
| run: ./.github/scripts/Generate-SelfCertPfx.ps1 -Destination "$env:APPX_SELFSIGNED_CERT_PATH" | |
| - name: Build & package Files | |
| run: | | |
| msbuild ` | |
| $env:PACKAGE_PROJECT_PATH ` | |
| -t:Build ` | |
| -t:_GenerateAppxPackage ` | |
| -p:Configuration=Release ` | |
| -p:Platform=x64 ` | |
| -p:AppxBundlePlatforms=x64 ` | |
| -p:AppxBundle=Always ` | |
| -p:UapAppxPackageBuildMode=SideloadOnly ` | |
| -p:AppxPackageDir=$env:APPX_PACKAGE_DIR ` | |
| -p:AppxPackageSigningEnabled=true ` | |
| -p:PackageCertificateKeyFile=$env:APPX_SELFSIGNED_CERT_PATH ` | |
| -p:PackageCertificatePassword="" ` | |
| -p:PackageCertificateThumbprint="" ` | |
| -v:quiet | |
| - name: Build interaction tests | |
| run: | | |
| msbuild $env:AUTOMATED_TESTS_PROJECT_PATH ` | |
| -t:Build ` | |
| -p:Configuration=Release ` | |
| -p:Platform=x64 ` | |
| -v:quiet | |
| - name: Copy tests to artifacts | |
| shell: pwsh | |
| run: | | |
| Copy-Item ` | |
| -Path "$env:AUTOMATED_TESTS_PROJECT_DIR\bin" ` | |
| -Destination "$env:AUTOMATED_TESTS_ASSEMBLY_DIR" -Recurse | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: 'Fork-Package-Release-x64' | |
| path: ${{ env.ARTIFACTS_STAGING_DIR }} | |
| retention-days: 7 | |
| test: | |
| needs: [build] | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: 'Fork-Package-Release-x64' | |
| path: ${{ env.ARTIFACTS_STAGING_DIR }} | |
| - name: Install Files | |
| shell: powershell | |
| run: | | |
| Set-Location "$env:APPX_PACKAGE_DIR" | |
| $AppxPackageBundleDir = Get-ChildItem -Filter Files.Package_*_Test -Name | |
| Set-Location $AppxPackageBundleDir | |
| ./Install.ps1 -Force | |
| - name: Set display resolution | |
| run: Set-DisplayResolution -Width 1920 -Height 1080 -Force | |
| - name: Start WinAppDriver | |
| shell: pwsh | |
| run: Start-Process -FilePath "$env:WINAPPDRIVER_EXE86_PATH" | |
| - name: Run interaction tests | |
| uses: nick-fields/retry@v3 | |
| with: | |
| timeout_minutes: 15 | |
| max_attempts: 2 | |
| shell: pwsh | |
| command: | | |
| dotnet test ` | |
| $env:AUTOMATED_TESTS_ASSEMBLY_DIR\**\Files.InteractionTests.dll ` | |
| --logger "console;verbosity=detailed" | |
| code-quality: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Check Format | |
| run: | | |
| dotnet format --verify-no-changes --verbosity diagnostic | |
| continue-on-error: true | |
| - name: Run Code Analysis | |
| run: | | |
| dotnet build $env:SOLUTION_PATH ` | |
| /p:RunAnalyzersDuringBuild=true ` | |
| /p:Configuration=Release ` | |
| /p:Platform=x64 ` | |
| /p:TreatWarningsAsErrors=false | |
| continue-on-error: true |