diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..85bfa34 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,97 @@ +name: CI Build + +on: + push: + branches: + - main + - dev_master + paths-ignore: + - '**.md' + - 'LICENSE.txt' + pull_request: + branches: + - main + - dev_master + paths-ignore: + - '**.md' + - 'LICENSE.txt' + +env: + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" + +permissions: + packages: write + +jobs: + build: + runs-on: windows-latest + permissions: + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v5 + with: + submodules: recursive + + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: '10.0.x' + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v2 + + - name: Setup NuGet + uses: nuget/setup-nuget@v2 + + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + - name: Setup vcpkg + uses: lukka/run-vcpkg@v11 + with: + vcpkgDirectory: '${{ github.workspace }}/vcpkg' + runVcpkgInstall: false + + - name: Restore NuGet packages + run: nuget restore OpenNet.slnx + + - name: Install vcpkg dependencies for VS + working-directory: ${{env.GITHUB_WORKSPACE}} + run: vcpkg integrate install + shell: pwsh + + - name: Build x64 Release + run: | + msbuild OpenNet.slnx /p:Configuration=Release /p:Platform=x64 /p:PlatformToolset=v143 /p:AppxBundlePlatforms="x64" /p:AppxPackageSigningEnabled=false /p:UapAppxPackageBuildMode=SideloadOnly /p:VcpkgEnableManifest=true /p:VcpkgManifestInstall=false /m + shell: pwsh + + - name: Build ARM64 Release + run: | + msbuild OpenNet.slnx /p:Configuration=Release /p:Platform=ARM64 /p:PlatformToolset=v143 /p:AppxBundlePlatforms="ARM64" /p:AppxPackageSigningEnabled=false /p:UapAppxPackageBuildMode=SideloadOnly /p:VcpkgEnableManifest=true /p:VcpkgManifestInstall=false /m + shell: pwsh + + - name: Upload x64 build artifacts + uses: actions/upload-artifact@v4 + with: + name: OpenNet-x64-Release + path: | + OpenNet/x64/Release/ + !**/*.pdb + !**/*.ilk + retention-days: 7 + + - name: Upload ARM64 build artifacts + uses: actions/upload-artifact@v4 + with: + name: OpenNet-ARM64-Release + path: | + OpenNet/ARM64/Release/ + !**/*.pdb + !**/*.ilk + retention-days: 7 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..84c0ecf --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,185 @@ +name: Release + +on: + push: + tags: + - 'v*' + - 'V*' + +env: + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" + +jobs: + build: + runs-on: windows-latest + permissions: + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Setup .NET 10.0 Preview + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '10.0.x' + dotnet-quality: 'preview' + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v2 + + - name: Setup NuGet + uses: nuget/setup-nuget@v2 + + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + - name: Setup vcpkg + uses: lukka/run-vcpkg@v11 + with: + vcpkgDirectory: '${{ github.workspace }}/vcpkg' + vcpkgGitCommitId: '4f8fe05871555c1798dbcb1957d0d595e94f7b57' + runVcpkgInstall: false + + - name: Restore NuGet packages + run: nuget restore OpenNet.sln + + - name: Install vcpkg dependencies for x64 and ARM64 + run: | + cd OpenNet + ${{ github.workspace }}/vcpkg/vcpkg install --triplet x64-windows + ${{ github.workspace }}/vcpkg/vcpkg install --triplet arm64-windows + ${{ github.workspace }}/vcpkg/vcpkg integrate install + shell: pwsh + + - name: Build x64 Release + run: | + msbuild OpenNet.sln /p:Configuration=Release /p:Platform=x64 /p:PlatformToolset=v143 /p:AppxBundlePlatforms="x64" /p:AppxPackageSigningEnabled=false /p:UapAppxPackageBuildMode=SideloadOnly /p:VcpkgEnableManifest=true /p:VcpkgManifestInstall=false /m + shell: pwsh + + - name: Build ARM64 Release + run: | + msbuild OpenNet.sln /p:Configuration=Release /p:Platform=ARM64 /p:PlatformToolset=v143 /p:AppxBundlePlatforms="ARM64" /p:AppxPackageSigningEnabled=false /p:UapAppxPackageBuildMode=SideloadOnly /p:VcpkgEnableManifest=true /p:VcpkgManifestInstall=false /m + shell: pwsh + + - name: Create x64 release package with 7z + run: | + $outputDir = "OpenNet/x64/Release" + $packageName = "OpenNet_x64" + + # Create a clean directory for release files + New-Item -ItemType Directory -Force -Path "release-x64" + + # Copy AppX/MSIX packages if they exist + $appxPath = Get-ChildItem -Path $outputDir -Filter "*.msix" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1 + if ($appxPath) { + Copy-Item -Path $appxPath.FullName -Destination "release-x64/" -Force + } + + # Copy AppPackages folder if exists (MSIX sideload packages) + if (Test-Path "OpenNet/AppPackages") { + Get-ChildItem -Path "OpenNet/AppPackages" -Filter "*x64*" -Recurse | + Copy-Item -Destination "release-x64/" -Force -Recurse + } + + # Copy AppX folder if exists + if (Test-Path "$outputDir/AppX") { + Copy-Item -Path "$outputDir/AppX/*" -Destination "release-x64/" -Recurse -Force + } + + # Also copy loose files (exe, dll, etc.) as fallback + if (Test-Path "$outputDir/OpenNet.exe") { + Get-ChildItem -Path $outputDir -Include *.exe,*.dll,*.pri,*.winmd -Recurse | + Where-Object { $_.FullName -notlike "*vcpkg_installed*" } | + Copy-Item -Destination "release-x64/" -Force + } + + # Compress with 7z + 7z a -t7z "${packageName}.7z" "./release-x64/*" + shell: pwsh + + - name: Create ARM64 release package with 7z + run: | + $outputDir = "OpenNet/ARM64/Release" + $packageName = "OpenNet_ARM64" + + # Create a clean directory for release files + New-Item -ItemType Directory -Force -Path "release-ARM64" + + # Copy AppX/MSIX packages if they exist + $appxPath = Get-ChildItem -Path $outputDir -Filter "*.msix" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1 + if ($appxPath) { + Copy-Item -Path $appxPath.FullName -Destination "release-ARM64/" -Force + } + + # Copy AppPackages folder if exists (MSIX sideload packages) + if (Test-Path "OpenNet/AppPackages") { + Get-ChildItem -Path "OpenNet/AppPackages" -Filter "*ARM64*" -Recurse | + Copy-Item -Destination "release-ARM64/" -Force -Recurse + } + + # Copy AppX folder if exists + if (Test-Path "$outputDir/AppX") { + Copy-Item -Path "$outputDir/AppX/*" -Destination "release-ARM64/" -Recurse -Force + } + + # Also copy loose files (exe, dll, etc.) as fallback + if (Test-Path "$outputDir/OpenNet.exe") { + Get-ChildItem -Path $outputDir -Include *.exe,*.dll,*.pri,*.winmd -Recurse | + Where-Object { $_.FullName -notlike "*vcpkg_installed*" } | + Copy-Item -Destination "release-ARM64/" -Force + } + + # Compress with 7z + 7z a -t7z "${packageName}.7z" "./release-ARM64/*" + shell: pwsh + + - name: Upload x64 release artifact + uses: actions/upload-artifact@v4 + with: + name: OpenNet_x64 + path: OpenNet_x64.7z + retention-days: 7 + + - name: Upload ARM64 release artifact + uses: actions/upload-artifact@v4 + with: + name: OpenNet_ARM64 + path: OpenNet_ARM64.7z + retention-days: 7 + + release: + needs: build + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Download x64 artifact + uses: actions/download-artifact@v4 + with: + name: OpenNet_x64 + path: ./artifacts + + - name: Download ARM64 artifact + uses: actions/download-artifact@v4 + with: + name: OpenNet_ARM64 + path: ./artifacts + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: | + ./artifacts/OpenNet_x64.7z + ./artifacts/OpenNet_ARM64.7z + draft: false + prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }} + generate_release_notes: true + token: ${{ secrets.GITHUB_TOKEN }}