diff --git a/.github/scripts/Build-AppSolution.ps1 b/.github/scripts/Build-AppSolution.ps1 new file mode 100644 index 000000000000..d66f97fb24d9 --- /dev/null +++ b/.github/scripts/Build-AppSolution.ps1 @@ -0,0 +1,99 @@ +# Copyright (c) Files Community +# Licensed under the MIT License. + +param( + [string]$ReleaseBranch = "Debug", # Debug, Release, SideloadPreview, SideloadStable, StorePreview, or StoreStable + [string]$SolutionPath = "Files.slnx", + [string]$StartupProjectPath = "", + [string]$Platform = "x64", + [string]$Configuration = "Debug", + [string]$AppxPackageDir = "", + [string]$AppInstallerUrl = "", # Sideload only + [string]$AppxPackageCertKeyFilePath = "" # Release|x64 only (fully qualified path) +) + +msbuild $SolutionPath /t:Restore /p:Platform=$Platform /p:Configuration=$Configuration + +if ($ReleaseBranch -eq "Debug") +{ + msbuild $StartupProjectPath ` + /clp:ErrorsOnly ` + /p:Platform=$Platform ` + /p:Configuration=$Configuration +} +elseif ($ReleaseBranch -eq "Release") +{ + if ($Platform -eq "x64") + { + Invoke-Expression "$PSScriptRoot/Generate-SelfCertPfx.ps1 -Destination $AppxPackageCertKeyFilePath" + + msbuild $StartupProjectPath ` + /clp:ErrorsOnly ` + /p:Platform=$Platform ` + /p:Configuration=$Configuration ` + /p:AppxBundlePlatforms=$Platform ` + /p:UapAppxPackageBuildMode=SideloadOnly ` + /p:AppxPackageDir=$AppxPackageDir ` + /p:GenerateAppInstallerFile=true ` + /p:AppInstallerUri=$AppxPackageDir ` + /p:AppxPackageSigningEnabled=true ` + /p:PackageCertificateKeyFile=$AppxPackageCertKeyFilePath + } + else + { + msbuild $StartupProjectPath ` + /clp:ErrorsOnly ` + /p:Platform=$Platform ` + /p:Configuration=$Configuration + } +} +elseif ($ReleaseBranch -eq "SideloadPreview" -or $ReleaseBranch -eq "SideloadStable") +{ + msbuild $StartupProjectPath ` + /clp:ErrorsOnly ` + /p:Platform=$Platform ` + /p:Configuration=$Configuration ` + /p:UapAppxPackageBuildMode=SideloadOnly ` + /p:AppxPackageDir=$AppxPackageDir ` + /p:GenerateAppInstallerFile=true ` + /p:AppInstallerUri=$AppInstallerUrl + + # Path + $localFilePath = Join-Path $AppxPackageDir "Files.App.appinstaller" + + # Update scheme (namespace URI string swap) + $fileContent = Get-Content -LiteralPath $localFilePath -Raw + $fileContent = $fileContent.Replace( + 'http://schemas.microsoft.com/appx/appinstaller/2017/2', + 'http://schemas.microsoft.com/appx/appinstaller/2018' + ) + Set-Content -LiteralPath $localFilePath -Value $fileContent -Encoding UTF8 + + # Delete UpdateSettings section (proper XML load) + [xml]$xml = Get-Content -LiteralPath $localFilePath + $ns = New-Object System.Xml.XmlNamespaceManager($xml.NameTable) + $ns.AddNamespace("ai", "http://schemas.microsoft.com/appx/appinstaller/2018") + + $node = $xml.SelectSingleNode("//ai:UpdateSettings", $ns) + if ($node) { [void]$node.ParentNode.RemoveChild($node) } + + $xml.Save($localFilePath) + + # Rename from 'Files.App' to 'Files.Package' in all occurrences in file/folder names to keep backwards compatibility with older versions of the installer/updater + Get-ChildItem -Path $AppxPackageDir -Recurse -Force | + Where-Object { $_.Name -like "*Files.App*" } | + Sort-Object FullName -Descending | + ForEach-Object { + $newName = $_.Name -replace "Files\.App", "Files.Package" + Rename-Item -LiteralPath $_.FullName -NewName $newName + } +} +elseif ($ReleaseBranch -eq "StorePreview" -or $ReleaseBranch -eq "StoreStable") +{ + msbuild $StartupProjectPath ` + /clp:ErrorsOnly ` + /p:Platform=$Platform ` + /p:Configuration=$Configuration ` + /p:UapAppxPackageBuildMode=StoreOnly ` + /p:AppxPackageDir=$AppxPackageDir +} diff --git a/.github/scripts/Create-MsixBundle.ps1 b/.github/scripts/Create-MsixBundle.ps1 deleted file mode 100644 index af21e22d64a7..000000000000 --- a/.github/scripts/Create-MsixBundle.ps1 +++ /dev/null @@ -1,275 +0,0 @@ -# Copyright (c) Files Community -# Licensed under the MIT License. - -# Creates an .msixbundle from individual per-platform .msix packages produced -# by single-project MSIX packaging. Optionally generates an .appinstaller file -# for sideload deployments, and an .msixupload for Store submissions. - -param( - [Parameter(Mandatory)] - [string]$AppxPackageDir, - - [Parameter(Mandatory)] - [string]$BundleName, - - [string]$Version = "", - - [string]$PackageManifestPath = "", - - [string]$AppInstallerUri = "", - - [ValidateSet("Sideload", "StoreUpload", "SideloadOnly")] - [string]$BuildMode = "Sideload" -) - -$ErrorActionPreference = "Stop" - -function Ensure-Directory([string]$Path) { - if (-not (Test-Path $Path)) { New-Item -ItemType Directory -Path $Path | Out-Null } -} - -# Canonical arch names for the WAP-compatible folder layout -$archMap = @{ 'arm64' = 'ARM64'; 'x64' = 'x64'; 'x86' = 'x86' } - -# --- Locate makeappx.exe --- - -$sdkRoot = "${env:ProgramFiles(x86)}\Windows Kits\10\bin" -$makeAppx = Get-ChildItem -Path $sdkRoot -Filter "makeappx.exe" -Recurse -ErrorAction SilentlyContinue | - Where-Object { $_.DirectoryName -match '\\x64$' } | - Sort-Object { [version]($_.DirectoryName -replace '^.*\\bin\\([^\\]+)\\.*$','$1') } -Descending | - Select-Object -First 1 -if ($null -eq $makeAppx) { - Write-Error "makeappx.exe not found under '$sdkRoot'" - exit 1 -} -Write-Host "Using makeappx: $($makeAppx.FullName)" - -# --- Discover per-platform .msix packages --- - -$msixFiles = Get-ChildItem -Path $AppxPackageDir -Filter "*.msix" -Recurse | - Where-Object { $_.DirectoryName -notmatch '\\Dependencies\\' } -if ($msixFiles.Count -eq 0) { - Write-Error "No .msix files found in '$AppxPackageDir'" - exit 1 -} -Write-Host "Found $($msixFiles.Count) .msix package(s):" -$msixFiles | ForEach-Object { Write-Host " $_" } - -if ($Version -eq "" -and $PackageManifestPath -ne "" -and (Test-Path $PackageManifestPath)) { - [xml]$versionManifest = Get-Content $PackageManifestPath - $Version = $versionManifest.Package.Identity.Version - Write-Host "Version from manifest: $Version" -} -if ($Version -eq "") { - $Version = $msixFiles[0].BaseName -replace '^[^_]+_([^_]+)_.*$','$1' - Write-Host "Detected version from filename: $Version" -} - -$platformList = $msixFiles | ForEach-Object { $_.BaseName -replace '.*_(\w+)$','$1' } | Sort-Object -Descending -$platforms = $platformList -join '_' - -# --- Create .msixbundle --- - -$mappingDir = Join-Path $AppxPackageDir "_bundletemp" -if (Test-Path $mappingDir) { Remove-Item $mappingDir -Recurse -Force } -New-Item -ItemType Directory -Path $mappingDir | Out-Null -foreach ($msix in $msixFiles) { Copy-Item $msix.FullName -Destination $mappingDir } - -$bundlePath = Join-Path $AppxPackageDir "$BundleName.msixbundle" -if (Test-Path $bundlePath) { Remove-Item $bundlePath -Force } - -Write-Host "Creating msixbundle at: $bundlePath" -& $makeAppx.FullName bundle /d $mappingDir /p $bundlePath /bv $Version /o -if ($LASTEXITCODE -ne 0) { - Write-Error "MakeAppx bundle creation failed with exit code $LASTEXITCODE" - exit 1 -} -Remove-Item $mappingDir -Recurse -Force -Write-Host "Successfully created: $bundlePath" - -# --- Reorganize into WAP-compatible folder structure for CDN upload --- -# Target layout: {BundleName}_{Version}_Test/{BundleName}_{Version}_{platforms}.msixbundle -# {BundleName}_{Version}_Test/Dependencies/{arch}/... - -$bundleFolder = "${BundleName}_${Version}_Test" -$bundleFolderPath = Join-Path $AppxPackageDir $bundleFolder -Ensure-Directory $bundleFolderPath - -$organizedBundleName = "${BundleName}_${Version}_${platforms}.msixbundle" -$organizedBundlePath = Join-Path $bundleFolderPath $organizedBundleName -Move-Item $bundlePath $organizedBundlePath -Force -Write-Host "Moved bundle to: $organizedBundlePath" - -# --- Merge dependency folders from each per-platform build --- - -$organizedDepsDir = Join-Path $bundleFolderPath "Dependencies" -foreach ($msix in $msixFiles) { - $perPlatDepsDir = Join-Path $msix.DirectoryName "Dependencies" - if (-not (Test-Path $perPlatDepsDir)) { continue } - - Get-ChildItem -Path $perPlatDepsDir -Directory | ForEach-Object { - $archName = $_.Name - $canonicalArch = $archMap[$archName] - if (-not $canonicalArch) { return } - if (-not ($platformList -contains $archName)) { return } - - $targetArchDir = Join-Path $organizedDepsDir $canonicalArch - Ensure-Directory $targetArchDir - Get-ChildItem -Path $_.FullName -File | ForEach-Object { - $destFile = Join-Path $targetArchDir $_.Name - if (-not (Test-Path $destFile)) { - Copy-Item $_.FullName -Destination $destFile - Write-Host " Copied dependency: $destFile" - } - } - } -} - -# --- Add VCLibs framework packages (not produced by single-project builds) --- - -$vcLibsSdkBase = "${env:ProgramFiles(x86)}\Microsoft SDKs\Windows Kits\10\ExtensionSDKs" -$vcLibsPackages = @( - @{ SdkFolder = "Microsoft.VCLibs"; FileTemplate = "Microsoft.VCLibs.{0}.14.00.appx" }, - @{ SdkFolder = "Microsoft.VCLibs.Desktop"; FileTemplate = "Microsoft.VCLibs.{0}.14.00.Desktop.appx" } -) - -foreach ($platform in $platformList) { - $canonicalArch = $archMap[$platform] - if (-not $canonicalArch) { continue } - - $targetArchDir = Join-Path $organizedDepsDir $canonicalArch - Ensure-Directory $targetArchDir - - foreach ($vcLib in $vcLibsPackages) { - $fileName = $vcLib.FileTemplate -f $canonicalArch - $destPath = Join-Path $targetArchDir $fileName - if (Test-Path $destPath) { continue } - - $sdkPath = Join-Path $vcLibsSdkBase "$($vcLib.SdkFolder)\14.0\Appx\Retail\$platform\$fileName" - if (Test-Path $sdkPath) { - Copy-Item $sdkPath -Destination $destPath - Write-Host " Copied VCLibs from SDK: $destPath" - } else { - Write-Host " Downloading $fileName for $platform..." - try { - Invoke-WebRequest -Uri "https://aka.ms/$fileName" -OutFile $destPath -UseBasicParsing - Write-Host " Downloaded VCLibs: $destPath" - } catch { - Write-Warning " Failed to download $fileName for ${platform}: $_" - } - } - } -} - -# --- Collect symbol files and clean up per-platform build folders --- - -foreach ($msix in $msixFiles) { - Get-ChildItem -Path $msix.DirectoryName -Filter "*.appxsym" -ErrorAction SilentlyContinue | ForEach-Object { - $symPlatform = $_.BaseName -replace '.*_(\w+)$','$1' - $newSymPath = Join-Path $bundleFolderPath "${BundleName}_${Version}_${symPlatform}.appxsym" - Move-Item $_.FullName $newSymPath -Force - Write-Host "Moved symbol file to: $newSymPath" - } -} - -Get-ChildItem -Path $AppxPackageDir -Filter "*.msixupload" -ErrorAction SilentlyContinue | - ForEach-Object { Remove-Item $_.FullName -Force; Write-Host "Removed per-platform upload: $($_.Name)" } - -foreach ($msix in $msixFiles) { - if (Test-Path $msix.DirectoryName) { - Remove-Item $msix.DirectoryName -Recurse -Force - Write-Host "Removed per-platform dir: $($msix.DirectoryName)" - } -} - -# --- Generate .msixupload for Store submissions --- - -if ($BuildMode -eq "StoreUpload") { - $uploadName = "${BundleName}_${Version}_${platforms}_bundle.msixupload" - $uploadPath = Join-Path $AppxPackageDir $uploadName - if (Test-Path $uploadPath) { Remove-Item $uploadPath -Force } - - Write-Host "Creating msixupload at: $uploadPath" - $zipPath = "$uploadPath.zip" - Compress-Archive -Path $organizedBundlePath -DestinationPath $zipPath -Force - Move-Item $zipPath $uploadPath -Force - Write-Host "Successfully created: $uploadPath" -} - -# --- Generate .appinstaller for sideload deployments --- - -if ($AppInstallerUri -ne "" -and ($BuildMode -eq "Sideload" -or $BuildMode -eq "SideloadOnly")) { - $appInstallerPath = Join-Path $AppxPackageDir "$BundleName.appinstaller" - - if ($PackageManifestPath -ne "" -and (Test-Path $PackageManifestPath)) { - [xml]$manifestXml = Get-Content $PackageManifestPath - $packageName = $manifestXml.Package.Identity.Name - $packagePublisher = $manifestXml.Package.Identity.Publisher - } else { - Write-Warning "PackageManifestPath not provided; falling back to BundleName for identity" - $packageName = $BundleName - $packagePublisher = "" - } - - $bundleUri = "${AppInstallerUri}${bundleFolder}/${organizedBundleName}" - - # Build dependency XML entries by reading each package's embedded manifest - $dependencyEntries = "" - if (Test-Path $organizedDepsDir) { - Add-Type -AssemblyName System.IO.Compression.FileSystem -ErrorAction SilentlyContinue - Get-ChildItem -Path $organizedDepsDir -Recurse -Include *.appx, *.msix | ForEach-Object { - $depArch = Split-Path (Split-Path $_.FullName -Parent) -Leaf - - $depZip = [System.IO.Compression.ZipFile]::OpenRead($_.FullName) - try { - $entry = $depZip.Entries | Where-Object { $_.FullName -eq "AppxManifest.xml" } | Select-Object -First 1 - if ($null -eq $entry) { return } - $reader = New-Object System.IO.StreamReader($entry.Open()) - [xml]$depManifest = $reader.ReadToEnd() - $reader.Close() - } finally { $depZip.Dispose() } - - $nsMgr = New-Object System.Xml.XmlNamespaceManager($depManifest.NameTable) - $nsMgr.AddNamespace("pkg", "http://schemas.microsoft.com/appx/manifest/foundation/windows10") - $id = $depManifest.SelectSingleNode("/pkg:Package/pkg:Identity", $nsMgr) - if ($null -eq $id) { return } - - $arch = $id.GetAttribute("ProcessorArchitecture") - if ([string]::IsNullOrEmpty($arch)) { $arch = $depArch } - $depUri = "${AppInstallerUri}${bundleFolder}/Dependencies/$depArch/$($_.Name)" - - $dependencyEntries += @" - - -"@ - } - } - - if ($dependencyEntries -eq "") { - Write-Warning "No dependency packages found" - } else { - Write-Host "Discovered dependencies:$dependencyEntries" - } - - @" - - - - $dependencyEntries - - -"@ | Set-Content -Path $appInstallerPath -Encoding UTF8 - - Write-Host "Created appinstaller at: $appInstallerPath" -} diff --git a/.github/workflows/cd-sideload-preview.yml b/.github/workflows/cd-sideload-preview.yml index 5e35777ff7ca..a5fabaeb05b0 100644 --- a/.github/workflows/cd-sideload-preview.yml +++ b/.github/workflows/cd-sideload-preview.yml @@ -20,23 +20,15 @@ jobs: build: runs-on: windows-latest environment: Deployments - strategy: - fail-fast: false - matrix: - configuration: [Release] - platform: [x64] env: - SOLUTION_NAME: 'Files.slnx' - CONFIGURATION: '${{ matrix.configuration }}' - PLATFORM: '${{ matrix.platform }}' - APPX_BUNDLE_PLATFORMS: 'x64|arm64' + CONFIGURATION: 'Release' + PLATFORM: 'x64' WORKING_DIR: '${{ github.workspace }}' # D:\a\Files\Files\ - ARTIFACTS_STAGING_DIR: '${{ github.workspace }}\artifacts' - APPX_PACKAGE_DIR: '${{ github.workspace }}\artifacts\AppxPackages\' - APP_PROJECT_PATH: 'src\Files.App\Files.App.csproj' - PACKAGE_MANIFEST_PATH: 'src\Files.App\Package.appxmanifest' - LAUNCHER_PROJECT_PATH: 'src\Files.App.Launcher\Files.App.Launcher.vcxproj' - TEST_PROJECT_PATH: 'tests\Files.InteractionTests\Files.InteractionTests.csproj' + SOLUTION_PATH: '${{ github.workspace }}\Files.slnx' + ARTIFACTS_STAGING_DIR: '${{ github.workspace }}\artifacts\' + APP_PROJECT_DIR: '${{ github.workspace }}\src\Files.App' + STARTUP_PROJECT_PATH: '${{ github.workspace }}\src\Files.App\Files.App.csproj' + PACKAGE_MANIFEST_PATH: '${{ github.workspace }}\src\Files.App\Package.appxmanifest' APP_INSTALLER_SIDELOAD_URL: 'https://cdn.files.community/files/preview/' steps: @@ -52,52 +44,32 @@ jobs: global-json-file: global.json - name: Configure the package manifest, logo, and secrets - shell: pwsh run: | - . './.github/scripts/Configure-AppxManifest.ps1' ` - -Branch "SideloadPreview" ` - -PackageManifestPath "$env:PACKAGE_MANIFEST_PATH" ` - -Publisher "$env:SIDELOAD_PUBLISHER_SECRET" ` - -WorkingDir "$env:WORKING_DIR" ` - -SecretBingMapsKey "$env:SECRET_BINGMAPS_KEY" ` - -SecretSentry "$env:SECRET_SENTRY" ` - -SecretGitHubOAuthClientId "$env:SECRET_GITHUB_OAUTH_CLIENT_ID" + ./.github/scripts/Configure-AppxManifest.ps1 ` + -Branch "SideloadPreview" ` + -PackageManifestPath "$env:PACKAGE_MANIFEST_PATH" ` + -Publisher "$env:SIDELOAD_PUBLISHER_SECRET" ` + -WorkingDir "$env:WORKING_DIR" ` + -SecretBingMapsKey "$env:SECRET_BINGMAPS_KEY" ` + -SecretSentry "$env:SECRET_SENTRY" ` + -SecretGitHubOAuthClientId "$env:SECRET_GITHUB_OAUTH_CLIENT_ID" env: SIDELOAD_PUBLISHER_SECRET: ${{ secrets.SIDELOAD_PUBLISHER_SECRET }} SECRET_BINGMAPS_KEY: ${{ secrets.BING_MAPS_SECRET }} SECRET_SENTRY: ${{ secrets.SENTRY_SECRET }} SECRET_GITHUB_OAUTH_CLIENT_ID: ${{ secrets.GH_OAUTH_CLIENT_ID }} - - name: Use Windows SDK Preview - shell: cmd - run: | - for /f %%a in ('dir /b /a:d %localappdata%\Microsoft\VisualStudio\17*') do echo UsePreviews=True>%localappdata%\Microsoft\VisualStudio\%%a\sdk.txt - - - name: Restore Files - shell: pwsh - run: | - msbuild $env:SOLUTION_NAME ` - -t:Restore ` - -p:Platform=$env:PLATFORM ` - -p:Configuration=$env:CONFIGURATION ` - -p:PublishReadyToRun=true ` - -v:quiet - - - name: Restore NuGet Packages for Launcher Project - shell: pwsh - run: | - nuget restore "$env:LAUNCHER_PROJECT_PATH" ` - -SolutionDirectory "$env:WORKING_DIR" ` - -Verbosity detailed - - - name: Build launcher project + - name: Build & package Files shell: pwsh run: | - msbuild "$env:LAUNCHER_PROJECT_PATH" ` - -t:Build ` - -p:Platform=$env:PLATFORM ` - -p:Configuration=$env:CONFIGURATION ` - -v:quiet + ./.github/scripts/Build-AppSolution.ps1 ` + -ReleaseBranch "SideloadPreview" ` + -SolutionPath "$env:SOLUTION_PATH" ` + -StartupProjectPath "$env:STARTUP_PROJECT_PATH" ` + -Configuration "$env:CONFIGURATION" ` + -Platform "$env:PLATFORM" ` + -AppxPackageDir "$env:ARTIFACTS_STAGING_DIR" ` + -AppInstallerUrl "$env:APP_INSTALLER_SIDELOAD_URL" - name: Sign launcher EXE with Azure Trusted Signing uses: azure/trusted-signing-action@v0.4.0 @@ -115,37 +87,6 @@ jobs: timestamp-rfc3161: http://timestamp.acs.microsoft.com timestamp-digest: SHA256 - - name: Build & package Files - shell: pwsh - run: | - $platforms = "$env:APPX_BUNDLE_PLATFORMS" -split '\|' - foreach ($plat in $platforms) { - Write-Host "Building for $plat..." - msbuild "$env:APP_PROJECT_PATH" ` - -t:Build ` - -p:Platform=$plat ` - -p:Configuration=$env:CONFIGURATION ` - -p:AppxPackageDir="$env:APPX_PACKAGE_DIR" ` - -p:AppxBundle=Never ` - -p:GenerateAppxPackageOnBuild=true ` - -p:UapAppxPackageBuildMode=Sideload ` - -v:quiet - } - - - name: Create msixbundle and appinstaller - shell: pwsh - run: | - . './.github/scripts/Create-MsixBundle.ps1' ` - -AppxPackageDir "$env:APPX_PACKAGE_DIR" ` - -BundleName "Files.Package" ` - -PackageManifestPath "$env:PACKAGE_MANIFEST_PATH" ` - -AppInstallerUri "$env:APP_INSTALLER_SIDELOAD_URL" ` - -BuildMode "Sideload" - - - name: Remove empty files from the packages - shell: bash - run: find $ARTIFACTS_STAGING_DIR -empty -delete - - name: Sign Files with Azure Trusted Signing uses: azure/trusted-signing-action@v0.4.0 with: @@ -155,7 +96,7 @@ jobs: endpoint: https://eus.codesigning.azure.net/ trusted-signing-account-name: ${{ secrets.SIGNING_ACCOUNT_NAME }} certificate-profile-name: ${{ secrets.SIGNING_PROFILE_NAME }} - files-folder: ${{ env.APPX_PACKAGE_DIR }} + files-folder: ${{ env.ARTIFACTS_STAGING_DIR }} files-folder-filter: msixbundle files-folder-recurse: true files-folder-depth: 4 @@ -170,7 +111,7 @@ jobs: r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }} r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }} r2-bucket: ${{ secrets.R2_BUCKET }} - source-dir: ${{ env.APPX_PACKAGE_DIR }} + source-dir: ${{ env.ARTIFACTS_STAGING_DIR }} destination-dir: ./files/preview - name: Upload the packages to GitHub Actions diff --git a/.github/workflows/cd-sideload-stable.yml b/.github/workflows/cd-sideload-stable.yml index e2975dc6f474..8fd2fbbcaba5 100644 --- a/.github/workflows/cd-sideload-stable.yml +++ b/.github/workflows/cd-sideload-stable.yml @@ -20,23 +20,15 @@ jobs: build: runs-on: windows-latest environment: Deployments - strategy: - fail-fast: false - matrix: - configuration: [Release] - platform: [x64] env: - SOLUTION_NAME: 'Files.slnx' - CONFIGURATION: '${{ matrix.configuration }}' - PLATFORM: '${{ matrix.platform }}' - APPX_BUNDLE_PLATFORMS: 'x64|arm64' + CONFIGURATION: 'Release' + PLATFORM: 'x64' WORKING_DIR: '${{ github.workspace }}' # D:\a\Files\Files\ - ARTIFACTS_STAGING_DIR: '${{ github.workspace }}\artifacts' - APPX_PACKAGE_DIR: '${{ github.workspace }}\artifacts\AppxPackages\' - APP_PROJECT_PATH: 'src\Files.App\Files.App.csproj' - PACKAGE_MANIFEST_PATH: 'src\Files.App\Package.appxmanifest' - LAUNCHER_PROJECT_PATH: 'src\Files.App.Launcher\Files.App.Launcher.vcxproj' - TEST_PROJECT_PATH: 'tests\Files.InteractionTests\Files.InteractionTests.csproj' + SOLUTION_PATH: '${{ github.workspace }}\Files.slnx' + ARTIFACTS_STAGING_DIR: '${{ github.workspace }}\artifacts\' + APP_PROJECT_DIR: '${{ github.workspace }}\src\Files.App' + STARTUP_PROJECT_PATH: '${{ github.workspace }}\src\Files.App\Files.App.csproj' + PACKAGE_MANIFEST_PATH: '${{ github.workspace }}\src\Files.App\Package.appxmanifest' APP_INSTALLER_SIDELOAD_URL: 'https://cdn.files.community/files/stable/' steps: @@ -52,52 +44,32 @@ jobs: global-json-file: global.json - name: Configure the package manifest, logo, and secrets - shell: pwsh run: | - . './.github/scripts/Configure-AppxManifest.ps1' ` - -Branch "SideloadStable" ` - -PackageManifestPath "$env:PACKAGE_MANIFEST_PATH" ` - -Publisher "$env:SIDELOAD_PUBLISHER_SECRET" ` - -WorkingDir "$env:WORKING_DIR" ` - -SecretBingMapsKey "$env:SECRET_BINGMAPS_KEY" ` - -SecretSentry "$env:SECRET_SENTRY" ` - -SecretGitHubOAuthClientId "$env:SECRET_GITHUB_OAUTH_CLIENT_ID" + ./.github/scripts/Configure-AppxManifest.ps1 ` + -Branch "SideloadStable" ` + -PackageManifestPath "$env:PACKAGE_MANIFEST_PATH" ` + -Publisher "$env:SIDELOAD_PUBLISHER_SECRET" ` + -WorkingDir "$env:WORKING_DIR" ` + -SecretBingMapsKey "$env:SECRET_BINGMAPS_KEY" ` + -SecretSentry "$env:SECRET_SENTRY" ` + -SecretGitHubOAuthClientId "$env:SECRET_GITHUB_OAUTH_CLIENT_ID" env: SIDELOAD_PUBLISHER_SECRET: ${{ secrets.SIDELOAD_PUBLISHER_SECRET }} SECRET_BINGMAPS_KEY: ${{ secrets.BING_MAPS_SECRET }} SECRET_SENTRY: ${{ secrets.SENTRY_SECRET }} SECRET_GITHUB_OAUTH_CLIENT_ID: ${{ secrets.GH_OAUTH_CLIENT_ID }} - - - name: Use Windows SDK Preview - shell: cmd - run: | - for /f %%a in ('dir /b /a:d %localappdata%\Microsoft\VisualStudio\17*') do echo UsePreviews=True>%localappdata%\Microsoft\VisualStudio\%%a\sdk.txt - - - name: Restore Files - shell: pwsh - run: | - msbuild $env:SOLUTION_NAME ` - -t:Restore ` - -p:Platform=$env:PLATFORM ` - -p:Configuration=$env:CONFIGURATION ` - -p:PublishReadyToRun=true ` - -v:quiet - - name: Restore NuGet Packages for Launcher Project - shell: pwsh - run: | - nuget restore "$env:LAUNCHER_PROJECT_PATH" ` - -SolutionDirectory "$env:WORKING_DIR" ` - -Verbosity detailed - - - name: Build launcher project + - name: Build & package Files shell: pwsh run: | - msbuild "$env:LAUNCHER_PROJECT_PATH" ` - -t:Build ` - -p:Platform=$env:PLATFORM ` - -p:Configuration=$env:CONFIGURATION ` - -v:quiet + ./.github/scripts/Build-AppSolution.ps1 ` + -ReleaseBranch "SideloadStable" ` + -SolutionPath "$env:SOLUTION_PATH" ` + -StartupProjectPath "$env:STARTUP_PROJECT_PATH" ` + -Configuration "$env:CONFIGURATION" ` + -Platform "$env:PLATFORM" ` + -AppxPackageDir "$env:ARTIFACTS_STAGING_DIR" ` + -AppInstallerUrl "$env:APP_INSTALLER_SIDELOAD_URL" - name: Sign launcher EXE with Azure Trusted Signing uses: azure/trusted-signing-action@v0.4.0 @@ -115,37 +87,6 @@ jobs: timestamp-rfc3161: http://timestamp.acs.microsoft.com timestamp-digest: SHA256 - - name: Build & package Files - shell: pwsh - run: | - $platforms = "$env:APPX_BUNDLE_PLATFORMS" -split '\|' - foreach ($plat in $platforms) { - Write-Host "Building for $plat..." - msbuild "$env:APP_PROJECT_PATH" ` - -t:Build ` - -p:Platform=$plat ` - -p:Configuration=$env:CONFIGURATION ` - -p:AppxPackageDir="$env:APPX_PACKAGE_DIR" ` - -p:AppxBundle=Never ` - -p:GenerateAppxPackageOnBuild=true ` - -p:UapAppxPackageBuildMode=Sideload ` - -v:quiet - } - - - name: Create msixbundle and appinstaller - shell: pwsh - run: | - . './.github/scripts/Create-MsixBundle.ps1' ` - -AppxPackageDir "$env:APPX_PACKAGE_DIR" ` - -BundleName "Files.Package" ` - -PackageManifestPath "$env:PACKAGE_MANIFEST_PATH" ` - -AppInstallerUri "$env:APP_INSTALLER_SIDELOAD_URL" ` - -BuildMode "Sideload" - - - name: Remove empty files from the packages - shell: bash - run: find $ARTIFACTS_STAGING_DIR -empty -delete - - name: Sign Files with Azure Trusted Signing uses: azure/trusted-signing-action@v0.4.0 with: @@ -155,7 +96,7 @@ jobs: endpoint: https://eus.codesigning.azure.net/ trusted-signing-account-name: ${{ secrets.SIGNING_ACCOUNT_NAME }} certificate-profile-name: ${{ secrets.SIGNING_PROFILE_NAME }} - files-folder: ${{ env.APPX_PACKAGE_DIR }} + files-folder: ${{ env.ARTIFACTS_STAGING_DIR }} files-folder-filter: msixbundle files-folder-recurse: true files-folder-depth: 4 @@ -170,9 +111,9 @@ jobs: r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }} r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }} r2-bucket: ${{ secrets.R2_BUCKET }} - source-dir: ${{ env.APPX_PACKAGE_DIR }} + source-dir: ${{ env.ARTIFACTS_STAGING_DIR }} destination-dir: ./files/stable - + - name: Upload the packages to GitHub Actions uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/cd-store-preview.yml b/.github/workflows/cd-store-preview.yml index 1fc0842a1765..a4895e9f0110 100644 --- a/.github/workflows/cd-store-preview.yml +++ b/.github/workflows/cd-store-preview.yml @@ -19,22 +19,15 @@ jobs: build: runs-on: windows-latest environment: Deployments - strategy: - fail-fast: false - matrix: - configuration: [Release] - platform: [x64] env: - SOLUTION_NAME: 'Files.slnx' - CONFIGURATION: '${{ matrix.configuration }}' - PLATFORM: '${{ matrix.platform }}' - APPX_BUNDLE_PLATFORMS: 'x64|arm64' + CONFIGURATION: 'Release' + PLATFORM: 'x64' WORKING_DIR: '${{ github.workspace }}' # D:\a\Files\Files\ - ARTIFACTS_STAGING_DIR: '${{ github.workspace }}\artifacts' - APPX_PACKAGE_DIR: '${{ github.workspace }}\artifacts\AppxPackages\' - APP_PROJECT_PATH: '${{ github.workspace }}\src\Files.App\Files.App.csproj' + SOLUTION_PATH: '${{ github.workspace }}\Files.slnx' + ARTIFACTS_STAGING_DIR: '${{ github.workspace }}\artifacts\' + APP_PROJECT_DIR: '${{ github.workspace }}\src\Files.App' + STARTUP_PROJECT_PATH: '${{ github.workspace }}\src\Files.App\Files.App.csproj' PACKAGE_MANIFEST_PATH: '${{ github.workspace }}\src\Files.App\Package.appxmanifest' - LAUNCHER_PROJECT_PATH: 'src\Files.App.Launcher\Files.App.Launcher.vcxproj' steps: - name: Checkout the repository @@ -49,52 +42,30 @@ jobs: global-json-file: global.json - name: Configure the package manifest, logo, and secrets - shell: pwsh run: | - . './.github/scripts/Configure-AppxManifest.ps1' ` - -Branch "StorePreview" ` - -PackageManifestPath "$env:PACKAGE_MANIFEST_PATH" ` - -Publisher "$env:STORE_PUBLISHER_SECRET" ` - -WorkingDir "$env:WORKING_DIR" ` - -SecretBingMapsKey "$env:SECRET_BINGMAPS_KEY" ` - -SecretSentry "$env:SECRET_SENTRY" ` - -SecretGitHubOAuthClientId "$env:SECRET_GITHUB_OAUTH_CLIENT_ID" + ./.github/scripts/Configure-AppxManifest.ps1 ` + -Branch "StorePreview" ` + -PackageManifestPath "$env:PACKAGE_MANIFEST_PATH" ` + -Publisher "$env:STORE_PUBLISHER_SECRET" ` + -WorkingDir "$env:WORKING_DIR" ` + -SecretBingMapsKey "$env:SECRET_BINGMAPS_KEY" ` + -SecretSentry "$env:SECRET_SENTRY" ` + -SecretGitHubOAuthClientId "$env:SECRET_GITHUB_OAUTH_CLIENT_ID" env: STORE_PUBLISHER_SECRET: ${{ secrets.STORE_PUBLISHER_SECRET }} SECRET_BINGMAPS_KEY: ${{ secrets.BING_MAPS_SECRET }} SECRET_SENTRY: ${{ secrets.SENTRY_SECRET }} SECRET_GITHUB_OAUTH_CLIENT_ID: ${{ secrets.GH_OAUTH_CLIENT_ID }} - - name: Use Windows SDK Preview - shell: cmd - run: | - for /f %%a in ('dir /b /a:d %localappdata%\Microsoft\VisualStudio\17*') do echo UsePreviews=True>%localappdata%\Microsoft\VisualStudio\%%a\sdk.txt - - - name: Restore Files - shell: pwsh - run: | - msbuild $env:SOLUTION_NAME ` - -t:Restore ` - -p:Platform=$env:PLATFORM ` - -p:Configuration=$env:CONFIGURATION ` - -p:PublishReadyToRun=true ` - -v:quiet - - - name: Restore NuGet Packages for Launcher Project - shell: pwsh - run: | - nuget restore "$env:LAUNCHER_PROJECT_PATH" ` - -SolutionDirectory "$env:WORKING_DIR" ` - -Verbosity detailed - - - name: Build launcher project - shell: pwsh + - name: Build & package Files run: | - msbuild "$env:LAUNCHER_PROJECT_PATH" ` - -t:Build ` - -p:Platform=$env:PLATFORM ` - -p:Configuration=$env:CONFIGURATION ` - -v:quiet + ./.github/scripts/Build-AppSolution.ps1 ` + -ReleaseBranch "StorePreview" ` + -SolutionPath "$env:SOLUTION_PATH" ` + -StartupProjectPath "$env:STARTUP_PROJECT_PATH" ` + -Configuration "$env:CONFIGURATION" ` + -Platform "$env:PLATFORM" ` + -AppxPackageDir "$env:ARTIFACTS_STAGING_DIR" ` - name: Sign launcher EXE with Azure Trusted Signing uses: azure/trusted-signing-action@v0.4.0 @@ -112,35 +83,6 @@ jobs: timestamp-rfc3161: http://timestamp.acs.microsoft.com timestamp-digest: SHA256 - - name: Build & package Files - shell: pwsh - run: | - $platforms = "$env:APPX_BUNDLE_PLATFORMS" -split '\|' - foreach ($plat in $platforms) { - Write-Host "Building for $plat..." - msbuild "$env:APP_PROJECT_PATH" ` - -t:Build ` - -p:Platform=$plat ` - -p:Configuration=$env:CONFIGURATION ` - -p:AppxPackageDir="$env:APPX_PACKAGE_DIR" ` - -p:AppxBundle=Never ` - -p:GenerateAppxPackageOnBuild=true ` - -p:UapAppxPackageBuildMode=StoreUpload ` - -v:quiet - } - - - name: Create msixbundle and msixupload - shell: pwsh - run: | - . './.github/scripts/Create-MsixBundle.ps1' ` - -AppxPackageDir "$env:APPX_PACKAGE_DIR" ` - -BundleName "Files.Package" ` - -BuildMode "StoreUpload" - - - name: Remove empty files from the packages - shell: bash - run: find $ARTIFACTS_STAGING_DIR -empty -delete - - name: Upload the packages to GitHub Actions uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/cd-store-stable.yml b/.github/workflows/cd-store-stable.yml index dadd8462eb5b..bba48d6397aa 100644 --- a/.github/workflows/cd-store-stable.yml +++ b/.github/workflows/cd-store-stable.yml @@ -19,22 +19,15 @@ jobs: build: runs-on: windows-latest environment: Deployments - strategy: - fail-fast: false - matrix: - configuration: [Release] - platform: [x64] env: - SOLUTION_NAME: 'Files.slnx' - CONFIGURATION: '${{ matrix.configuration }}' - PLATFORM: '${{ matrix.platform }}' - APPX_BUNDLE_PLATFORMS: 'x64|arm64' + CONFIGURATION: 'Release' + PLATFORM: 'x64' WORKING_DIR: '${{ github.workspace }}' # D:\a\Files\Files\ - ARTIFACTS_STAGING_DIR: '${{ github.workspace }}\artifacts' - APPX_PACKAGE_DIR: '${{ github.workspace }}\artifacts\AppxPackages\' - APP_PROJECT_PATH: '${{ github.workspace }}\src\Files.App\Files.App.csproj' + SOLUTION_PATH: '${{ github.workspace }}\Files.slnx' + ARTIFACTS_STAGING_DIR: '${{ github.workspace }}\artifacts\' + APP_PROJECT_DIR: '${{ github.workspace }}\src\Files.App' + STARTUP_PROJECT_PATH: '${{ github.workspace }}\src\Files.App\Files.App.csproj' PACKAGE_MANIFEST_PATH: '${{ github.workspace }}\src\Files.App\Package.appxmanifest' - LAUNCHER_PROJECT_PATH: 'src\Files.App.Launcher\Files.App.Launcher.vcxproj' steps: - name: Checkout the repository @@ -49,52 +42,30 @@ jobs: global-json-file: global.json - name: Configure the package manifest, logo, and secrets - shell: pwsh run: | - . './.github/scripts/Configure-AppxManifest.ps1' ` - -Branch "StoreStable" ` - -PackageManifestPath "$env:PACKAGE_MANIFEST_PATH" ` - -Publisher "$env:STORE_PUBLISHER_SECRET" ` - -WorkingDir "$env:WORKING_DIR" ` - -SecretBingMapsKey "$env:SECRET_BINGMAPS_KEY" ` - -SecretSentry "$env:SECRET_SENTRY" ` - -SecretGitHubOAuthClientId "$env:SECRET_GITHUB_OAUTH_CLIENT_ID" + ./.github/scripts/Configure-AppxManifest.ps1 ` + -Branch "StoreStable" ` + -PackageManifestPath "$env:PACKAGE_MANIFEST_PATH" ` + -Publisher "$env:STORE_PUBLISHER_SECRET" ` + -WorkingDir "$env:WORKING_DIR" ` + -SecretBingMapsKey "$env:SECRET_BINGMAPS_KEY" ` + -SecretSentry "$env:SECRET_SENTRY" ` + -SecretGitHubOAuthClientId "$env:SECRET_GITHUB_OAUTH_CLIENT_ID" env: STORE_PUBLISHER_SECRET: ${{ secrets.STORE_PUBLISHER_SECRET }} SECRET_BINGMAPS_KEY: ${{ secrets.BING_MAPS_SECRET }} SECRET_SENTRY: ${{ secrets.SENTRY_SECRET }} SECRET_GITHUB_OAUTH_CLIENT_ID: ${{ secrets.GH_OAUTH_CLIENT_ID }} - - name: Use Windows SDK Preview - shell: cmd - run: | - for /f %%a in ('dir /b /a:d %localappdata%\Microsoft\VisualStudio\17*') do echo UsePreviews=True>%localappdata%\Microsoft\VisualStudio\%%a\sdk.txt - - - name: Restore Files - shell: pwsh - run: | - msbuild $env:SOLUTION_NAME ` - -t:Restore ` - -p:Platform=$env:PLATFORM ` - -p:Configuration=$env:CONFIGURATION ` - -p:PublishReadyToRun=true ` - -v:quiet - - - name: Restore NuGet Packages for Launcher Project - shell: pwsh - run: | - nuget restore "$env:LAUNCHER_PROJECT_PATH" ` - -SolutionDirectory "$env:WORKING_DIR" ` - -Verbosity detailed - - - name: Build launcher project - shell: pwsh + - name: Build & package Files run: | - msbuild "$env:LAUNCHER_PROJECT_PATH" ` - -t:Build ` - -p:Platform=$env:PLATFORM ` - -p:Configuration=$env:CONFIGURATION ` - -v:quiet + ./.github/scripts/Build-AppSolution.ps1 ` + -ReleaseBranch "StoreStable" ` + -SolutionPath "$env:SOLUTION_PATH" ` + -StartupProjectPath "$env:STARTUP_PROJECT_PATH" ` + -Configuration "$env:CONFIGURATION" ` + -Platform "$env:PLATFORM" ` + -AppxPackageDir "$env:ARTIFACTS_STAGING_DIR" ` - name: Sign launcher EXE with Azure Trusted Signing uses: azure/trusted-signing-action@v0.4.0 @@ -112,35 +83,6 @@ jobs: timestamp-rfc3161: http://timestamp.acs.microsoft.com timestamp-digest: SHA256 - - name: Build & package Files - shell: pwsh - run: | - $platforms = "$env:APPX_BUNDLE_PLATFORMS" -split '\|' - foreach ($plat in $platforms) { - Write-Host "Building for $plat..." - msbuild "$env:APP_PROJECT_PATH" ` - -t:Build ` - -p:Platform=$plat ` - -p:Configuration=$env:CONFIGURATION ` - -p:AppxPackageDir="$env:APPX_PACKAGE_DIR" ` - -p:AppxBundle=Never ` - -p:GenerateAppxPackageOnBuild=true ` - -p:UapAppxPackageBuildMode=StoreUpload ` - -v:quiet - } - - - name: Create msixbundle and msixupload - shell: pwsh - run: | - . './.github/scripts/Create-MsixBundle.ps1' ` - -AppxPackageDir "$env:APPX_PACKAGE_DIR" ` - -BundleName "Files.Package" ` - -BuildMode "StoreUpload" - - - name: Remove empty files from the packages - shell: bash - run: find $ARTIFACTS_STAGING_DIR -empty -delete - - name: Upload the packages to GitHub Actions uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b4b9338ee59..0fb54c2fb543 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,19 +28,17 @@ on: run-name: ${{ github.event_name == 'pull_request' && 'Files PR Validation' || 'Files CI Validation' }} env: - WORKING_DIR: ${{ github.workspace }} # Default: 'D:\a\Files\Files' - SOLUTION_PATH: '${{ github.workspace }}\Files.slnx' - APP_PROJECT_PATH: '${{ github.workspace }}\src\Files.App\Files.App.csproj' - AUTOMATED_TESTS_ARCHITECTURE: 'x64' + WORKING_DIR: '${{ github.workspace }}' # Default: 'D:\a\Files\Files' + SOLUTION_PATH: '${{ github.workspace }}\Files.slnx' + STARTUP_PROJECT_PATH: '${{ github.workspace }}\src\Files.App\Files.App.csproj' + AUTOMATED_TESTS_ARCHITECTURE: 'x64' AUTOMATED_TESTS_CONFIGURATION: 'Release' - AUTOMATED_TESTS_PROJECT_DIR: '${{ github.workspace }}\tests\Files.InteractionTests' - AUTOMATED_TESTS_PROJECT_PATH: '${{ github.workspace }}\tests\Files.InteractionTests\Files.InteractionTests.csproj' - AUTOMATED_TESTS_ASSEMBLY_DIR: '${{ github.workspace }}\artifacts\TestsAssembly' - ARTIFACTS_STAGING_DIR: '${{ github.workspace }}\artifacts' - APPX_PACKAGE_DIR: '${{ github.workspace }}\artifacts\AppxPackages\' - APPX_SELFSIGNED_CERT_PATH: '${{ github.workspace }}\.github\workflows\FilesApp_SelfSigned.pfx' - WINAPPDRIVER_EXE86_PATH: 'C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe' - WINAPPDRIVER_EXE64_PATH: 'C:\Program Files\Windows Application Driver\WinAppDriver.exe' + AUTOMATED_TESTS_PROJECT_DIR: '${{ github.workspace }}\tests\Files.InteractionTests' + AUTOMATED_TESTS_PROJECT_PATH: '${{ github.workspace }}\tests\Files.InteractionTests\Files.InteractionTests.csproj' + ARTIFACTS_STAGING_DIR: '${{ github.workspace }}\artifacts\' # The trailing backslash is needed + APPX_SELFSIGNED_CERT_PATH: '${{ github.workspace }}\FilesApp_SelfSigned.pfx' + WINAPPDRIVER_EXE86_PATH: 'C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe' + WINAPPDRIVER_EXE64_PATH: 'C:\Program Files\Windows Application Driver\WinAppDriver.exe' jobs: @@ -107,69 +105,16 @@ jobs: with: global-json-file: global.json - - name: Restore Files - shell: pwsh + - name: Build Files run: | - msbuild $env:SOLUTION_PATH ` - -t:Restore ` - -p:Platform=$env:ARCHITECTURE ` - -p:Configuration=$env:CONFIGURATION ` - -p:PublishReadyToRun=true ` - -v:quiet - - - if: env.CONFIGURATION != env.AUTOMATED_TESTS_CONFIGURATION || env.ARCHITECTURE != env.AUTOMATED_TESTS_ARCHITECTURE - name: Build Files - run: | - msbuild ` - $env:APP_PROJECT_PATH ` - -t:Build ` - -p:Configuration=$env:CONFIGURATION ` - -p:Platform=$env:ARCHITECTURE ` - -p:AppxBundle=Never ` - -p:GenerateAppxPackageOnBuild=false ` - -v:quiet - - - if: env.CONFIGURATION == env.AUTOMATED_TESTS_CONFIGURATION && env.ARCHITECTURE == env.AUTOMATED_TESTS_ARCHITECTURE - name: Create self signed cert as a pfx file - run: ./.github/scripts/Generate-SelfCertPfx.ps1 -Destination "$env:APPX_SELFSIGNED_CERT_PATH" - - - if: env.CONFIGURATION == env.AUTOMATED_TESTS_CONFIGURATION && env.ARCHITECTURE == env.AUTOMATED_TESTS_ARCHITECTURE - name: Build & package Files - run: | - msbuild ` - $env:APP_PROJECT_PATH ` - -t:Build ` - -p:Configuration=$env:CONFIGURATION ` - -p:Platform=$env:ARCHITECTURE ` - -p:AppxBundlePlatforms=$env:AUTOMATED_TESTS_ARCHITECTURE ` - -p:AppxBundle=Always ` - -p:GenerateAppxPackageOnBuild=true ` - -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 - - - if: env.ARCHITECTURE == env.AUTOMATED_TESTS_ARCHITECTURE && env.CONFIGURATION == env.AUTOMATED_TESTS_CONFIGURATION - name: Build interaction tests - run: | - msbuild $env:AUTOMATED_TESTS_PROJECT_PATH ` - -t:Build ` - -p:Configuration=$env:CONFIGURATION ` - -p:Platform=$env:AUTOMATED_TESTS_ARCHITECTURE ` - -v:quiet - - - if: env.ARCHITECTURE == env.AUTOMATED_TESTS_ARCHITECTURE && env.CONFIGURATION == env.AUTOMATED_TESTS_CONFIGURATION - name: Copy tests bin to the artifacts dir - shell: pwsh - run: | - Copy-Item ` - -Path "$env:AUTOMATED_TESTS_PROJECT_DIR\bin" ` - -Destination "$env:AUTOMATED_TESTS_ASSEMBLY_DIR" -Recurse - # Copy the self-signed cert so the test job can trust it - Copy-Item -Path "$env:APPX_SELFSIGNED_CERT_PATH" -Destination "$env:ARTIFACTS_STAGING_DIR" + ./.github/scripts/Build-AppSolution.ps1 ` + -ReleaseBranch "$env:CONFIGURATION" ` + -SolutionPath "$env:SOLUTION_PATH" ` + -StartupProjectPath "$env:STARTUP_PROJECT_PATH" ` + -Configuration "$env:CONFIGURATION" ` + -Platform "$env:ARCHITECTURE" ` + -AppxPackageDir "$env:ARTIFACTS_STAGING_DIR" ` + -AppxPackageCertKeyFilePath "$env:APPX_SELFSIGNED_CERT_PATH" - if: env.ARCHITECTURE == env.AUTOMATED_TESTS_ARCHITECTURE && env.CONFIGURATION == env.AUTOMATED_TESTS_CONFIGURATION name: Upload the packages to the Artifacts @@ -191,6 +136,7 @@ jobs: platform: [x64] env: CONFIGURATION: ${{ matrix.configuration }} + ARCHITECTURE: ${{ matrix.platform }} permissions: contents: read pull-requests: write @@ -203,6 +149,10 @@ jobs: - name: Checkout the repository uses: actions/checkout@v4 + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v2 + - name: Setup NuGet + uses: NuGet/setup-nuget@v2 - name: Setup .NET uses: actions/setup-dotnet@v4 with: @@ -211,46 +161,21 @@ jobs: - name: Download the packages from the Artifacts uses: actions/download-artifact@v4 with: - name: 'Appx Packages (${{ env.CONFIGURATION }}, ${{ env.AUTOMATED_TESTS_ARCHITECTURE }})' + name: 'Appx Packages (${{ env.CONFIGURATION }}, ${{ env.ARCHITECTURE }})' path: ${{ env.ARTIFACTS_STAGING_DIR }} - - name: Install Files - shell: powershell + - name: Prepare for the tests run: | - # Trust the self-signed certificate - Import-PfxCertificate ` - -FilePath (Join-Path $env:ARTIFACTS_STAGING_DIR "FilesApp_SelfSigned.pfx") ` - -CertStoreLocation Cert:\LocalMachine\Root ` - -Password (New-Object System.Security.SecureString) - - # Install Windows App Runtime (derive major.minor from Directory.Packages.props) - [xml]$pkgProps = Get-Content "$env:WORKING_DIR\Directory.Packages.props" - $sdkVer = ($pkgProps.Project.ItemGroup.PackageVersion | Where-Object Include -eq 'Microsoft.WindowsAppSDK').Version - $majorMinor = ($sdkVer -split '\.')[0..1] -join '.' - $installer = Join-Path $env:TEMP "windowsappruntimeinstall-x64.exe" - Invoke-WebRequest -Uri "https://aka.ms/windowsappsdk/$majorMinor/latest/windowsappruntimeinstall-x64.exe" -OutFile $installer - Start-Process $installer -ArgumentList "--quiet","--force" -Wait -NoNewWindow - - # Install the app package (with any sideload dependencies) - $pkg = Get-ChildItem $env:APPX_PACKAGE_DIR -Recurse -Include *.msixbundle, *.msix | - Where-Object { $_.DirectoryName -notmatch '\\Dependencies\\' } | Select-Object -First 1 - $deps = @(Get-ChildItem $env:APPX_PACKAGE_DIR -Recurse -Filter *.appx | - Where-Object { $_.DirectoryName -match '\\Dependencies\\' } | ForEach-Object { $_.FullName }) - if ($deps.Count -gt 0) { - Add-AppxPackage -Path $pkg.FullName -DependencyPath $deps - } else { - Add-AppxPackage -Path $pkg.FullName - } - - - name: Set full HD resolution - run: Set-DisplayResolution -Width 1920 -Height 1080 -Force - - - name: Start WinAppDriver process - shell: pwsh - run: Start-Process -FilePath "$env:WINAPPDRIVER_EXE86_PATH" + msbuild -restore $env:AUTOMATED_TESTS_PROJECT_PATH /p:Configuration=$env:CONFIGURATION /p:Platform=$env:ARCHITECTURE + Set-Location "$env:ARTIFACTS_STAGING_DIR" + $AppxPackageBundleDir = Get-ChildItem -Filter *_*_Test -Name + Set-Location $AppxPackageBundleDir + ./Install.ps1 -Force + Set-DisplayResolution -Width 1920 -Height 1080 -Force + Start-Process -FilePath "$env:WINAPPDRIVER_EXE86_PATH" # Retry integration tests if first attempt fails - - name: Run interaction tests + - name: Run the interaction tests uses: nick-fields/retry@v3 with: timeout_minutes: 15 @@ -259,32 +184,9 @@ jobs: command: | dotnet test ` --test-modules **\Files.InteractionTests.dll ` - --root-directory $env:AUTOMATED_TESTS_ASSEMBLY_DIR ` - --results-directory $env:AUTOMATED_TESTS_ASSEMBLY_DIR ` - --report-trx ` - --report-trx-filename testResults.trx + --root-directory $env:AUTOMATED_TESTS_PROJECT_DIR\bin - if: github.event_name == 'pull_request' uses: geekyeggo/delete-artifact@v5 with: name: '*' - - # - name: Generate markdown from the tests result - # shell: pwsh - # run: | - # . './scripts/Convert-TrxToMarkdown.ps1' ` - # -Source "$env:AUTOMATED_TESTS_ASSEMBLY_DIR\testResults.trx" ` - # -Destination "$env:AUTOMATED_TESTS_ASSEMBLY_DIR\testResults.md" - # env: - # PULL_REQUEST_ID: ${{ github.event.pull_request_id }} - - # - name: Display the markdown on the output (temp) - # shell: pwsh - # run: | - # Get-Content $env:AUTOMATED_TESTS_ASSEMBLY_DIR\testResults.md - - # - name: Publish tests result - # uses: marocchino/sticky-pull-request-comment@v2 - # with: - # header: test-result - # path: '${{ env.AUTOMATED_TESTS_ASSEMBLY_DIR }}\testResults.md' diff --git a/Directory.Build.props b/Directory.Build.props index 6696a667afb4..dcaaad86f463 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,13 +1,25 @@  + + net10.0 10.0.26100.0 10.0.19041.0 10.0.26100.67-preview $(TargetFrameworkVersion)-windows$(TargetWindowsVersion) preview + false + true + true + enable + true + true + + + strict + diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 000000000000..85d4acb17f24 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,11 @@ + + + + + + + diff --git a/Directory.Packages.props b/Directory.Packages.props index 0936157a85b9..dcd23ae9f610 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -29,6 +29,7 @@ + diff --git a/Files.slnx b/Files.slnx index 49657a490d21..5e926723ef54 100644 --- a/Files.slnx +++ b/Files.slnx @@ -6,6 +6,7 @@ + diff --git a/src/Files.App.Server/AppInstanceMonitor.cs b/src/Files.App.Server/AppInstanceMonitor.cs index 9d3688e65826..b26838a49408 100644 --- a/src/Files.App.Server/AppInstanceMonitor.cs +++ b/src/Files.App.Server/AppInstanceMonitor.cs @@ -1,7 +1,9 @@ // Copyright (c) Files Community // Licensed under the MIT License. +using System; using System.Diagnostics; +using System.Threading; namespace Files.App.Server; diff --git a/src/Files.App.Server/Files.App.Server.csproj b/src/Files.App.Server/Files.App.Server.csproj index a0a643b44e32..eb11500e5553 100644 --- a/src/Files.App.Server/Files.App.Server.csproj +++ b/src/Files.App.Server/Files.App.Server.csproj @@ -2,33 +2,28 @@ + + WinExe - en-US - Scale|DXFeatureLevel - Language=en-US;af;ar;be-BY;bg;ca;cs-CZ;da;de-DE;el;en-GB;es-ES;es-419;fa-IR;fi-FI;fil-PH;fr-FR;he-IL;hi-IN;hr-HR;hu-HU;hy-AM;id-ID;it-IT;ja-JP;ka;km-KH;ko-KR;lt-LT;lv-LV;ms-MY;nb-NO;nl-NL;pl-PL;pt-BR;pt-PT;ro-RO;ru-RU;sk-SK;sq-AL;sr-Cyrl;sv-SE;ta;th-TH;tr-TR;uk-UA;vi;zh-Hans;zh-Hant $(WindowsTargetFramework) $(MinimalWindowsVersion) - enable - enable Debug;Release x86;x64;arm64 - true win-x86;win-x64;win-arm64 - win-x86 - win-x64 - win-arm64 - true + win-$(Platform).pubxml + bin\$(Platform)\$(Configuration)\$(TargetFramework)\publish\ + + true $(TargetWindowsVersion) - app.manifest - False - True - True - False - True true + + + true true true + true + @@ -38,7 +33,7 @@ - + PreserveNewest Files.App.Server.winmd false diff --git a/src/Files.App.Server/Helpers.cs b/src/Files.App.Server/Helpers.cs index 8ab3253540d5..d4b1215f956a 100644 --- a/src/Files.App.Server/Helpers.cs +++ b/src/Files.App.Server/Helpers.cs @@ -1,6 +1,7 @@ // Copyright (c) Files Community // Licensed under the MIT License. +using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Windows.Win32.Foundation; diff --git a/src/Files.App.Server/Program.cs b/src/Files.App.Server/Program.cs index b00061eaba85..ebc2eb63a393 100644 --- a/src/Files.App.Server/Program.cs +++ b/src/Files.App.Server/Program.cs @@ -2,8 +2,13 @@ // Licensed under the MIT License. using Files.Shared.Helpers; +using System; +using System.IO; +using System.Linq; using System.Runtime.ExceptionServices; using System.Runtime.InteropServices; +using System.Threading; +using System.Threading.Tasks; using Windows.Storage; using Windows.Win32; using Windows.Win32.Foundation; @@ -25,10 +30,12 @@ static async Task Main() _ = PInvoke.RoInitialize(RO_INIT_TYPE.RO_INIT_MULTITHREADED); - var classIds = typeof(Program).Assembly.GetTypes() - .Where(t => t.IsSealed && t.IsPublic && t.IsClass) - .Select(t => t.FullName!) - .Where(name => name.StartsWith("Files.App.Server.", StringComparison.Ordinal)) + string[] classIdsStringArray = + [ + "Files.App.Server.AppInstanceMonitor", + ]; + + var classIds = classIdsStringArray .Select(name => { if (PInvoke.WindowsCreateString(name, (uint)name.Length, out var classId) is HRESULT hr && hr.Value is not 0) diff --git a/src/Files.App.Server/Properties/PublishProfiles/win-arm64.pubxml b/src/Files.App.Server/Properties/PublishProfiles/win-arm64.pubxml index fa22017606e1..918cc4e67670 100644 --- a/src/Files.App.Server/Properties/PublishProfiles/win-arm64.pubxml +++ b/src/Files.App.Server/Properties/PublishProfiles/win-arm64.pubxml @@ -9,9 +9,5 @@ https://go.microsoft.com/fwlink/?LinkID=208121. win-arm64 true False - \ No newline at end of file diff --git a/src/Files.App.Server/Properties/PublishProfiles/win-x64.pubxml b/src/Files.App.Server/Properties/PublishProfiles/win-x64.pubxml index ade36f7b92f7..aa864f098c36 100644 --- a/src/Files.App.Server/Properties/PublishProfiles/win-x64.pubxml +++ b/src/Files.App.Server/Properties/PublishProfiles/win-x64.pubxml @@ -9,9 +9,5 @@ https://go.microsoft.com/fwlink/?LinkID=208121. win-x64 true False - \ No newline at end of file diff --git a/src/Files.App.Server/Properties/PublishProfiles/win-x86.pubxml b/src/Files.App.Server/Properties/PublishProfiles/win-x86.pubxml index ca5ce6cea006..520cb694cc03 100644 --- a/src/Files.App.Server/Properties/PublishProfiles/win-x86.pubxml +++ b/src/Files.App.Server/Properties/PublishProfiles/win-x86.pubxml @@ -9,9 +9,5 @@ https://go.microsoft.com/fwlink/?LinkID=208121. win-x86 true False - \ No newline at end of file diff --git a/src/Files.App/Files.App.csproj b/src/Files.App/Files.App.csproj index bcd613141b1d..9cab55e42343 100644 --- a/src/Files.App/Files.App.csproj +++ b/src/Files.App/Files.App.csproj @@ -2,67 +2,61 @@ - true - Properties\PublishProfiles\win-$(Platform).pubxml - $(WindowsTargetFramework) + + WinExe - Files - en-US - Scale|DXFeatureLevel - Language=en-US;af;ar;be-BY;bg;ca;cs-CZ;da;de-DE;el;en-GB;es-ES;es-419;fa-IR;fi-FI;fil-PH;fr-FR;he-IL;hi-IN;hr-HR;hu-HU;hy-AM;id-ID;it-IT;ja-JP;ka;km-KH;ko-KR;lt-LT;lv-LV;ms-MY;nb-NO;nl-NL;pl-PL;pt-BR;pt-PT;ro-RO;ru-RU;sk-SK;sq-AL;sr-Cyrl;sv-SE;ta;th-TH;tr-TR;uk-UA;vi;zh-Hans;zh-Hant + $(WindowsTargetFramework) $(MinimalWindowsVersion) - False - SHA256 - False - False - Always - False - x86|x64|arm64 - 0 - Enable - app.manifest + Debug;Release + Files x86;x64;arm64 win-x86;win-x64;win-arm64 - true + win-$(Platform).pubxml + bin\$(Platform)\$(Configuration)\$(TargetFramework)\publish\ + true - true false - Debug;Release + + + true + false + Assets\AppTiles\Dev\Logo.ico + $(DefineConstants);DISABLE_XAML_GENERATED_MAIN + false + app.manifest Files.App.Server;Microsoft.UI.Content.ContentExternalOutputLink;Microsoft.UI.Content.IContentExternalOutputLink - bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + + + true + en-US + sha256 + true + Never + Always + x64|arm64 + StoreAndSideload + true + Scale|DXFeatureLevel + Language=en-US;af;ar;be-BY;bg;ca;cs-CZ;da;de-DE;el;en-GB;es-ES;es-419;fa-IR;fi-FI;fil-PH;fr-FR;he-IL;hi-IN;hr-HR;hu-HU;hy-AM;id-ID;it-IT;ja-JP;ka;km-KH;ko-KR;lt-LT;lv-LV;ms-MY;nb-NO;nl-NL;pl-PL;pt-BR;pt-PT;ro-RO;ru-RU;sk-SK;sq-AL;sr-Cyrl;sv-SE;ta;th-TH;tr-TR;uk-UA;vi;zh-Hans;zh-Hant + + False True True - Assets\AppTiles\Dev\Logo.ico - - - $(DefineConstants);DISABLE_XAML_GENERATED_MAIN - + - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - + + + + + + + + + + @@ -90,6 +84,7 @@ + @@ -108,16 +103,6 @@ - - - - - PreserveNewest - Files.App.Server.winmd - false - - - @@ -137,13 +122,9 @@ - - - - - + diff --git a/src/Files.App/Properties/PublishProfiles/win-arm64.pubxml b/src/Files.App/Properties/PublishProfiles/win-arm64.pubxml index fa22017606e1..918cc4e67670 100644 --- a/src/Files.App/Properties/PublishProfiles/win-arm64.pubxml +++ b/src/Files.App/Properties/PublishProfiles/win-arm64.pubxml @@ -9,9 +9,5 @@ https://go.microsoft.com/fwlink/?LinkID=208121. win-arm64 true False - \ No newline at end of file diff --git a/src/Files.App/Properties/PublishProfiles/win-x64.pubxml b/src/Files.App/Properties/PublishProfiles/win-x64.pubxml index ade36f7b92f7..aa864f098c36 100644 --- a/src/Files.App/Properties/PublishProfiles/win-x64.pubxml +++ b/src/Files.App/Properties/PublishProfiles/win-x64.pubxml @@ -9,9 +9,5 @@ https://go.microsoft.com/fwlink/?LinkID=208121. win-x64 true False - \ No newline at end of file diff --git a/src/Files.App/Properties/PublishProfiles/win-x86.pubxml b/src/Files.App/Properties/PublishProfiles/win-x86.pubxml index ca5ce6cea006..520cb694cc03 100644 --- a/src/Files.App/Properties/PublishProfiles/win-x86.pubxml +++ b/src/Files.App/Properties/PublishProfiles/win-x86.pubxml @@ -9,9 +9,5 @@ https://go.microsoft.com/fwlink/?LinkID=208121. win-x86 true False - \ No newline at end of file diff --git a/src/Files.App/Properties/launchSettings.json b/src/Files.App/Properties/launchSettings.json index 7270d2833e73..06ec6443bf16 100644 --- a/src/Files.App/Properties/launchSettings.json +++ b/src/Files.App/Properties/launchSettings.json @@ -1,7 +1,10 @@ { "profiles": { - "MsixPackage": { + "Files (Package)": { "commandName": "MsixPackage" + }, + "Files (Unpackaged)": { + "commandName": "Project" } } }