Skip to content

Merge pull request #713 from ppc64le-cloud/dependabot/go_modules/gith… #1616

Merge pull request #713 from ppc64le-cloud/dependabot/go_modules/gith…

Merge pull request #713 from ppc64le-cloud/dependabot/go_modules/gith… #1616

Workflow file for this run

name: Go
on:
push:
tags:
- '*'
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- run: go version
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Go Formatting
run: |
unformatted=$(gofmt -l -e -d .)
if [[ ! -z "${unformatted}" ]]; then
echo "fix the formatting...."
echo "${unformatted}"
exit 1
fi
- name: Go Vet
run: |
go vet ./...
- name: Build
run: |
mkdir -p bin
# workaround for https://github.com/actions/checkout/issues/290
git fetch --tags --force --prune
VERSION=$(git describe --tags --dirty)
STATIC_FLAG='-w -extldflags "-static"'
for platform in darwin/amd64 darwin/arm64 linux/amd64 linux/ppc64le windows/amd64
do
os_name=$(echo "$platform" | cut -d "/" -f 1)
arch=$(echo "$platform" | cut -d "/" -f 2)
CGO_ENABLED=0 GOOS=${os_name} GOARCH=${arch} go build -a -tags netgo -ldflags "-X github.com/ppc64le-cloud/pvsadm/pkg/version.Version=${VERSION} ${STATIC_FLAG}" -o bin/pvsadm-${os_name}-${arch} .
done
tar -czvf pvsadm-binaries.tar.gz bin/
- name: Test
run: make unit
- uses: actions/upload-artifact@v4
with:
name: pvsadm-binaries
path: pvsadm-binaries.tar.gz
if-no-files-found: error