testing new ci script for matrix build and test

This commit is contained in:
Shawn Hartsell
2024-04-22 18:00:37 -05:00
parent b47191d0e7
commit 4ab3e731a1
2 changed files with 25 additions and 5 deletions
+5 -5
View File
@@ -6,9 +6,10 @@ jobs:
CI:
strategy:
matrix:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
goos: [linux, windows, darwin]
goarch: [amd64, arm64]
runs-on: ubuntu-latest
runs-on: ${{ matrix.runs-on }}
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -22,7 +23,6 @@ jobs:
version: v1.54.2
- name: Unit Tests
run: ./script/test
- name: Build
run: GOOS=${{matrix.goos}} GOARCH=${{matrix.goarch}} go build -o bin/actions-sync main.go
- name: Build and Test
run: ./script/test-build
- name: Run End-to-End Tests for ${{matrix.goos}}/${{matrix.goarch}}
run: ./script/test-build-ci ${{matrix.goos}} ${{matrix.goarch}}
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "No GOOS specified as first arg, using the current system GOOS"
GOOS_BUILD=$(go env GOOS)
else
GOOS_BUILD=$1
fi
if [ -z "$2" ]; then
echo "No GOARCH specified as second arg, using the current system GOOS"
GOARCH_BUILD=$(go env GOARCH)
else
GOARCH_BUILD=$1
fi
echo "Building for $GOOS_BUILD $GOARCH_BUILD"
# build the exutable and include GOOS and GOARCH in the name
GOOS=$GOOS_BUILD GOARCH=$GOARCH_BUILD go build -o bin/actions-sync-"$GOOS_BUILD"-"$GOARCH_BUILD" main.go