Add support for multi-platform testing
This commit is contained in:
57
.github/workflows/go-test.yml
vendored
57
.github/workflows/go-test.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Go Test
|
||||
name: Go Test Multi-Platform
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -13,15 +13,62 @@ permissions:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
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@f43a0e5ff2bd294095638e18286ca9a3d1956744
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go 1.25
|
||||
uses: actions/setup-go@19bb51245e9c80abacb2e91cc42b33fa478b8639
|
||||
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 ./...
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user