From a8c0378b47f1def748795d31b6c5a040664fd70a Mon Sep 17 00:00:00 2001 From: Ziemek Borowski Date: Sun, 12 Apr 2026 07:02:56 +0200 Subject: [PATCH 1/2] build process adjustments --- .github/workflows/build.yml | 7 +-- build-all.ps1 | 69 ++++-------------------------- internal/common/version/version.go | 2 +- 3 files changed, 14 insertions(+), 64 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f30bb91..667355a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,6 +58,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/') runs-on: ${{ matrix.os }} strategy: + fail_fast: false matrix: os: [windows-latest, ubuntu-latest, macos-latest] include: @@ -120,7 +121,7 @@ jobs: - name: Create ZIP archive (Windows) if: matrix.os == 'windows-latest' run: | - Compress-Archive -Path bin\gomailtest${{ matrix.ext }},README.md,IMAPTOOL_README.md,JMAPTOOL_README.md,MSGRAPHTOOL_README.md,POP3TOOL_README.md,SMTP_TOOL_README.md,EXAMPLES.md,LICENSE -DestinationPath ${{ matrix.zip_name }} + Compress-Archive -Path bin\gomailtest${{ matrix.ext }},README.md,TOOLS.md,EXAMPLES.md,LICENSE -DestinationPath ${{ matrix.zip_name }} Write-Host "Created ZIP archive: ${{ matrix.zip_name }}" Get-Item ${{ matrix.zip_name }} | Select-Object Name, Length @@ -128,7 +129,7 @@ jobs: if: matrix.os != 'windows-latest' run: | cd bin && zip ../${{ matrix.zip_name }} gomailtest${{ matrix.ext }} && cd .. - zip -u ${{ matrix.zip_name }} README.md IMAPTOOL_README.md JMAPTOOL_README.md MSGRAPHTOOL_README.md POP3TOOL_README.md SMTP_TOOL_README.md EXAMPLES.md LICENSE + zip -u ${{ matrix.zip_name }} README.md TOOLS.md EXAMPLES.md LICENSE echo "Created ZIP archive: ${{ matrix.zip_name }}" ls -lh ${{ matrix.zip_name }} @@ -154,7 +155,7 @@ jobs: Plus documentation: - **README.md** - Main documentation - - ** *_TOOL_README.md** - specific protocols tool guide + - **TOOLS.md** - Protocol-specific tool guides - **EXAMPLES.md** - Usage examples - **LICENSE** - MIT License diff --git a/build-all.ps1 b/build-all.ps1 index 98c1fd5..2f3e710 100644 --- a/build-all.ps1 +++ b/build-all.ps1 @@ -3,8 +3,7 @@ # Builds the unified gomailtest binary (optimized) param( - [switch]$Verbose, - [switch]$SkipTests + [switch]$Verbose ) $ErrorActionPreference = "Stop" @@ -24,73 +23,23 @@ Write-ColorOutput "════════════════════ # Ensure bin directory exists $binDir = Join-Path $PSScriptRoot "bin" -if (-not (Test-Path $binDir)) { - New-Item -ItemType Directory -Path $binDir | Out-Null - Write-ColorOutput "Created bin/ directory`n" "Yellow" -} +New-Item -ItemType Directory -Path $binDir -Force | Out-Null # Read version from version.go -$versionFile = Join-Path $PSScriptRoot "internal" "common" "version" "version.go" -if (-not (Test-Path $versionFile)) { - Write-ColorOutput "ERROR: version.go not found at $versionFile" "Red" - exit 1 -} -$versionContent = Get-Content $versionFile -Raw -if ($versionContent -match 'const Version = "([^"]+)"') { - $version = $matches[1] -} else { - Write-ColorOutput "ERROR: Could not extract version from version.go" "Red" - exit 1 -} -Write-ColorOutput "Version: $version`n" "Yellow" +$version = (Select-String -Path (Join-Path $PSScriptRoot "internal/common/version/version.go") -Pattern 'Version = "([^"]+)"').Matches[0].Groups[1].Value # Build gomailtest -Write-ColorOutput "Building gomailtest..." "Cyan" - $outputFile = Join-Path $binDir "gomailtest.exe" -try { - if ($Verbose) { - go build -v -ldflags="-s -w" -o $outputFile ./cmd/gomailtest - } else { - go build -ldflags="-s -w" -o $outputFile ./cmd/gomailtest - } - - if ($LASTEXITCODE -eq 0) { - $size = (Get-Item $outputFile).Length / 1MB - Write-ColorOutput " ✓ Build successful (Size: $($size.ToString('N2')) MB)" "Green" - } else { - throw "Build failed with exit code $LASTEXITCODE" - } -} catch { - Write-ColorOutput " ✗ Build failed: $_" "Red" - exit 1 +if ($Verbose) { + go build -v -ldflags="-s -w" -o $outputFile ./cmd/gomailtest +} else { + go build -ldflags="-s -w" -o $outputFile ./cmd/gomailtest } -# Run version check (optional) -if (-not $SkipTests) { - Write-ColorOutput "`nVerifying version..." "Cyan" - $toolVersion = & $outputFile --version 2>&1 - if ($toolVersion -match $version) { - Write-ColorOutput " ✓ Version correct: $version" "Green" - } else { - Write-ColorOutput " ⚠ Version mismatch (expected: $version, got: $toolVersion)" "Yellow" - } -} +Write-ColorOutput " Built bin/gomailtest.exe — version $version" "Green" # Summary Write-ColorOutput "`n═══════════════════════════════════════════════════════════" "Cyan" Write-ColorOutput " Build Complete!" "Green" -Write-ColorOutput "═══════════════════════════════════════════════════════════" "Cyan" - -Write-ColorOutput "`nBuilt executable: bin\gomailtest.exe" "White" - -Write-ColorOutput "`nUsage examples:" "Yellow" -Write-ColorOutput " .\bin\gomailtest.exe --version" "Gray" -Write-ColorOutput " .\bin\gomailtest.exe smtp testconnect --host smtp.example.com --port 25" "Gray" -Write-ColorOutput " .\bin\gomailtest.exe imap testconnect --host imap.gmail.com --imaps" "Gray" -Write-ColorOutput " .\bin\gomailtest.exe pop3 testconnect --host pop.gmail.com --pop3s" "Gray" -Write-ColorOutput " .\bin\gomailtest.exe jmap testconnect --host jmap.fastmail.com" "Gray" -Write-ColorOutput " .\bin\gomailtest.exe msgraph getevents`n" "Gray" - -Write-ColorOutput "For more information, see README.md and docs/protocols/`n" "Cyan" +Write-ColorOutput "═══════════════════════════════════════════════════════════`n" "Cyan" diff --git a/internal/common/version/version.go b/internal/common/version/version.go index 42e6f02..904d731 100644 --- a/internal/common/version/version.go +++ b/internal/common/version/version.go @@ -8,7 +8,7 @@ package version // 1. Change the Version constant below // 2. Create a changelog entry in ChangeLog/{version}.md // 3. Commit with message: "Bump version to {version}" -const Version = "3.1.1" +const Version = "3.1.4" // Get returns the current version string. // This is a convenience function for accessing the Version constant. From 7f5067b05e54aea0dc86482a218d53be47d2cc84 Mon Sep 17 00:00:00 2001 From: Ziemek Borowski Date: Sun, 12 Apr 2026 07:05:49 +0200 Subject: [PATCH 2/2] build process adjustments --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 667355a..a172d25 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,7 +58,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/') runs-on: ${{ matrix.os }} strategy: - fail_fast: false + fail-fast: false matrix: os: [windows-latest, ubuntu-latest, macos-latest] include: