name: Go Test Multi-Platform on: push: branches: - main pull_request: branches: - main permissions: contents: read jobs: test: name: Test (${{ matrix.os }}, ${{ matrix.goarch }}) strategy: matrix: include: # AMD64 testing across major platforms - os: ubuntu-latest goarch: amd64 - os: windows-latest goarch: amd64 - os: macos-latest goarch: amd64 # ARM64 testing on supported platforms - os: ubuntu-latest goarch: arm64 - os: macos-latest goarch: arm64 runs-on: ${{ matrix.os }} steps: - name: Checkout Source uses: actions/checkout@v4 - name: Set up Go 1.25 uses: actions/setup-go@v4 with: go-version: '1.25' - name: Cache Go modules uses: actions/cache@v3 with: path: | ~/go/pkg/mod ~/.cache/go-build key: ${{ runner.os }}-go-${{ matrix.goarch }}-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go-${{ matrix.goarch }}- - name: Run Go tests run: go test -v ./... - name: Run Go tests with race detector (Linux AMD64 only) if: matrix.os == 'ubuntu-latest' && matrix.goarch == 'amd64' run: go test -race -v ./... - name: Test build (ensure compilation works) run: | # Test that we can build for the current platform echo "Testing build for current platform (${{ matrix.os }}, ${{ matrix.goarch }})..." go build -v ./cmd/reticulum-go - name: Test binary execution (Linux/macOS) if: matrix.os != 'windows-latest' run: | echo "Testing binary execution on (${{ matrix.os }}, ${{ matrix.goarch }})..." timeout 5s ./reticulum-go || echo "Binary started successfully (timeout expected)" - name: Test binary execution (Windows) if: matrix.os == 'windows-latest' run: | echo "Testing binary execution on (${{ matrix.os }}, ${{ matrix.goarch }})..." # Start the binary and kill after 5 seconds to verify it can start Start-Process -FilePath ".\reticulum-go.exe" -NoNewWindow Start-Sleep -Seconds 5 Stop-Process -Name "reticulum-go" -Force -ErrorAction SilentlyContinue echo "Binary started successfully" shell: pwsh - name: Test cross-compilation (AMD64 runners only) if: matrix.goarch == 'amd64' run: | echo "Testing ARM64 cross-compilation from AMD64..." go build -v ./cmd/reticulum-go env: GOOS: linux GOARCH: arm64 - name: Test ARMv6 cross-compilation (AMD64 runners only) if: matrix.goarch == 'amd64' run: | echo "Testing ARMv6 cross-compilation from AMD64..." go build -v ./cmd/reticulum-go env: GOOS: linux GOARCH: arm GOARM: 6