Update development environment #205
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go | |
on: | |
push: | |
branches: [ main ] | |
tags: [ v** ] | |
paths-ignore: | |
- '*.md' | |
- 'docs/**' | |
- 'samples/**' | |
pull_request: | |
branches: [ main ] | |
paths-ignore: | |
- '*.md' | |
- 'docs/**' | |
- 'samples/**' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macOS-latest] | |
goarch: [amd64, arm64] | |
env: | |
GOARCH: ${{ matrix.goarch }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.22 | |
- name: Build | |
run: go build -v ./... | |
# Testing the compiled binary will not work without emulation on arm | |
- name: Test | |
if: ${{ matrix.goarch != 'arm64' }} | |
run: go test -v ./... | |
env: | |
FABRIC_K8S_BUILDER_DEBUG: 'true' | |
INCLUDE_KIND_TESTS: ${{ matrix.os == 'ubuntu-latest' && 'true' || 'false' }} | |
- name: Package | |
run: | | |
CGO_ENABLED=0 go build -v ./cmd/build | |
CGO_ENABLED=0 go build -v ./cmd/detect | |
CGO_ENABLED=0 go build -v ./cmd/release | |
CGO_ENABLED=0 go build -v ./cmd/run | |
export GOOS=$(go env GOOS) | |
tar -czvf fabric-builder-k8s-${GOOS}-${GOARCH}.tgz build detect release run | |
ls -l fabric-builder-k8s-${GOOS}-${GOARCH}.tgz | |
- name: Rename package | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
export GOOS=$(go env GOOS) | |
mv fabric-builder-k8s-${GOOS}-${GOARCH}.tgz fabric-builder-k8s-${GITHUB_REF_NAME}-${GOOS}-${GOARCH}.tgz | |
- name: Upload package | |
run: | | |
export GOOS=$(go env GOOS) | |
gh release upload $GITHUB_REF_NAME fabric-builder-k8s-${GITHUB_REF_NAME}-${GOOS}-${GOARCH}.tgz | |
if: startsWith(github.ref, 'refs/tags/v') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |