Skip to content

[WIP] testscript experiment #460

[WIP] testscript experiment

[WIP] testscript experiment #460

Workflow file for this run

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-13]
goarch: [amd64, arm64]
env:
GOARCH: ${{ matrix.goarch }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5
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 }}