Skip to content

chore: upgrade Go modules and GitHub Actions (#641) #28

chore: upgrade Go modules and GitHub Actions (#641)

chore: upgrade Go modules and GitHub Actions (#641) #28

Workflow file for this run

# Build and test workflow for Launchpad
# Triggered on PRs and pushes to main.
name: Build and Test
permissions:
contents: read
packages: write # Required for uploading artifacts
on:
push:
branches: [ main ]
jobs:
build:
name: Build Binaries
runs-on: ubuntu-latest
env:
GOTOOLCHAIN: auto
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: true
- name: Build binaries
run: |
mkdir -p dist
platforms=("linux/amd64" "linux/arm64" "windows/amd64" "windows/arm64" "darwin/amd64" "darwin/arm64")
for platform in "${platforms[@]}"; do
GOOS=${platform%/*}
GOARCH=${platform#*/}
output_name="dist/launchpad_${GOOS}_${GOARCH}"
if [ "$GOOS" = "windows" ]; then
output_name+=".exe"
fi
echo "Building $output_name"
GOOS=$GOOS GOARCH=$GOARCH go build -ldflags "-X github.com/Mirantis/launchpad/version.GitCommit=$GITHUB_SHA" -o "$output_name" ./main.go
done
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: launchpad-binaries
path: dist/
test:
name: Run Tests
runs-on: ubuntu-latest
env:
GOTOOLCHAIN: auto
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: true
- name: Run unit tests
run: go test -v ./...
- name: Run integration tests
run: go test -v -tags=integration ./test/integration