Skip to content

Conversation

@N6REJ
Copy link
Collaborator

@N6REJ N6REJ commented Nov 24, 2025

User description

adds ci/cd testing ability


PR Type

Enhancement, Tests


Description

  • Adds comprehensive CI/CD testing workflow for MySQL module builds

  • Implements smart version detection for pull requests and manual testing

  • Creates multi-phase validation testing (download, extract, verify executables)

  • Generates automated PR comments with detailed test results and artifacts


Diagram Walkthrough

flowchart LR
  PR["Pull Request/<br/>Manual Trigger"] --> Detect["Detect MySQL<br/>Versions"]
  Detect --> Matrix["Matrix Test<br/>Each Version"]
  Matrix --> Phase1["Phase 1:<br/>Download & Extract"]
  Phase1 --> Phase2["Phase 2:<br/>Verify Executables"]
  Phase2 --> Phase3["Phase 3:<br/>Test Functionality"]
  Phase3 --> Report["Generate Report<br/>& PR Comment"]
  Report --> Artifacts["Upload Test<br/>Artifacts"]
Loading

File Walkthrough

Relevant files
Configuration changes
mysql-test.yml
Complete MySQL CI/CD testing workflow implementation         

.github/workflows/mysql-test.yml

  • Creates complete CI/CD workflow with 542 lines of GitHub Actions
    configuration
  • Implements smart version detection that analyzes PR changes to
    releases.properties and tests only modified versions
  • Defines three-phase testing strategy: download/extract, verify
    executables, test functionality
  • Generates automated PR comments with test results, summaries, and
    troubleshooting tips
  • Supports both automatic PR triggering and manual workflow dispatch
    with version selection options
+542/-0 
Documentation
CI-CD-TESTING.md
Detailed CI/CD testing workflow documentation                       

docs/CI-CD-TESTING.md

  • Comprehensive 413-line documentation guide for the CI/CD testing
    workflow
  • Documents workflow triggers, test scope, and intelligent version
    detection logic
  • Details all three test phases with step-by-step descriptions and error
    handling
  • Provides troubleshooting guide with common issues, solutions, and
    debugging steps
  • Includes maintenance instructions for extending tests and modifying
    parameters
+413/-0 
README.md
Documentation directory index and overview                             

docs/README.md

  • Creates documentation index for MySQL module with links to CI/CD
    testing guide
  • Provides quick navigation to workflow file and releases configuration
  • Includes contributing guidelines and support information
+36/-0   

@N6REJ N6REJ added the enhancement ✨ Improve program label Nov 24, 2025
@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Nov 24, 2025

🐬 MySQL Module Tests - Results

Test Date: 2025-11-24 01:27:00 UTC
Status: ⚠️ Tests completed with issues

⚠️ No test results available


📋 Test Phases

Each version is tested through the following phases:

  • Phase 1: Installation Validation (Download, Extract, Verify Executables)
  • Phase 2: Basic Functionality (Test Executable Versions)

Check artifacts for detailed logs.

@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Nov 24, 2025

PR Code Suggestions ✨

Latest suggestions up to 69c2f2d

CategorySuggestion                                                                                                                                    Impact
Possible issue
Robustly detect modified versions

Improve version detection by using git diff instead of parsing the API patch,
ensuring that modified versions (not just added ones) are correctly identified
for testing.

.github/workflows/mysql-test.yml [76-95]

-if echo "$CHANGED_FILES" | grep -q "^releases.properties$"; then
-  ...
-  PATCH=$(curl -s -H "Authorization: token ${{ github.token }}" \
-    -H "Accept: application/vnd.github.v3+json" \
-    "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" | \
-    jq -r '.[] | select(.filename == "releases.properties") | .patch')
-  ...
-  CHANGED_VERSIONS=$(echo "$PATCH" | \
-    grep "^+" | \
-    grep -v "^+++" | \
-    grep -E "^\+[0-9]+\.[0-9]+" | \
-    sed 's/^+//' | \
-    cut -d'=' -f1 | \
-    tr -d ' ')
+# Fetch full diff via git to avoid API patch truncation
+git fetch --no-tags --prune --depth=2 origin ${{ github.base_ref }} ${{ github.head_ref }} >/dev/null 2>&1 || true
+BASE_SHA="${{ github.event.pull_request.base.sha }}"
+HEAD_SHA="${{ github.event.pull_request.head.sha }}"
+PATCH=$(git diff --unified=0 "$BASE_SHA" "$HEAD_SHA" -- releases.properties || true)
+# Extract added and modified version keys (consider lines starting with '+' and keys from lines changed)
+CHANGED_VERSIONS=$(echo "$PATCH" | awk '
+  /^(\+|-)[0-9]+\.[0-9]+/ {
+    gsub(/^[+-]/,"",$0);
+    split($0,a,"=");
+    gsub(/^[ \t]+|[ \t]+$/,"",a[1]);
+    if (a[1] ~ /^[0-9]+\.[0-9]+/) print a[1];
+  }' | sort -u)
+# Fallback to latest 5 if none detected
+if [ -z "$CHANGED_VERSIONS" ]; then
+  VERSIONS=$(grep -E "^[0-9]+\.[0-9]+" releases.properties | cut -d'=' -f1 | tr -d ' ' | sort -V -r | head -5 | jq -R -s -c 'split("\n") | map(select(length > 0)) | unique')
+else
+  VERSIONS=$(echo "$CHANGED_VERSIONS" | jq -R -s -c 'split("\n") | map(select(length > 0)) | unique')
+fi

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a flaw where modified versions in releases.properties are not detected and provides a more robust solution using git diff to correctly identify all changed versions.

High
Add resilient download retries

Add a retry loop with exponential backoff around the Invoke-WebRequest call to
handle transient network errors during file downloads.

.github/workflows/mysql-test.yml [198]

-Invoke-WebRequest -Uri $downloadUrl -OutFile $downloadPath -UseBasicParsing -TimeoutSec 300
+$maxRetries = 3
+$delaySeconds = 10
+for ($attempt = 1; $attempt -le $maxRetries; $attempt++) {
+  try {
+    Invoke-WebRequest -Uri $downloadUrl -OutFile $downloadPath -UseBasicParsing -TimeoutSec 300
+    break
+  } catch {
+    Write-Host "Attempt $attempt failed: $($_.Exception.Message)"
+    if ($attempt -lt $maxRetries) {
+      $backoff = $delaySeconds * [math]::Pow(2, ($attempt - 1))
+      Write-Host "Retrying in $backoff seconds..."
+      Start-Sleep -Seconds $backoff
+    } else {
+      throw
+    }
+  }
+}
  • Apply / Chat
Suggestion importance[1-10]: 8

__

Why: This suggestion significantly improves the workflow's reliability by adding retry logic with exponential backoff for downloads, making it more resilient to transient network errors.

Medium
Security
Prevent token exposure in API calls

Use the gh CLI or an environment variable for API calls to avoid exposing the
GitHub token in logs.

.github/workflows/mysql-test.yml [67-70]

-CHANGED_FILES=$(curl -s -H "Authorization: token ${{ github.token }}" \
-  -H "Accept: application/vnd.github.v3+json" \
-  "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" | \
-  jq -r '.[].filename')
+# Prefer GitHub CLI if available; falls back to curl with masked env var
+if command -v gh >/dev/null 2>&1; then
+  CHANGED_FILES=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files --paginate --jq '.[].filename')
+else
+  export GH_API_AUTH="token ${{ secrets.GITHUB_TOKEN }}"
+  CHANGED_FILES=$(curl -s -H "Authorization: $GH_API_AUTH" \
+    -H "Accept: application/vnd.github.v3+json" \
+    "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" | \
+    jq -r '.[].filename')
+  unset GH_API_AUTH
+fi
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: The suggestion improves security by avoiding passing the github.token directly on the command line, using the gh CLI or an environment variable instead, which reduces the risk of accidental token exposure.

Medium
  • More

Previous suggestions

Suggestions up to commit f3f138a
CategorySuggestion                                                                                                                                    Impact
Possible issue
Provide token via environment

Add an env block to the Get MySQL Versions step to make the GITHUB_TOKEN
available to the run script, enabling proper API authentication.

.github/workflows/mysql-test.yml [57-142]

 - name: Get MySQL Versions
   id: get-versions
+  env:
+    GITHUB_TOKEN: ${{ github.token }}
   run: |
     if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
       # Manual workflow
       if [ "${{ github.event.inputs.test_mode }}" == "Specific version" ] && [ "${{ github.event.inputs.version }}" != "" ]; then
         VERSION="${{ github.event.inputs.version }}"
         echo "Testing specific version: $VERSION"
         VERSIONS="[\"$VERSION\"]"
     ...
     echo "versions=$VERSIONS" >> $GITHUB_OUTPUT
     echo "Versions to test: $VERSIONS"
Suggestion importance[1-10]: 8

__

Why: This suggestion is critical for the previous suggestions to work, as it correctly points out the need to pass the github.token to the step's environment so it can be accessed by shell scripts.

Medium
Use proper GitHub API auth header

Update the curl command to use the Authorization: Bearer $GITHUB_TOKEN header
for GitHub API authentication, aligning with best practices.

.github/workflows/mysql-test.yml [81-84]

-CHANGED_FILES=$(curl -s -H "Authorization: token ${{ github.token }}" \
+CHANGED_FILES=$(curl -s \
+  -H "Authorization: Bearer $GITHUB_TOKEN" \
   -H "Accept: application/vnd.github.v3+json" \
   "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" | \
   jq -r '.[].filename')
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly recommends using the standard Bearer authentication scheme for GitHub API calls, which is a best practice for robustness and future compatibility.

Low
Standardize API auth to Bearer

Update the curl command to use the Authorization: Bearer $GITHUB_TOKEN header
for GitHub API authentication, ensuring consistency across all API calls.

.github/workflows/mysql-test.yml [94-97]

-PATCH=$(curl -s -H "Authorization: token ${{ github.token }}" \
+PATCH=$(curl -s \
+  -H "Authorization: Bearer $GITHUB_TOKEN" \
   -H "Accept: application/vnd.github.v3+json" \
   "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" | \
   jq -r '.[] | select(.filename == "releases.properties") | .patch')
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly recommends standardizing on the Bearer authentication scheme for all GitHub API calls, which is a best practice for consistency and robustness.

Low
General
Verify 7-Zip availability before extract

Add a check to verify that the 7z executable is available on the runner before
attempting to extract the archive, and fail with a clear error if it is not
found.

.github/workflows/mysql-test.yml [237]

-$extractOutput = & 7z x $downloadPath -o"test-mysql" -y 2>&1
+$sevenZip = Get-Command 7z -ErrorAction SilentlyContinue
+if (-not $sevenZip) {
+  Write-Host "❌ ERROR: 7-Zip (7z) not found in PATH"
+  echo "success=false" >> $env:GITHUB_OUTPUT
+  echo "error=7-Zip not found on runner" >> $env:GITHUB_OUTPUT
+  exit 1
+}
+$extractOutput = & $sevenZip.Source x $downloadPath -o"test-mysql" -y 2>&1
Suggestion importance[1-10]: 5

__

Why: The suggestion improves the script's robustness by verifying 7z exists before use, which is a good defensive programming practice, although 7z is pre-installed on GitHub-hosted runners.

Low
✅ Suggestions up to commit 686e240
CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix bug in executable test validation
Suggestion Impact:The commit introduces $allFunctional, checks $LASTEXITCODE after each mysqld/mysql/mysqladmin version command, and bases the final success on $allFunctional instead of the last command's exit code.

code diff:

+            $allFunctional = $true
+
             Write-Host "`nTesting mysqld.exe --version..."
-            $mysqldVersion = & $mysqldExe --version 2>&1 | Out-String
-            Write-Host $mysqldVersion
-            
+            & $mysqldExe --version 2>&1 | Out-String | Write-Host
+            if ($LASTEXITCODE -ne 0) { $allFunctional = $false; Write-Host "❌ mysqld.exe failed" }
+
             Write-Host "`nTesting mysql.exe --version..."
-            $mysqlVersion = & $mysqlExe --version 2>&1 | Out-String
-            Write-Host $mysqlVersion
-            
+            & $mysqlExe --version 2>&1 | Out-String | Write-Host
+            if ($LASTEXITCODE -ne 0) { $allFunctional = $false; Write-Host "❌ mysql.exe failed" }
+
             Write-Host "`nTesting mysqladmin.exe --version..."
-            $mysqladminVersion = & $mysqladminExe --version 2>&1 | Out-String
-            Write-Host $mysqladminVersion
-            
-            if ($LASTEXITCODE -eq 0) {
+            & $mysqladminExe --version 2>&1 | Out-String | Write-Host
+            if ($LASTEXITCODE -ne 0) { $allFunctional = $false; Write-Host "❌ mysqladmin.exe failed" }
+
+            if ($allFunctional) {
               Write-Host "`n✅ All executables are functional"
               echo "success=true" >> $env:GITHUB_OUTPUT

Fix a bug in the test-basic step where only the last command's exit code was
checked. The proposed change validates the exit code after each executable test
to ensure any failure is correctly detected.

.github/workflows/mysql-test.yml [366-385]

+$allFunctional = $true
+
 Write-Host "`nTesting mysqld.exe --version..."
-$mysqldVersion = & $mysqldExe --version 2>&1 | Out-String
-Write-Host $mysqldVersion
+& $mysqldExe --version 2>&1 | Out-String | Write-Host
+if ($LASTEXITCODE -ne 0) { $allFunctional = $false; Write-Host "❌ mysqld.exe failed" }
 
 Write-Host "`nTesting mysql.exe --version..."
-$mysqlVersion = & $mysqlExe --version 2>&1 | Out-String
-Write-Host $mysqlVersion
+& $mysqlExe --version 2>&1 | Out-String | Write-Host
+if ($LASTEXITCODE -ne 0) { $allFunctional = $false; Write-Host "❌ mysql.exe failed" }
 
 Write-Host "`nTesting mysqladmin.exe --version..."
-$mysqladminVersion = & $mysqladminExe --version 2>&1 | Out-String
-Write-Host $mysqladminVersion
+& $mysqladminExe --version 2>&1 | Out-String | Write-Host
+if ($LASTEXITCODE -ne 0) { $allFunctional = $false; Write-Host "❌ mysqladmin.exe failed" }
 
-if ($LASTEXITCODE -eq 0) {
+if ($allFunctional) {
   Write-Host "`n✅ All executables are functional"
   echo "success=true" >> $env:GITHUB_OUTPUT
 } else {
   Write-Host "`n❌ Some executables failed"
   echo "success=false" >> $env:GITHUB_OUTPUT
   exit 1
 }

[Suggestion processed]

Suggestion importance[1-10]: 9

__

Why: This suggestion correctly identifies a critical bug where only the exit code of the last command is checked, potentially masking failures in earlier commands. The proposed fix ensures all executable tests are properly validated, significantly improving the reliability of the test suite.

High
High-level
Refactor complex inline scripts into external files

Extract the large inline Bash and PowerShell scripts from the workflow YAML into
separate, manageable script files. This will improve the readability,
maintainability, and testability of the CI process.

Examples:

.github/workflows/mysql-test.yml [59-142]
        run: |
          if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
            # Manual workflow
            if [ "${{ github.event.inputs.test_mode }}" == "Specific version" ] && [ "${{ github.event.inputs.version }}" != "" ]; then
              VERSION="${{ github.event.inputs.version }}"
              echo "Testing specific version: $VERSION"
              VERSIONS="[\"$VERSION\"]"
            else
              echo "Testing latest 5 versions (including RC/beta/alpha)"
              VERSIONS=$(grep -E "^[0-9]+\.[0-9]+" releases.properties | \

 ... (clipped 74 lines)
.github/workflows/mysql-test.yml [168-297]
        run: |
          $ErrorActionPreference = "Continue"
          $version = "${{ matrix.version }}"
          
          Write-Host "=== Phase 1.1: Download MySQL $version ==="
          
          # Read releases.properties to get download URL
          $releasesFile = "releases.properties"
          $downloadUrl = ""
          

 ... (clipped 120 lines)

Solution Walkthrough:

Before:

# .github/workflows/mysql-test.yml
jobs:
  detect-versions:
    steps:
      - name: Get MySQL Versions
        run: |
          # ~80 lines of complex bash script
          if [ "${{ github.event_name }}" == "pull_request" ]; then
            PATCH=$(curl ... | jq ...)
            CHANGED_VERSIONS=$(echo "$PATCH" | grep ... | sed ... | cut ...)
            # ... more logic
          fi
          echo "versions=$VERSIONS" >> $GITHUB_OUTPUT
  test-mysql:
    steps:
      - name: Phase 1.1 - Download MySQL
        run: |
          # ~130 lines of complex PowerShell script
          $downloadUrl = ...
          try {
            Invoke-WebRequest -Uri $downloadUrl -OutFile ...
          } catch { ... }
          & 7z x $downloadPath ...
          # ... more logic

After:

# .github/workflows/mysql-test.yml
jobs:
  detect-versions:
    steps:
      - name: Get MySQL Versions
        id: get-versions
        run: ./.github/scripts/get-versions.sh
        shell: bash
  test-mysql:
    steps:
      - name: Phase 1.1 - Download MySQL
        id: download-mysql
        run: ./.github/scripts/download-mysql.ps1 -Version ${{ matrix.version }}
        shell: pwsh

# .github/scripts/get-versions.sh
#!/bin/bash
# ~80 lines of bash script, now testable and maintainable
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
  # ... logic to detect versions
fi
echo "versions=$VERSIONS" >> $GITHUB_OUTPUT

# .github/scripts/download-mysql.ps1
# ~130 lines of PowerShell script, now testable and maintainable
param([string]$Version)
# ... logic to download and extract
Suggestion importance[1-10]: 8

__

Why: The suggestion addresses a critical maintainability and readability issue by proposing to extract over 300 lines of complex inline scripts from the YAML file, which is a significant architectural improvement.

Medium
General
Remove unreachable code in workflow
Suggestion Impact:The workflow step was simplified to always set has-changes=true and the step was renamed to "Set Run Trigger", removing the unreachable conditional logic.

code diff:

-      - name: Check for Changes
+      - name: Set Run Trigger
         id: check-changes
         run: |
-          if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
-            echo "has-changes=true" >> $GITHUB_OUTPUT
-            echo "Manual workflow trigger - will run tests"
-          elif [ "${{ github.event_name }}" == "pull_request" ]; then
-            echo "has-changes=true" >> $GITHUB_OUTPUT
-            echo "Pull request - will run tests"
-          else
-            CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
-            if echo "$CHANGED_FILES" | grep -qE "releases\.properties|\.github/workflows/mysql-test\.yml"; then
-              echo "has-changes=true" >> $GITHUB_OUTPUT
-              echo "Relevant files changed - will run tests"
-            else
-              echo "has-changes=false" >> $GITHUB_OUTPUT
-              echo "No relevant changes - skipping tests"
-            fi
-          fi
+          echo "has-changes=true" >> $GITHUB_OUTPUT
+          echo "Workflow triggered by ${{ github.event_name }} - will run tests"

Simplify the check-changes step by removing an unreachable else block. The
workflow's triggers make this code path impossible, so the step can be reduced
to always set has-changes=true.

.github/workflows/mysql-test.yml [37-55]

-- name: Check for Changes
+- name: Set Run Trigger
   id: check-changes
   run: |
-    if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
-      echo "has-changes=true" >> $GITHUB_OUTPUT
-      echo "Manual workflow trigger - will run tests"
-    elif [ "${{ github.event_name }}" == "pull_request" ]; then
-      echo "has-changes=true" >> $GITHUB_OUTPUT
-      echo "Pull request - will run tests"
-    else
-      CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
-      if echo "$CHANGED_FILES" | grep -qE "releases\.properties|\.github/workflows/mysql-test\.yml"; then
-        echo "has-changes=true" >> $GITHUB_OUTPUT
-        echo "Relevant files changed - will run tests"
-      else
-        echo "has-changes=false" >> $GITHUB_OUTPUT
-        echo "No relevant changes - skipping tests"
-      fi
-    fi
+    echo "has-changes=true" >> $GITHUB_OUTPUT
+    echo "Workflow triggered by ${{ github.event_name }} - will run tests"

[Suggestion processed]

Suggestion importance[1-10]: 5

__

Why: The suggestion correctly identifies that the else block in the check-changes step is unreachable given the workflow's triggers (pull_request and workflow_dispatch). Simplifying the step by removing this dead code improves readability and maintainability.

Low

N6REJ and others added 2 commits November 23, 2025 19:26
Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>
Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>
@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Nov 24, 2025

PR Reviewer Guide 🔍

(Review updated until commit 69c2f2d)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 Security concerns

Token usage:
The workflow uses ${{ github.token }} in curl without explicit header hardening and writes error messages to logs. While generally safe, ensure secrets are not echoed in failure paths and consider using gh api or actions/github-script for safer auth handling.

⚡ Recommended focus areas for review

Possible Issue

The PR-change detection always sets has-changes=true, so test-mysql will run even when no relevant version changes exist; this defeats the conditional that intends to skip tests.

- name: Set Run Trigger
  id: check-changes
  run: |
    echo "has-changes=true" >> $GITHUB_OUTPUT
    echo "Workflow triggered by ${{ github.event_name }} - will run tests"
Robustness

Direct GitHub API calls using ${{ github.token }} via curl may hit pagination limits or fail on large PRs; no pagination or error handling is implemented for /pulls/{number}/files.

# Get the list of changed files first
echo "Fetching changed files from PR..."
CHANGED_FILES=$(curl -s -H "Authorization: token ${{ github.token }}" \
  -H "Accept: application/vnd.github.v3+json" \
  "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" | \
  jq -r '.[].filename')

echo "Changed files in PR:"
echo "$CHANGED_FILES"

# Check if releases.properties was changed
if echo "$CHANGED_FILES" | grep -q "^releases.properties$"; then
  echo "releases.properties was modified in this PR"

  # Get the diff from GitHub API using curl
  PATCH=$(curl -s -H "Authorization: token ${{ github.token }}" \
    -H "Accept: application/vnd.github.v3+json" \
    "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" | \
    jq -r '.[] | select(.filename == "releases.properties") | .patch')

  echo "Analyzing diff for added/modified versions..."

  # Extract ALL added lines (lines starting with +) that contain version numbers
  # Test ALL versions added in the PR (including RC/beta/alpha)
  CHANGED_VERSIONS=$(echo "$PATCH" | \
    grep "^+" | \
    grep -v "^+++" | \
    grep -E "^\+[0-9]+\.[0-9]+" | \
    sed 's/^+//' | \
    cut -d'=' -f1 | \
    tr -d ' ')

  if [ -z "$CHANGED_VERSIONS" ]; then
    echo "No new versions found in releases.properties changes"
    echo "Testing latest 5 versions as fallback"
    VERSIONS=$(grep -E "^[0-9]+\.[0-9]+" releases.properties | \
      cut -d'=' -f1 | \
      tr -d ' ' | \
      sort -V -r | \
      head -5 | \
      jq -R -s -c 'split("\n") | map(select(length > 0)) | unique')
  else
    echo "Versions detected in PR:"
    echo "$CHANGED_VERSIONS"
    VERSIONS=$(echo "$CHANGED_VERSIONS" | jq -R -s -c 'split("\n") | map(select(length > 0)) | unique')
  fi
else
  echo "releases.properties was NOT modified in this PR"
  echo "Skipping tests - no versions to test"
  VERSIONS="[]"
fi
Windows Path Handling

Extraction searches for a top-level mysql* directory only; some archives may nest differently (e.g., extra parent folder). Consider recursively locating bin to avoid false negatives.

Write-Host "Extracted contents:"
Get-ChildItem -Path "test-mysql" -Directory | ForEach-Object { Write-Host "  - $($_.Name)" }

# Find the mysql directory
$mysqlDir = Get-ChildItem -Path "test-mysql" -Directory | Where-Object { $_.Name -match "^mysql" } | Select-Object -First 1

if ($mysqlDir) {
  $mysqlPath = $mysqlDir.FullName
  Write-Host "✅ MySQL directory found: $mysqlPath"

  # Verify bin directory exists
  $binPath = Join-Path $mysqlPath "bin"
  if (Test-Path $binPath) {
    Write-Host "✅ bin directory exists"
    echo "mysql-path=$mysqlPath" >> $env:GITHUB_OUTPUT
    echo "success=true" >> $env:GITHUB_OUTPUT
  } else {
    Write-Host "❌ ERROR: bin directory not found in $mysqlPath"
    Write-Host "Directory structure:"
    Get-ChildItem -Path $mysqlPath | ForEach-Object { Write-Host "  - $($_.Name)" }
    echo "success=false" >> $env:GITHUB_OUTPUT
    echo "error=bin directory not found in extracted archive" >> $env:GITHUB_OUTPUT
    exit 1
  }
} else {
  Write-Host "❌ ERROR: MySQL directory not found after extraction"
  Write-Host "Expected directory pattern: mysql*"
  Write-Host "Found directories:"
  Get-ChildItem -Path "test-mysql" -Directory | ForEach-Object { Write-Host "  - $($_.Name)" }
  echo "success=false" >> $env:GITHUB_OUTPUT
  echo "error=MySQL directory not found after extraction" >> $env:GITHUB_OUTPUT
  exit 1
}

@N6REJ N6REJ merged commit e70b7b7 into main Nov 24, 2025
10 checks passed
@N6REJ N6REJ deleted the ci branch November 24, 2025 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement ✨ Improve program

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants