-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Merge pull request #1 from opencloudengineer/improve-ci
fixes and features needed to improve ci & build process
- Loading branch information
Showing
8 changed files
with
70 additions
and
32 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
#!/bin/bash | ||
echo "Building app for Version : ${VERSION} && Git Commit SHA : ${GITHUB_SHA}" | ||
set -xeuo pipefail | ||
|
||
set -x | ||
echo "Building on platform with OS: $(go env GOOS) & Arch: $(go env GOARCH)" | ||
echo "Building app for Version : ${VERSION:=$(git describe --tags)} && Git Commit SHA : ${GITHUB_SHA:=$(git rev-parse HEAD)}" | ||
|
||
export GO111MODULE=on | ||
export CGO_ENABLED=0 | ||
|
||
go get ./... | ||
|
||
go vet ./... | ||
|
||
mkdir -p ./bin | ||
|
||
LDFLAGS="-s -w -X github.com/opencloudengineer/gogeta/cmd.Version=${VERSION} -X github.com/opencloudengineer/gogeta/cmd.GitCommit=${GITHUB_SHA}" | ||
FLAGS='-a -installsuffix cgo -o' | ||
BUILD='go build -ldflags' | ||
LDFLAGS="-s -w -X 'github.com/opencloudengineer/gogeta/cmd.Version=${VERSION}' -X 'github.com/opencloudengineer/gogeta/cmd.GitCommit=${GITHUB_SHA}'" | ||
|
||
function buildFor() { | ||
GOOS="${1}" GOARCH="${2}" go build -ldflags="${LDFLAGS}" -a -installsuffix cgo -o "./bin/gogeta-${1}-${2}" | ||
} | ||
|
||
buildFor windows amd64 | ||
buildFor darwin amd64 | ||
buildFor linux amd64 | ||
buildFor linux arm64 | ||
|
||
GOOS=windows ${BUILD} "${LDFLAGS}" ${FLAGS} ./bin/gogeta-windows-amd64.exe | ||
GOOS=darwin ${BUILD} "${LDFLAGS}" ${FLAGS} ./bin/gogeta-darwin-amd64 | ||
GOOS=linux ${BUILD} "${LDFLAGS}" ${FLAGS} ./bin/gogeta-linux-amd64 | ||
GOOS=linux GOARCH=arm64 ${BUILD} "${LDFLAGS}" ${FLAGS} ./bin/gogeta-linux-arm64 | ||
# add .exe extension to windows binary | ||
mv ./bin/gogeta-windows-amd64{,.exe} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- "*" | ||
pull_request: | ||
branches: | ||
- "*" | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
go-version: [1.15.x] | ||
os: [ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Generate Binaries | ||
run: bash ./.github/build.sh |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ | |
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
bin/gogeta* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
tasks: | ||
- before: > | ||
brew install hadolint; | ||
brew install hadolint ; | ||
brew install shfmt ; | ||
brew install shellcheck ; | ||
npm install -g prettier ; | ||
( cd && go get github.com/jessfraz/dockfmt ) ; | ||
init: go get -v ./... | ||
command: go build . |
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
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
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