[CI-only] Build updates (#2296)
This commit is contained in:
1 parent
2cbe65597b
commit
63bfcaff61
3 files changed
+51
-55
No files matched your search
+34
-52
@@ -1,18 +1,27 @@
|
||||
name: build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
# Sequence of patterns matched against refs/heads
|
||||
branches:
|
||||
# Push events on main branch
|
||||
- 'main'
|
||||
on: [ workflow_dispatch, push, workflow_call ]
|
||||
|
||||
env:
|
||||
PKG_NAME: "boundary"
|
||||
|
||||
jobs:
|
||||
get-go-version:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
go-version: ${{ steps.get-go-version.outputs.go-version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: 'Determine Go version'
|
||||
id: get-go-version
|
||||
# We use .go-version as our source of truth for current Go
|
||||
# version, because "goenv" can react to it automatically.
|
||||
run: |
|
||||
echo "Building with Go $(cat .go-version)"
|
||||
echo "::set-output name=go-version::$(cat .go-version)"
|
||||
|
||||
get-product-version:
|
||||
needs: get-go-version
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
product-version: ${{ steps.get-product-version.outputs.product-version }}
|
||||
@@ -22,12 +31,12 @@ jobs:
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: "1.18.4"
|
||||
go-version: "${{ needs.get-go-version.outputs.go-version }}"
|
||||
- name: get product version
|
||||
id: get-product-version
|
||||
run: |
|
||||
VERSION=$(make version)
|
||||
MINOR_VERSION=${VERSION%.*}
|
||||
MINOR_VERSION=$(echo $VERSION | cut -d. -f-2)
|
||||
echo "::set-output name=product-version::$VERSION"
|
||||
echo "::set-output name=product-minor-version::$MINOR_VERSION"
|
||||
|
||||
@@ -60,20 +69,6 @@ jobs:
|
||||
name: metadata.json
|
||||
path: ${{ steps.generate-metadata-file.outputs.filepath }}
|
||||
|
||||
set-ld-flags:
|
||||
needs: get-product-version
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
ldflags: ${{ steps.generate-ld-flags.outputs.ldflags }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: 'Generate ld flags'
|
||||
id: generate-ld-flags
|
||||
run: |
|
||||
project="$(go list -m)"
|
||||
sha="$(git rev-parse HEAD)"
|
||||
echo "::set-output name=ldflags::"-s -w -X \'$project/version.GitCommit=$sha\'""
|
||||
|
||||
get-product-edition:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
@@ -90,18 +85,17 @@ jobs:
|
||||
make edition
|
||||
echo "::set-output name=product-edition::$(make edition)"
|
||||
|
||||
|
||||
build-other:
|
||||
needs:
|
||||
- get-product-version
|
||||
- get-product-edition
|
||||
- set-ld-flags
|
||||
- get-go-version
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
goos: [ freebsd, windows, netbsd, openbsd, solaris ]
|
||||
goarch: [ "386", "amd64", "arm" ]
|
||||
go: [ "1.18.4" ]
|
||||
go: [ "${{ needs.get-go-version.outputs.go-version }}" ]
|
||||
exclude:
|
||||
- goos: solaris
|
||||
goarch: 386
|
||||
@@ -115,7 +109,6 @@ jobs:
|
||||
env:
|
||||
GOPRIVATE: "github.com/hashicorp"
|
||||
GO111MODULE: on
|
||||
LD_FLAGS: ${{ needs.set-ld-flags.outputs.ldflags }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup go
|
||||
@@ -141,12 +134,9 @@ jobs:
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
CGO_ENABLED: 0
|
||||
run: |
|
||||
mkdir -p dist out
|
||||
unset GOPATH;
|
||||
# Build plugins
|
||||
./scripts/plugins.sh
|
||||
go build -v -tags "ui" -ldflags "${{ env.LD_FLAGS }}" -o dist/ ./cmd/boundary
|
||||
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/
|
||||
mkdir out
|
||||
make build
|
||||
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip bin/
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
|
||||
@@ -156,13 +146,13 @@ jobs:
|
||||
needs:
|
||||
- get-product-version
|
||||
- get-product-edition
|
||||
- set-ld-flags
|
||||
- get-go-version
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
goos: [linux]
|
||||
goarch: ["arm", "arm64", "386", "amd64"]
|
||||
go: [ "1.18.4" ]
|
||||
go: [ "${{ needs.get-go-version.outputs.go-version }}" ]
|
||||
fail-fast: true
|
||||
|
||||
name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build
|
||||
@@ -170,7 +160,6 @@ jobs:
|
||||
env:
|
||||
GOPRIVATE: "github.com/hashicorp"
|
||||
GO111MODULE: on
|
||||
LD_FLAGS: ${{ needs.set-ld-flags.outputs.ldflags }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
@@ -197,12 +186,9 @@ jobs:
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
CGO_ENABLED: 0
|
||||
run: |
|
||||
mkdir -p dist out
|
||||
unset GOPATH;
|
||||
# Build plugins
|
||||
./scripts/plugins.sh
|
||||
go build -v -tags "ui" -ldflags "${{ env.LD_FLAGS }}" -o dist/ ./cmd/boundary
|
||||
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/
|
||||
mkdir out
|
||||
make build
|
||||
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip bin/
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
|
||||
@@ -218,7 +204,7 @@ jobs:
|
||||
maintainer: "HashiCorp"
|
||||
homepage: "https://github.com/hashicorp/boundary"
|
||||
license: "MPL-2.0"
|
||||
binary: "dist/${{ env.PKG_NAME }}"
|
||||
binary: "bin/${{ env.PKG_NAME }}"
|
||||
deb_depends: "openssl"
|
||||
rpm_depends: "openssl"
|
||||
config_dir: ".release/linux/package/"
|
||||
@@ -237,18 +223,17 @@ jobs:
|
||||
name: ${{ env.DEB_PACKAGE }}
|
||||
path: out/${{ env.DEB_PACKAGE }}
|
||||
|
||||
|
||||
build-darwin:
|
||||
needs:
|
||||
- get-product-version
|
||||
- get-product-edition
|
||||
- set-ld-flags
|
||||
- get-go-version
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
matrix:
|
||||
goos: [ darwin ]
|
||||
goarch: [ "amd64", "arm64" ]
|
||||
go: [ "1.18.4" ]
|
||||
go: [ "${{ needs.get-go-version.outputs.go-version }}" ]
|
||||
fail-fast: true
|
||||
name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build
|
||||
|
||||
@@ -280,12 +265,9 @@ jobs:
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
CGO_ENABLED: 0
|
||||
run: |
|
||||
mkdir -p dist out
|
||||
unset GOPATH;
|
||||
# Build plugins
|
||||
./scripts/plugins.sh
|
||||
go build -v -tags "ui netcgo" -ldflags "${{ env.LD_FLAGS }}" -o dist/ ./cmd/boundary
|
||||
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/
|
||||
mkdir out
|
||||
make build
|
||||
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip bin/
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1.18.4
|
||||
+16
-3
@@ -3,6 +3,8 @@
|
||||
# This script builds the application from source for a single platform.
|
||||
set -e
|
||||
|
||||
GO_CMD=${GO_CMD:-go}
|
||||
|
||||
# Get the parent directory of where this script is.
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
|
||||
@@ -17,6 +19,7 @@ fi
|
||||
|
||||
# Set build tags
|
||||
BUILD_TAGS="${BUILD_TAGS:-"boundary"}"
|
||||
echo "==> Build tags: ${BUILD_TAGS}"
|
||||
|
||||
# Get the git commit
|
||||
GIT_COMMIT="$(git rev-parse HEAD)"
|
||||
@@ -57,9 +60,10 @@ rm -f bin/*
|
||||
mkdir -p bin/
|
||||
|
||||
# Build!
|
||||
echo "==> Building into bin/..."
|
||||
echo "==> Building into bin/ for ${GOOS}_${GOARCH}..."
|
||||
BINARY_NAME="boundary${BINARY_SUFFIX}"
|
||||
go build -tags="${BUILD_TAGS}" \
|
||||
${GO_CMD} build \
|
||||
-tags="${BUILD_TAGS}" \
|
||||
-ldflags "-X github.com/hashicorp/boundary/version.GitCommit=${GIT_COMMIT}${GIT_DIRTY}" \
|
||||
-o "bin/${BINARY_NAME}" \
|
||||
./cmd/boundary
|
||||
@@ -71,4 +75,13 @@ if [ "${BOUNDARY_INSTALL_BINARY}x" != "x" ]; then
|
||||
fi
|
||||
|
||||
# Done!
|
||||
echo "==> Done!"
|
||||
echo "==> Results:"
|
||||
ls -hl bin/
|
||||
|
||||
# Print the version output for just linux_amd64.
|
||||
# Since we run this script in CI, and our CI build jobs run on linux runners,
|
||||
# We can only check the version output for a subset of builds
|
||||
if [ "${GOOS}" == "linux" ] && [ "${GOARCH}" == "amd64" ]; then
|
||||
echo "==> Version Info:"
|
||||
bin/boundary version
|
||||
fi
|
||||
Reference in new issue
Block a user