From 7ff922f4c5616204db6f3f9cf487b98eaad3e8b4 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 11 Apr 2026 23:13:20 +0000 Subject: [PATCH] fix: build correct binary path in GitHub Actions workflow The workflow was trying to build 5 separate binaries from cmd/msgraphtool, cmd/smtptool, etc. which do not exist. The project uses a single unified CLI at cmd/gomailtest where all protocols are subcommands. Update the build, verify, zip, and release steps to use the actual gomailtest binary. https://claude.ai/code/session_01CBZDcCNEFkqBuXjoFqE9Jp --- .github/workflows/build.yml | 83 ++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 48 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 825b7ce..f30bb91 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -88,55 +88,46 @@ jobs: - name: Create bin directory run: mkdir -p bin - - name: Build all tools + - name: Build binary env: GOARCH: ${{ matrix.goarch }} run: | - go build -ldflags="-s -w" -o bin/msgraphtool${{ matrix.ext }} ./cmd/msgraphtool - go build -ldflags="-s -w" -o bin/smtptool${{ matrix.ext }} ./cmd/smtptool - go build -ldflags="-s -w" -o bin/imaptool${{ matrix.ext }} ./cmd/imaptool - go build -ldflags="-s -w" -o bin/pop3tool${{ matrix.ext }} ./cmd/pop3tool - go build -ldflags="-s -w" -o bin/jmaptool${{ matrix.ext }} ./cmd/jmaptool + go build -ldflags="-s -w" -o bin/gomailtest${{ matrix.ext }} ./cmd/gomailtest - name: Verify build output (Windows) if: matrix.os == 'windows-latest' run: | - $tools = @("msgraphtool", "smtptool", "imaptool", "pop3tool", "jmaptool") - foreach ($tool in $tools) { - $binary = "bin\$tool${{ matrix.ext }}" - if (Test-Path $binary) { - Write-Host "✓ $tool build successful" - Get-Item $binary | Select-Object Name, Length - } else { - Write-Error "✗ $tool build failed" - exit 1 - } + $binary = "bin\gomailtest${{ matrix.ext }}" + if (Test-Path $binary) { + Write-Host "✓ gomailtest build successful" + Get-Item $binary | Select-Object Name, Length + } else { + Write-Error "✗ gomailtest build failed" + exit 1 } - name: Verify build output (Linux/macOS) if: matrix.os != 'windows-latest' run: | - for tool in msgraphtool smtptool imaptool pop3tool jmaptool; do - if [ -f "bin/$tool${{ matrix.ext }}" ]; then - echo "✓ $tool build successful" - ls -lh "bin/$tool${{ matrix.ext }}" - else - echo "✗ $tool build failed" - exit 1 - fi - done + if [ -f "bin/gomailtest${{ matrix.ext }}" ]; then + echo "✓ gomailtest build successful" + ls -lh "bin/gomailtest${{ matrix.ext }}" + else + echo "✗ gomailtest build failed" + exit 1 + fi - name: Create ZIP archive (Windows) if: matrix.os == 'windows-latest' run: | - Compress-Archive -Path bin\msgraphtool${{ matrix.ext }},bin\smtptool${{ matrix.ext }},bin\imaptool${{ matrix.ext }},bin\pop3tool${{ matrix.ext }},bin\jmaptool${{ 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,IMAPTOOL_README.md,JMAPTOOL_README.md,MSGRAPHTOOL_README.md,POP3TOOL_README.md,SMTP_TOOL_README.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 - name: Create ZIP archive (Linux/macOS) if: matrix.os != 'windows-latest' run: | - cd bin && zip ../${{ matrix.zip_name }} msgraphtool${{ matrix.ext }} smtptool${{ matrix.ext }} imaptool${{ matrix.ext }} pop3tool${{ matrix.ext }} jmaptool${{ matrix.ext }} && cd .. + 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 echo "Created ZIP archive: ${{ matrix.zip_name }}" ls -lh ${{ matrix.zip_name }} @@ -158,12 +149,8 @@ jobs: ### What's Included - Each ZIP archive contains 5 tools: - - **msgraphtool** - Microsoft Graph API tool for Exchange Online - - **smtptool** - SMTP connectivity and TLS testing - - **imaptool** - IMAP server testing with XOAUTH2 support - - **pop3tool** - POP3 server testing with XOAUTH2 support - - **jmaptool** - JMAP protocol testing + Each ZIP archive contains a single unified binary: + - **gomailtest** - Unified CLI for all protocols (smtp, imap, pop3, jmap, msgraph subcommands) Plus documentation: - **README.md** - Main documentation @@ -176,68 +163,68 @@ jobs: **Windows (amd64):** 1. Download `gomailtesttool-windows-amd64.zip` 2. Extract the ZIP file - 3. Run any tool directly (e.g., `smtptool.exe -help`) + 3. Run: `gomailtest.exe --help` **Linux (amd64):** 1. Download `gomailtesttool-linux-amd64.zip` 2. Extract: `unzip gomailtesttool-linux-amd64.zip` - 3. Make executable: `chmod +x *tool` - 4. Run: `./smtptool -help` + 3. Make executable: `chmod +x gomailtest` + 4. Run: `./gomailtest --help` **macOS (Apple Silicon/arm64):** 1. Download `gomailtesttool-macos-arm64.zip` 2. Extract: `unzip gomailtesttool-macos-arm64.zip` - 3. Make executable: `chmod +x *tool` - 4. Run: `./smtptool -help` + 3. Make executable: `chmod +x gomailtest` + 4. Run: `./gomailtest --help` **Note for macOS:** If you see "cannot be opened because the developer cannot be verified": - Right-click the binary and select "Open", or - - Run: `xattr -d com.apple.quarantine *tool` + - Run: `xattr -d com.apple.quarantine gomailtest` ### Quick Start Examples **SMTP Testing:** ```bash # Test connectivity - ./smtptool -action testconnect -host smtp.example.com -port 25 + ./gomailtest smtp testconnect -host smtp.example.com -port 25 # TLS diagnostics - ./smtptool -action teststarttls -host smtp.example.com -port 587 + ./gomailtest smtp teststarttls -host smtp.example.com -port 587 ``` **IMAP Testing:** ```bash # Test connection - ./imaptool -action testconnect -host imap.gmail.com -imaps + ./gomailtest imap testconnect -host imap.gmail.com -imaps # List folders with OAuth2 - ./imaptool -action listfolders -host imap.gmail.com -imaps \ + ./gomailtest imap listfolders -host imap.gmail.com -imaps \ -username user@gmail.com -accesstoken "ya29..." ``` **POP3 Testing:** ```bash # Test connection - ./pop3tool -action testconnect -host pop.gmail.com -pop3s + ./gomailtest pop3 testconnect -host pop.gmail.com -pop3s # List mail - ./pop3tool -action listmail -host pop.gmail.com -pop3s \ + ./gomailtest pop3 listmail -host pop.gmail.com -pop3s \ -username user@gmail.com -password "app-password" ``` **JMAP Testing:** ```bash # Discover session - ./jmaptool -action testconnect -host jmap.fastmail.com + ./gomailtest jmap testconnect -host jmap.fastmail.com # Get mailboxes - ./jmaptool -action getmailboxes -host jmap.fastmail.com \ + ./gomailtest jmap getmailboxes -host jmap.fastmail.com \ -username user@fastmail.com -accesstoken "token" ``` **Microsoft Graph:** ```bash - ./msgraphtool -tenantid "..." -clientid "..." -secret "..." \ + ./gomailtest msgraph -tenantid "..." -clientid "..." -secret "..." \ -mailbox "user@example.com" -action getinbox ```