From 78d380af67b2f79be57fb06a6936132e5e427666 Mon Sep 17 00:00:00 2001 From: Mika3578 <58137747+Mika3578@users.noreply.github.com> Date: Tue, 11 Nov 2025 12:47:33 +0100 Subject: [PATCH 01/10] Update subproject commits to dirty state and upgrade PlatformToolset from v142 to v143 across multiple projects. Added LanguageStandard settings for improved compatibility. --- ReplaceVistaIcon/ReplaceVistaIcon.vcxproj | 8 ++++++-- ResizableLib/ResizableLib.vcxproj | 8 ++++++-- srchybrid/CxImage/cximage.vcxproj | 8 ++++++-- srchybrid/emule.vcxproj | 8 ++++++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/ReplaceVistaIcon/ReplaceVistaIcon.vcxproj b/ReplaceVistaIcon/ReplaceVistaIcon.vcxproj index ea6655629..e4bbfffd5 100644 --- a/ReplaceVistaIcon/ReplaceVistaIcon.vcxproj +++ b/ReplaceVistaIcon/ReplaceVistaIcon.vcxproj @@ -21,12 +21,12 @@ Application MultiByte - v142 + v143 Application MultiByte - v142 + v143 @@ -65,6 +65,8 @@ Use Level3 EditAndContinue + Default + Default $(OutDir)ReplaceVistaIcon.exe @@ -84,6 +86,8 @@ Use Level3 ProgramDatabase + Default + Default $(OutDir)ReplaceVistaIcon.exe diff --git a/ResizableLib/ResizableLib.vcxproj b/ResizableLib/ResizableLib.vcxproj index c3920dd93..d8c67776d 100644 --- a/ResizableLib/ResizableLib.vcxproj +++ b/ResizableLib/ResizableLib.vcxproj @@ -21,13 +21,13 @@ StaticLibrary Static Unicode - v142 + v143 StaticLibrary Static Unicode - v142 + v143 @@ -75,6 +75,8 @@ true true true + Default + Default _AFXDLL;NDEBUG;%(PreprocessorDefinitions) @@ -101,6 +103,8 @@ Level4 true ProgramDatabase + Default + Default _AFXDLL;_DEBUG;%(PreprocessorDefinitions) diff --git a/srchybrid/CxImage/cximage.vcxproj b/srchybrid/CxImage/cximage.vcxproj index 0000eb9ef..28f64b970 100644 --- a/srchybrid/CxImage/cximage.vcxproj +++ b/srchybrid/CxImage/cximage.vcxproj @@ -21,13 +21,13 @@ StaticLibrary Static Unicode - v142 + v143 StaticLibrary Static Unicode - v142 + v143 @@ -75,6 +75,8 @@ Level3 Default true + Default + Default _AFXDLL;NDEBUG;%(PreprocessorDefinitions) @@ -102,6 +104,8 @@ Level3 ProgramDatabase Default + Default + Default _DEBUG;%(PreprocessorDefinitions) diff --git a/srchybrid/emule.vcxproj b/srchybrid/emule.vcxproj index 0a5934970..ec8a92561 100644 --- a/srchybrid/emule.vcxproj +++ b/srchybrid/emule.vcxproj @@ -35,13 +35,13 @@ false Unicode true - v142 + v143 Application Static Unicode - v142 + v143 @@ -109,6 +109,8 @@ Use Level4 ProgramDatabase + Default + Default _DEBUG;_UNICODE;UNICODE;%(PreprocessorDefinitions) @@ -166,6 +168,8 @@ Level3 ProgramDatabase + Default + Default NDEBUG;_UNICODE;UNICODE;%(PreprocessorDefinitions) From 6e96a92a45e5e1a7a20133f7bb5e27755db26367 Mon Sep 17 00:00:00 2001 From: Mika3578 <58137747+Mika3578@users.noreply.github.com> Date: Tue, 11 Nov 2025 15:08:36 +0100 Subject: [PATCH 02/10] Add GitHub Actions workflow for building eMule MorphXT and update PlatformToolset to v143 --- .github/workflows/build-emule.yml | 48 +++++++++++++++++++++++++++++++ srchybrid/emule.vcxproj | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-emule.yml diff --git a/.github/workflows/build-emule.yml b/.github/workflows/build-emule.yml new file mode 100644 index 000000000..5485c96f2 --- /dev/null +++ b/.github/workflows/build-emule.yml @@ -0,0 +1,48 @@ +name: Build eMule MorphXT + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: windows-latest + steps: + - name: Checkout repository with submodules + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install MSBuild + uses: microsoft/setup-msbuild@v2 + with: + msbuild-architecture: x86 + + - name: Restore NuGet packages + run: nuget restore srchybrid\emule.sln + + - name: Build Release Win32 + run: msbuild srchybrid\emule.sln /p:Configuration=Release /p:Platform=Win32 /m + + - name: Collect build output + shell: pwsh + run: | + $binaryDir = "srchybrid\build\Win32\Binary" + if (-not (Test-Path $binaryDir)) { + throw "Expected build output directory '$binaryDir' was not created." + } + New-Item -ItemType Directory -Path artifacts -Force | Out-Null + Copy-Item -Path "$binaryDir\*" -Destination "artifacts" -Recurse -Force + + - name: Upload release artifact + uses: actions/upload-artifact@v4 + with: + name: emule-release-win32 + path: artifacts + + diff --git a/srchybrid/emule.vcxproj b/srchybrid/emule.vcxproj index ec8a92561..da66376d5 100644 --- a/srchybrid/emule.vcxproj +++ b/srchybrid/emule.vcxproj @@ -27,7 +27,7 @@ Static Unicode true - v142 + v143 Application From 6718b18422c8241e5875f514bdda359783abe276 Mon Sep 17 00:00:00 2001 From: Mika3578 <58137747+Mika3578@users.noreply.github.com> Date: Tue, 11 Nov 2025 17:55:52 +0100 Subject: [PATCH 03/10] Add GitHub Actions workflows for Code Quality, CodeQL analysis, and Release Build; include static analysis, lint checks, and dependency reviews --- .github/codeql/codeql-config.yml | 35 +++++ .github/workflows/build-emule.yml | 198 +++++++++++++++++++++++++---- .github/workflows/code-quality.yml | 170 +++++++++++++++++++++++++ .github/workflows/codeql.yml | 103 +++++++++++++++ .github/workflows/release.yml | 182 ++++++++++++++++++++++++++ .github/workflows/stale.yml | 44 +++++++ 6 files changed, 708 insertions(+), 24 deletions(-) create mode 100644 .github/codeql/codeql-config.yml create mode 100644 .github/workflows/code-quality.yml create mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/stale.yml diff --git a/.github/codeql/codeql-config.yml b/.github/codeql/codeql-config.yml new file mode 100644 index 000000000..6a83a24c2 --- /dev/null +++ b/.github/codeql/codeql-config.yml @@ -0,0 +1,35 @@ +name: "CodeQL Config for eMule MorphXT" + +# Paths to include in analysis +paths: + - srchybrid + - cryptopp + - ResizableLib + - ReplaceVistaIcon + +# Paths to exclude from analysis +paths-ignore: + - "**/build/**" + - "**/Debug*/**" + - "**/Release*/**" + - "**/obj/**" + - "**/out/**" + - "**/external/**" + - "srchybrid/lang" + - "srchybrid/res" + +# Disable default queries to use custom ones +disable-default-queries: false + +# Additional queries to run +queries: + - uses: security-and-quality + - uses: security-extended + +# Query filters +query-filters: + - exclude: + id: cpp/poorly-documented-function + - exclude: + id: cpp/fixme-comment + diff --git a/.github/workflows/build-emule.yml b/.github/workflows/build-emule.yml index 5485c96f2..d9a80a9da 100644 --- a/.github/workflows/build-emule.yml +++ b/.github/workflows/build-emule.yml @@ -1,48 +1,198 @@ -name: Build eMule MorphXT +name: Build and Test on: push: - branches: - - main + branches: [main, master, develop] pull_request: - branches: - - main + branches: [main, master, develop] workflow_dispatch: +env: + SOLUTION_FILE_PATH: srchybrid/emule.sln + BUILD_CONFIGURATION: Release + BUILD_OUTPUT_ROOT: srchybrid/build + jobs: build: + strategy: + matrix: + platform: [Win32, x64] runs-on: windows-latest steps: - - name: Checkout repository with submodules - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v5 with: + fetch-depth: 0 submodules: recursive - - name: Install MSBuild - uses: microsoft/setup-msbuild@v2 - with: - msbuild-architecture: x86 + - name: Setup MSBuild + shell: pwsh + run: | + # Find Visual Studio installation using vswhere (pre-installed on windows-latest) + $vsPath = & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" ` + -latest ` + -products * ` + -requires Microsoft.Component.MSBuild ` + -property installationPath + + if ($vsPath) { + Write-Host "Found Visual Studio at: $vsPath" + + # Add MSBuild to PATH + $msbuildPath = Join-Path $vsPath "MSBuild\Current\Bin" + if (Test-Path $msbuildPath) { + Write-Host "Adding MSBuild to PATH: $msbuildPath" + echo "$msbuildPath" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + } + + # Add vswhere location to PATH for consistency + $vswherePath = "C:\Program Files (x86)\Microsoft Visual Studio\Installer" + echo "$vswherePath" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + + # Persist the install path for later steps + echo "VS_INSTALL_PATH=$vsPath" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 + } else { + Write-Error "Visual Studio installation not found!" + exit 1 + } + + - name: Install MFC and ATL components + shell: pwsh + run: | + $vsInstallPath = $env:VS_INSTALL_PATH + if (-not $vsInstallPath) { + throw "Visual Studio install path was not exported from the setup step." + } + $installer = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" + if (-not (Test-Path $installer)) { + throw "Visual Studio installer not found at $installer." + } + & $installer modify ` + --installPath $vsInstallPath ` + --add Microsoft.VisualStudio.Component.VC.ATLMFC ` + --quiet --wait - name: Restore NuGet packages - run: nuget restore srchybrid\emule.sln + working-directory: ${{ github.workspace }} + run: nuget restore "${{ env.SOLUTION_FILE_PATH }}" - - name: Build Release Win32 - run: msbuild srchybrid\emule.sln /p:Configuration=Release /p:Platform=Win32 /m + - name: Build Solution + working-directory: ${{ github.workspace }} + run: | + # Note: TreatWarningsAsErrors not enabled to allow gradual warning cleanup + $outDir = Join-Path "${{ env.BUILD_OUTPUT_ROOT }}" "${{ matrix.platform }}\${{ env.BUILD_CONFIGURATION }}\Binary\" + msbuild /m ` + /p:Configuration=${{ env.BUILD_CONFIGURATION }} ` + /p:Platform=${{ matrix.platform }} ` + /p:OutDir="$outDir" ` + "${{ env.SOLUTION_FILE_PATH }}" - - name: Collect build output + - name: Verify Build Output shell: pwsh run: | - $binaryDir = "srchybrid\build\Win32\Binary" - if (-not (Test-Path $binaryDir)) { - throw "Expected build output directory '$binaryDir' was not created." + $exePath = Join-Path "${{ env.BUILD_OUTPUT_ROOT }}" "${{ matrix.platform }}\${{ env.BUILD_CONFIGURATION }}\Binary\emule.exe" + if (Test-Path $exePath) { + Write-Host "✓ Build successful: $exePath exists" + $fileInfo = Get-Item $exePath + Write-Host " Size: $($fileInfo.Length) bytes" + Write-Host " Modified: $($fileInfo.LastWriteTime)" + } else { + Write-Error "✗ Build failed: $exePath not found" + exit 1 } - New-Item -ItemType Directory -Path artifacts -Force | Out-Null - Copy-Item -Path "$binaryDir\*" -Destination "artifacts" -Recurse -Force - - name: Upload release artifact - uses: actions/upload-artifact@v4 + - name: Upload Build Artifacts + uses: actions/upload-artifact@v5 with: - name: emule-release-win32 - path: artifacts + name: emule-${{ matrix.platform }}-${{ env.BUILD_CONFIGURATION }} + path: | + ${{ env.BUILD_OUTPUT_ROOT }}/${{ matrix.platform }}/${{ env.BUILD_CONFIGURATION }}/Binary/** + retention-days: 30 + if-no-files-found: warn + build-debug: + strategy: + matrix: + platform: [Win32, x64] + runs-on: windows-latest + steps: + - name: Checkout code + uses: actions/checkout@v5 + with: + fetch-depth: 0 + submodules: recursive + - name: Setup MSBuild + shell: pwsh + run: | + # Find Visual Studio installation using vswhere (pre-installed on windows-latest) + $vsPath = & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" ` + -latest ` + -products * ` + -requires Microsoft.Component.MSBuild ` + -property installationPath + + if ($vsPath) { + Write-Host "Found Visual Studio at: $vsPath" + + # Add MSBuild to PATH + $msbuildPath = Join-Path $vsPath "MSBuild\Current\Bin" + if (Test-Path $msbuildPath) { + Write-Host "Adding MSBuild to PATH: $msbuildPath" + echo "$msbuildPath" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + } + + # Add vswhere location to PATH for consistency + $vswherePath = "C:\Program Files (x86)\Microsoft Visual Studio\Installer" + echo "$vswherePath" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + + # Persist the install path for later steps + echo "VS_INSTALL_PATH=$vsPath" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 + } else { + Write-Error "Visual Studio installation not found!" + exit 1 + } + + - name: Install MFC and ATL components + shell: pwsh + run: | + $vsInstallPath = $env:VS_INSTALL_PATH + if (-not $vsInstallPath) { + throw "Visual Studio install path was not exported from the setup step." + } + $installer = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" + if (-not (Test-Path $installer)) { + throw "Visual Studio installer not found at $installer." + } + & $installer modify ` + --installPath $vsInstallPath ` + --add Microsoft.VisualStudio.Component.VC.ATLMFC ` + --quiet --wait + + - name: Restore NuGet packages + working-directory: ${{ github.workspace }} + run: nuget restore "${{ env.SOLUTION_FILE_PATH }}" + + - name: Build Debug Configuration + working-directory: ${{ github.workspace }} + run: | + $outDir = Join-Path "${{ env.BUILD_OUTPUT_ROOT }}" "${{ matrix.platform }}\Debug\Binary\" + msbuild /m ` + /p:Configuration=Debug ` + /p:Platform=${{ matrix.platform }} ` + /p:OutDir="$outDir" ` + "${{ env.SOLUTION_FILE_PATH }}" + + - name: Verify Debug Build Output + shell: pwsh + run: | + $exePath = Join-Path "${{ env.BUILD_OUTPUT_ROOT }}" "${{ matrix.platform }}\Debug\Binary\emule.exe" + if (Test-Path $exePath) { + Write-Host "✓ Debug build successful: $exePath exists" + $fileInfo = Get-Item $exePath + Write-Host " Size: $($fileInfo.Length) bytes" + Write-Host " Modified: $($fileInfo.LastWriteTime)" + } else { + Write-Error "✗ Debug build failed: $exePath not found" + exit 1 + } diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml new file mode 100644 index 000000000..710b85258 --- /dev/null +++ b/.github/workflows/code-quality.yml @@ -0,0 +1,170 @@ +name: Code Quality + +on: + push: + branches: [main, master, develop] + pull_request: + branches: [main, master, develop] + workflow_dispatch: + +env: + SOLUTION_FILE_PATH: srchybrid/emule.sln + +jobs: + static-analysis: + name: Static Analysis + runs-on: windows-latest + steps: + - name: Checkout code + uses: actions/checkout@v5 + with: + fetch-depth: 0 + submodules: recursive + + - name: Setup MSBuild + shell: pwsh + run: | + # Locate the latest Visual Studio installation that includes MSBuild. + $vsPath = & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" ` + -latest ` + -products * ` + -requires Microsoft.Component.MSBuild ` + -property installationPath + + if ($vsPath) { + Write-Host "Found Visual Studio at: $vsPath" + + # Add MSBuild to PATH for subsequent steps. + $msbuildPath = Join-Path $vsPath "MSBuild\Current\Bin" + if (Test-Path $msbuildPath) { + Write-Host "Adding MSBuild to PATH: $msbuildPath" + echo "$msbuildPath" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + } + + # Persist installer paths for later steps. + $vswherePath = "C:\Program Files (x86)\Microsoft Visual Studio\Installer" + echo "$vswherePath" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + echo "VS_INSTALL_PATH=$vsPath" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 + } else { + Write-Error "Visual Studio installation not found!" + exit 1 + } + + - name: Install MFC and ATL components + shell: pwsh + run: | + $vsInstallPath = $env:VS_INSTALL_PATH + if (-not $vsInstallPath) { + throw "Visual Studio install path was not exported from the setup step." + } + $installer = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" + if (-not (Test-Path $installer)) { + throw "Visual Studio installer not found at $installer." + } + & $installer modify ` + --installPath $vsInstallPath ` + --add Microsoft.VisualStudio.Component.VC.ATLMFC ` + --quiet --wait + + - name: Restore NuGet packages + run: nuget restore "${{ env.SOLUTION_FILE_PATH }}" + + - name: Run Code Analysis + shell: pwsh + run: | + $outDir = Join-Path "srchybrid/build" "Win32/Release/CodeAnalysis/" + msbuild /m ` + /p:Configuration=Release ` + /p:Platform=Win32 ` + /p:RunCodeAnalysis=true ` + /p:CodeAnalysisRuleSet=NativeRecommendedRules.ruleset ` + /p:OutDir="$outDir" ` + "${{ env.SOLUTION_FILE_PATH }}" + continue-on-error: true + + - name: Upload Analysis Results + uses: actions/upload-artifact@v4 + if: always() + with: + name: code-analysis-results + path: | + **/*.nativecodeanalysis.xml + retention-days: 7 + + lint-check: + name: Format Check + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Install clang-format + run: | + sudo apt-get update + sudo apt-get install -y clang-format + + - name: Check formatting (dry-run) + run: | + find srchybrid -type f \( -name "*.cpp" -o -name "*.h" \) | while read -r file; do + clang-format --dry-run --Werror "$file" 2>&1 | tee -a format-errors.txt || true + done + continue-on-error: true + + - name: Show formatting issues + if: always() + run: | + if [ -f format-errors.txt ]; then + echo "Formatting issues found:" + cat format-errors.txt + else + echo "No formatting issues found" + fi + + documentation-check: + name: Documentation Check + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Check for README updates + run: | + if [ "${{ github.event_name }}" = "pull_request" ]; then + BASE="${{ github.event.pull_request.base.sha }}" + HEAD="${{ github.event.pull_request.head.sha }}" + else + BASE="${{ github.event.before }}" + HEAD="${{ github.sha }}" + fi + + if [ -z "$BASE" ]; then + echo "::notice::Unable to determine base revision for README comparison." + else + git fetch origin "$BASE" --depth=1 || true + CHANGED=$(git diff --name-only "$BASE" "$HEAD" || true) + if ! echo "$CHANGED" | grep -qi "readme.md"; then + echo "::notice::No README updates in this change." + fi + fi + + - name: Check for broken links in markdown + uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + use-quiet-mode: 'yes' + use-verbose-mode: 'no' + continue-on-error: true + + dependency-check: + name: Dependency Review + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Dependency Review + uses: actions/dependency-review-action@v4 + with: + fail-on-severity: moderate + continue-on-error: true + diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..1d1e9b0cc --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,103 @@ +name: "CodeQL Security Scan" + +on: + push: + branches: [main, master, develop] + pull_request: + branches: [main, master, develop] + schedule: + - cron: '0 0 * * 1' + workflow_dispatch: + +env: + SOLUTION_FILE_PATH: srchybrid/emule.sln + +jobs: + analyze: + name: Analyze C++ + runs-on: windows-latest + timeout-minutes: 360 + + permissions: + security-events: write + packages: read + actions: read + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v5 + with: + fetch-depth: 0 + submodules: recursive + + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: cpp + config-file: ./.github/codeql/codeql-config.yml + queries: +security-and-quality + + - name: Setup MSBuild + shell: pwsh + run: | + # Locate the latest Visual Studio installation that includes MSBuild. + $vsPath = & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" ` + -latest ` + -products * ` + -requires Microsoft.Component.MSBuild ` + -property installationPath + + if ($vsPath) { + Write-Host "Found Visual Studio at: $vsPath" + + # Add MSBuild to PATH for subsequent steps. + $msbuildPath = Join-Path $vsPath "MSBuild\Current\Bin" + if (Test-Path $msbuildPath) { + Write-Host "Adding MSBuild to PATH: $msbuildPath" + echo "$msbuildPath" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + } + + # Persist installer paths for later steps. + $vswherePath = "C:\Program Files (x86)\Microsoft Visual Studio\Installer" + echo "$vswherePath" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + echo "VS_INSTALL_PATH=$vsPath" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 + } else { + Write-Error "Visual Studio installation not found!" + exit 1 + } + + - name: Install MFC and ATL components + shell: pwsh + run: | + $vsInstallPath = $env:VS_INSTALL_PATH + if (-not $vsInstallPath) { + throw "Visual Studio install path was not exported from the setup step." + } + $installer = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" + if (-not (Test-Path $installer)) { + throw "Visual Studio installer not found at $installer." + } + & $installer modify ` + --installPath $vsInstallPath ` + --add Microsoft.VisualStudio.Component.VC.ATLMFC ` + --quiet --wait + + - name: Restore NuGet packages + run: nuget restore "${{ env.SOLUTION_FILE_PATH }}" + + - name: Build with MSBuild + shell: pwsh + run: | + $outDir = Join-Path "srchybrid/build" "Win32/Release/CodeQL/" + msbuild /m ` + /p:Configuration=Release ` + /p:Platform=Win32 ` + /p:OutDir="$outDir" ` + "${{ env.SOLUTION_FILE_PATH }}" + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 + with: + category: "/language:cpp" + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..b0dcb5845 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,182 @@ +name: Release Build + +on: + release: + types: [created, published] + workflow_dispatch: + inputs: + version: + description: 'Version number (e.g., 1.0.0.0)' + required: true + default: '1.0.0.0' + +env: + SOLUTION_FILE_PATH: srchybrid/emule.sln + BUILD_OUTPUT_ROOT: srchybrid/build + +jobs: + build-release: + name: Build Release (${{ matrix.platform }}) + runs-on: windows-latest + strategy: + matrix: + platform: [Win32, x64] + steps: + - name: Checkout code + uses: actions/checkout@v5 + with: + fetch-depth: 0 + submodules: recursive + + - name: Setup MSBuild + shell: pwsh + run: | + # Locate the latest Visual Studio installation that includes MSBuild. + $vsPath = & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" ` + -latest ` + -products * ` + -requires Microsoft.Component.MSBuild ` + -property installationPath + + if ($vsPath) { + Write-Host "Found Visual Studio at: $vsPath" + + # Add MSBuild to PATH for subsequent steps. + $msbuildPath = Join-Path $vsPath "MSBuild\Current\Bin" + if (Test-Path $msbuildPath) { + Write-Host "Adding MSBuild to PATH: $msbuildPath" + echo "$msbuildPath" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + } + + # Persist installer paths for later steps. + $vswherePath = "C:\Program Files (x86)\Microsoft Visual Studio\Installer" + echo "$vswherePath" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + echo "VS_INSTALL_PATH=$vsPath" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 + } else { + Write-Error "Visual Studio installation not found!" + exit 1 + } + + - name: Install MFC and ATL components + shell: pwsh + run: | + $vsInstallPath = $env:VS_INSTALL_PATH + if (-not $vsInstallPath) { + throw "Visual Studio install path was not exported from the setup step." + } + $installer = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" + if (-not (Test-Path $installer)) { + throw "Visual Studio installer not found at $installer." + } + & $installer modify ` + --installPath $vsInstallPath ` + --add Microsoft.VisualStudio.Component.VC.ATLMFC ` + --quiet --wait + + - name: Restore NuGet packages + run: nuget restore "${{ env.SOLUTION_FILE_PATH }}" + + - name: Build Release + shell: pwsh + run: | + $outDir = Join-Path "${{ env.BUILD_OUTPUT_ROOT }}" "${{ matrix.platform }}\Release\Binary\" + msbuild /m ` + /p:Configuration=Release ` + /p:Platform=${{ matrix.platform }} ` + /p:OutDir="$outDir" ` + "${{ env.SOLUTION_FILE_PATH }}" + + - name: Verify Release Binaries + shell: pwsh + run: | + $exePath = Join-Path "${{ env.BUILD_OUTPUT_ROOT }}" "${{ matrix.platform }}\Release\Binary\emule.exe" + if (Test-Path $exePath) { + Write-Host "✓ Release build successful: $exePath" + $info = Get-Item $exePath + Write-Host " Size: $($info.Length) bytes" + Write-Host " Modified: $($info.LastWriteTime)" + } else { + Write-Error "✗ Release build failed: $exePath not found" + exit 1 + } + + - name: Package Release + shell: pwsh + run: | + $artifactRoot = "emule-${{ matrix.platform }}-release" + $binarySource = Join-Path "${{ env.BUILD_OUTPUT_ROOT }}" "${{ matrix.platform }}\Release\Binary" + New-Item -ItemType Directory -Force -Path $artifactRoot | Out-Null + Copy-Item -Path (Join-Path $binarySource "*") -Destination (Join-Path $artifactRoot "Binary") -Recurse -Force + Copy-Item -Path "srchybrid\lang" -Destination (Join-Path $artifactRoot "lang") -Recurse -ErrorAction SilentlyContinue + Copy-Item -Path "emule\config" -Destination (Join-Path $artifactRoot "config") -Recurse -ErrorAction SilentlyContinue + Copy-Item -Path "emule\webserver" -Destination (Join-Path $artifactRoot "webserver") -Recurse -ErrorAction SilentlyContinue + Copy-Item -Path "emule\wapserver" -Destination (Join-Path $artifactRoot "wapserver") -Recurse -ErrorAction SilentlyContinue + Copy-Item -Path "Readme.md" -Destination $artifactRoot -ErrorAction SilentlyContinue + Copy-Item -Path "emule\license.txt" -Destination $artifactRoot -ErrorAction SilentlyContinue + $version = if ("${{ github.event.inputs.version }}") { "${{ github.event.inputs.version }}" } else { "${{ github.ref_name }}" } + @" +eMule MorphXT +Version: $version +Platform: ${{ matrix.platform }} +Build Date: $(Get-Date -Format "yyyy-MM-dd HH:mm:ss") +Commit: ${{ github.sha }} +"@ | Out-File -FilePath (Join-Path $artifactRoot "VERSION.txt") -Encoding utf8 + + - name: Create ZIP archive + shell: pwsh + run: | + $version = if ("${{ github.event.inputs.version }}") { "${{ github.event.inputs.version }}" } else { "${{ github.ref_name }}" } + $zipName = "emule-${{ matrix.platform }}-$version.zip" + Compress-Archive -Path "emule-${{ matrix.platform }}-release\*" -DestinationPath $zipName -Force + + - name: Upload Release Artifact + uses: actions/upload-artifact@v4 + with: + name: emule-${{ matrix.platform }}-release + path: emule-${{ matrix.platform }}-*.zip + retention-days: 90 + + - name: Upload to Release + if: github.event_name == 'release' + uses: softprops/action-gh-release@v2 + with: + files: emule-${{ matrix.platform }}-*.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + create-installer: + name: Create Installer + needs: build-release + runs-on: windows-latest + if: github.event_name == 'release' + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Download Win32 artifacts + uses: actions/download-artifact@v6 + with: + name: emule-Win32-release + path: ./artifacts/Win32 + + - name: Download x64 artifacts + uses: actions/download-artifact@v6 + with: + name: emule-x64-release + path: ./artifacts/x64 + + - name: Create installer + shell: pwsh + run: | + # Placeholder for installer creation using a tool such as NSIS, WiX, or InnoSetup. + Write-Host "Installer creation step is not yet implemented." + + - name: Upload Installer + if: success() + uses: softprops/action-gh-release@v2 + with: + files: | + emule-installer-*.exe + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 000000000..6409ec325 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,44 @@ +name: Mark Stale Issues and PRs + +on: + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + +jobs: + stale: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/stale@v10 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: | + This issue has been automatically marked as stale because it has not had recent activity. + It will be closed if no further activity occurs within 7 days. + If this issue is still relevant, please comment to keep it open. + close-issue-message: | + This issue has been automatically closed due to inactivity. + If you believe this issue is still relevant, please reopen it or create a new issue with updated information. + days-before-issue-stale: 90 + days-before-issue-close: 7 + stale-issue-label: 'stale' + exempt-issue-labels: 'pinned,security,bug,enhancement,good-first-issue' + stale-pr-message: | + This pull request has been automatically marked as stale because it has not had recent activity. + It will be closed if no further activity occurs within 14 days. + If this PR is still relevant, please comment or push new commits to keep it open. + close-pr-message: | + This pull request has been automatically closed due to inactivity. + If you would like to continue this work, please reopen the PR or create a new one. + days-before-pr-stale: 60 + days-before-pr-close: 14 + stale-pr-label: 'stale' + exempt-pr-labels: 'pinned,security,work-in-progress' + operations-per-run: 100 + ascending: true + exempt-all-assignees: true + remove-stale-when-updated: true + From b915b206d47231abdbceecded417b7ccff815f02 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 11 Nov 2025 20:23:15 +0000 Subject: [PATCH 04/10] Add NuGet package caching to GitHub Actions workflow Co-authored-by: Mika3578 <58137747+Mika3578@users.noreply.github.com> --- .github/workflows/build-emule.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/build-emule.yml b/.github/workflows/build-emule.yml index d9a80a9da..be8226a0f 100644 --- a/.github/workflows/build-emule.yml +++ b/.github/workflows/build-emule.yml @@ -72,6 +72,14 @@ jobs: --add Microsoft.VisualStudio.Component.VC.ATLMFC ` --quiet --wait + - name: Cache NuGet packages + uses: actions/cache@v4 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json', '**/packages.config') }} + restore-keys: | + ${{ runner.os }}-nuget- + - name: Restore NuGet packages working-directory: ${{ github.workspace }} run: nuget restore "${{ env.SOLUTION_FILE_PATH }}" @@ -169,6 +177,14 @@ jobs: --add Microsoft.VisualStudio.Component.VC.ATLMFC ` --quiet --wait + - name: Cache NuGet packages + uses: actions/cache@v4 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json', '**/packages.config') }} + restore-keys: | + ${{ runner.os }}-nuget- + - name: Restore NuGet packages working-directory: ${{ github.workspace }} run: nuget restore "${{ env.SOLUTION_FILE_PATH }}" From 20f4f93c3e96704d5cd6ae72f1614ec64382908e Mon Sep 17 00:00:00 2001 From: Mika3578 <58137747+Mika3578@users.noreply.github.com> Date: Wed, 12 Nov 2025 05:46:18 +0100 Subject: [PATCH 05/10] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/build-emule.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build-emule.yml b/.github/workflows/build-emule.yml index be8226a0f..0bbb7b19c 100644 --- a/.github/workflows/build-emule.yml +++ b/.github/workflows/build-emule.yml @@ -16,7 +16,7 @@ jobs: build: strategy: matrix: - platform: [Win32, x64] + platform: [Win32] runs-on: windows-latest steps: - name: Checkout code @@ -81,11 +81,9 @@ jobs: ${{ runner.os }}-nuget- - name: Restore NuGet packages - working-directory: ${{ github.workspace }} run: nuget restore "${{ env.SOLUTION_FILE_PATH }}" - name: Build Solution - working-directory: ${{ github.workspace }} run: | # Note: TreatWarningsAsErrors not enabled to allow gradual warning cleanup $outDir = Join-Path "${{ env.BUILD_OUTPUT_ROOT }}" "${{ matrix.platform }}\${{ env.BUILD_CONFIGURATION }}\Binary\" From 73b69007a8f1d8ff6559f580e80ed75f9e346655 Mon Sep 17 00:00:00 2001 From: Mika3578 <58137747+Mika3578@users.noreply.github.com> Date: Wed, 12 Nov 2025 05:47:21 +0100 Subject: [PATCH 06/10] Update .github/workflows/release.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b0dcb5845..eb524f259 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: runs-on: windows-latest strategy: matrix: - platform: [Win32, x64] + platform: [Win32] steps: - name: Checkout code uses: actions/checkout@v5 From 4680c832fd83c756404448d0b0ee17bb376b2211 Mon Sep 17 00:00:00 2001 From: Mika3578 <58137747+Mika3578@users.noreply.github.com> Date: Wed, 12 Nov 2025 05:47:52 +0100 Subject: [PATCH 07/10] Update .github/workflows/release.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/release.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb524f259..af7f6765a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -171,12 +171,5 @@ Commit: ${{ github.sha }} # Placeholder for installer creation using a tool such as NSIS, WiX, or InnoSetup. Write-Host "Installer creation step is not yet implemented." - - name: Upload Installer - if: success() - uses: softprops/action-gh-release@v2 - with: - files: | - emule-installer-*.exe - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# The "Upload Installer" step has been removed until installer creation is implemented. From dbc49d86b60a491129e361e73d4415f9ed39fee6 Mon Sep 17 00:00:00 2001 From: Mika3578 <58137747+Mika3578@users.noreply.github.com> Date: Wed, 12 Nov 2025 06:24:54 +0100 Subject: [PATCH 08/10] Update .github/workflows/build-emule.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/build-emule.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-emule.yml b/.github/workflows/build-emule.yml index 0bbb7b19c..cb698504f 100644 --- a/.github/workflows/build-emule.yml +++ b/.github/workflows/build-emule.yml @@ -108,7 +108,7 @@ jobs: } - name: Upload Build Artifacts - uses: actions/upload-artifact@v5 + uses: actions/upload-artifact@v4 with: name: emule-${{ matrix.platform }}-${{ env.BUILD_CONFIGURATION }} path: | From b128b4f399e5c6806ba2276d7246c5c7ca3317e8 Mon Sep 17 00:00:00 2001 From: Mika3578 <58137747+Mika3578@users.noreply.github.com> Date: Wed, 12 Nov 2025 06:25:20 +0100 Subject: [PATCH 09/10] Update .github/workflows/build-emule.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/build-emule.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-emule.yml b/.github/workflows/build-emule.yml index cb698504f..04b124e9d 100644 --- a/.github/workflows/build-emule.yml +++ b/.github/workflows/build-emule.yml @@ -119,7 +119,7 @@ jobs: build-debug: strategy: matrix: - platform: [Win32, x64] + platform: [Win32] runs-on: windows-latest steps: - name: Checkout code From dd0afdf0b8f3f0a784a932715276ff09cb83cedb Mon Sep 17 00:00:00 2001 From: Mika3578 <58137747+Mika3578@users.noreply.github.com> Date: Wed, 12 Nov 2025 06:27:01 +0100 Subject: [PATCH 10/10] Update .github/workflows/build-emule.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/build-emule.yml | 49 ++----------------------------- 1 file changed, 2 insertions(+), 47 deletions(-) diff --git a/.github/workflows/build-emule.yml b/.github/workflows/build-emule.yml index 04b124e9d..5ba0271aa 100644 --- a/.github/workflows/build-emule.yml +++ b/.github/workflows/build-emule.yml @@ -25,53 +25,8 @@ jobs: fetch-depth: 0 submodules: recursive - - name: Setup MSBuild - shell: pwsh - run: | - # Find Visual Studio installation using vswhere (pre-installed on windows-latest) - $vsPath = & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" ` - -latest ` - -products * ` - -requires Microsoft.Component.MSBuild ` - -property installationPath - - if ($vsPath) { - Write-Host "Found Visual Studio at: $vsPath" - - # Add MSBuild to PATH - $msbuildPath = Join-Path $vsPath "MSBuild\Current\Bin" - if (Test-Path $msbuildPath) { - Write-Host "Adding MSBuild to PATH: $msbuildPath" - echo "$msbuildPath" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - } - - # Add vswhere location to PATH for consistency - $vswherePath = "C:\Program Files (x86)\Microsoft Visual Studio\Installer" - echo "$vswherePath" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - - # Persist the install path for later steps - echo "VS_INSTALL_PATH=$vsPath" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 - } else { - Write-Error "Visual Studio installation not found!" - exit 1 - } - - - name: Install MFC and ATL components - shell: pwsh - run: | - $vsInstallPath = $env:VS_INSTALL_PATH - if (-not $vsInstallPath) { - throw "Visual Studio install path was not exported from the setup step." - } - $installer = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" - if (-not (Test-Path $installer)) { - throw "Visual Studio installer not found at $installer." - } - & $installer modify ` - --installPath $vsInstallPath ` - --add Microsoft.VisualStudio.Component.VC.ATLMFC ` - --quiet --wait - + - name: Setup MSBuild and Install MFC/ATL + uses: ./.github/actions/setup-msbuild-mfc - name: Cache NuGet packages uses: actions/cache@v4 with: