75 lines
2.0 KiB
YAML
75 lines
2.0 KiB
YAML
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 cross-compilation (AMD64 runners only)
|
|
if: matrix.goarch == 'amd64'
|
|
run: |
|
|
echo "Testing ARM64 cross-compilation from AMD64..."
|
|
GOOS=linux GOARCH=arm64 go build -v ./cmd/reticulum-go
|
|
|
|
echo "Testing ARMv6 cross-compilation from AMD64..."
|
|
GOOS=linux GOARCH=arm GOARM=6 go build -v ./cmd/reticulum-go
|