diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89c53d2..be6a716 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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}} diff --git a/script/build-test-ci b/script/build-test-ci new file mode 100755 index 0000000..817275d --- /dev/null +++ b/script/build-test-ci @@ -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