Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -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

167 changes: 167 additions & 0 deletions .github/workflows/build-emule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
name: Build and Test

on:
push:
branches: [main, master, develop]
pull_request:
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]
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
submodules: recursive

- name: Setup MSBuild and Install MFC/ATL
uses: ./.github/actions/setup-msbuild-mfc
Comment on lines +28 to +29

Copilot AI Nov 12, 2025

Copy link

Choose a reason for hiding this comment

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

The workflow references a local action './.github/actions/setup-msbuild-mfc' that does not exist in the repository. This will cause the workflow to fail. Either create this composite action or inline the MSBuild setup steps as done in the 'build-debug' job (lines 86-131).

Suggested change
- name: Setup MSBuild and Install MFC/ATL
uses: ./.github/actions/setup-msbuild-mfc
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Install MFC/ATL workloads
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vsInstallPath = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild -property installationPath
if (-not $vsInstallPath) {
Write-Error "Visual Studio not found"
exit 1
}
$vsInstaller = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vs_installer.exe"
if (-not (Test-Path $vsInstaller)) {
Write-Error "VS Installer not found at $vsInstaller"
exit 1
}
& $vsInstaller modify --installPath $vsInstallPath --add Microsoft.VisualStudio.Component.VC.ATLMFC --quiet --norestart
Write-Host "✓ MFC/ATL workloads installed"

Copilot uses AI. Check for mistakes.
- 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
run: nuget restore "${{ env.SOLUTION_FILE_PATH }}"

- name: Build Solution

Copilot AI Nov 12, 2025

Copy link

Choose a reason for hiding this comment

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

The 'Build Solution' step is missing 'shell: pwsh' declaration while using PowerShell syntax. This should be added for consistency with other PowerShell steps in the workflow to ensure correct shell interpretation.

Suggested change
- name: Build Solution
- name: Build Solution
shell: pwsh

Copilot uses AI. Check for mistakes.
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 }}"
Comment on lines +41 to +49

Copilot AI Nov 12, 2025

Copy link

Choose a reason for hiding this comment

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

Missing shell: pwsh directive for this step. The script uses PowerShell commands (Join-Path, $outDir, backtick line continuation) but doesn't explicitly specify the shell. This could cause issues on different runners. Add shell: pwsh to ensure consistent behavior.

Copilot uses AI. Check for mistakes.

- name: Verify Build Output
shell: pwsh
run: |
$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
}

- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
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]
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: 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 }}"
Comment thread
Mika3578 marked this conversation as resolved.

- name: Build Debug Configuration
working-directory: ${{ github.workspace }}

Copilot AI Nov 12, 2025

Copy link

Choose a reason for hiding this comment

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

The 'Build Debug Configuration' step is missing 'shell: pwsh' declaration while using PowerShell syntax. This should be added for consistency with other PowerShell steps in the workflow.

Suggested change
working-directory: ${{ github.workspace }}
working-directory: ${{ github.workspace }}
shell: pwsh

Copilot uses AI. Check for mistakes.
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 }}"
Comment on lines +145 to +153

Copilot AI Nov 12, 2025

Copy link

Choose a reason for hiding this comment

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

Missing shell: pwsh directive for this step. The script uses PowerShell commands (Join-Path, $outDir, backtick line continuation) but doesn't explicitly specify the shell. This could cause issues on different runners. Add shell: pwsh to ensure consistent behavior.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback


- 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
}
170 changes: 170 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -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

Loading
Loading