Files
Reticulum-Go/.github/workflows/go-test.yml
Ivan feeaa72102 Update GitHub Actions workflows
- Pin to full -length commit hash
- Add master alongside main
2025-10-31 07:39:34 -05:00

104 lines
3.1 KiB
YAML

name: Go Test Multi-Platform
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up Go 1.25
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version: '1.25'
- name: Cache Go modules
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
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