2021-08-23 20:48:05 +00:00
|
|
|
version: 2.1
|
2021-10-14 19:21:06 +00:00
|
|
|
|
2021-08-23 20:48:05 +00:00
|
|
|
jobs:
|
2021-10-14 19:21:06 +00:00
|
|
|
build-latest:
|
2021-08-23 20:48:05 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore_cache:
|
|
|
|
keys:
|
2021-10-14 19:25:19 +00:00
|
|
|
- go-mod-latest-v4-{{ checksum "go.sum" }}
|
2021-08-23 20:48:05 +00:00
|
|
|
- run:
|
|
|
|
name: Install Dependencies
|
|
|
|
command: |
|
2022-11-11 16:10:41 +00:00
|
|
|
make build-dependencies
|
2021-08-23 20:48:05 +00:00
|
|
|
- save_cache:
|
2021-10-14 19:25:19 +00:00
|
|
|
key: go-mod-latest-v4-{{ checksum "go.sum" }}
|
2021-08-23 20:48:05 +00:00
|
|
|
paths:
|
2021-10-14 19:37:10 +00:00
|
|
|
- "~/go/pkg/mod"
|
2021-08-23 20:48:05 +00:00
|
|
|
- run:
|
|
|
|
name: Build AMD64
|
|
|
|
command: |
|
|
|
|
VERSION=$CIRCLE_BRANCH
|
|
|
|
if [ ! -z "${CIRCLE_TAG}" ]; then VERSION=$CIRCLE_TAG; fi
|
2022-11-11 16:10:41 +00:00
|
|
|
make ENV_BUILD_IDENTIFIER=$VERSION ENV_BUILD_VERSION=$(echo $CIRCLE_SHA1 | cut -c1-7) build-amd64
|
2021-08-23 20:48:05 +00:00
|
|
|
- run:
|
|
|
|
name: Install Cross-Platform Dependencies
|
|
|
|
command: |
|
2021-10-14 19:37:10 +00:00
|
|
|
sudo apt-get update
|
2022-11-11 16:10:41 +00:00
|
|
|
sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install gcc-aarch64-linux-gnu libc6-dev-arm64-cross
|
|
|
|
sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
|
2021-08-23 20:48:05 +00:00
|
|
|
sudo ln -s /usr/include/asm-generic /usr/include/asm
|
2022-11-11 16:10:41 +00:00
|
|
|
- run:
|
|
|
|
name: Build ARM64
|
|
|
|
command: |
|
|
|
|
VERSION=$CIRCLE_BRANCH
|
|
|
|
if [ ! -z "${CIRCLE_TAG}" ]; then VERSION=$CIRCLE_TAG; fi
|
|
|
|
make ENV_BUILD_IDENTIFIER=$VERSION ENV_BUILD_VERSION=$(echo $CIRCLE_SHA1 | cut -c1-7) build-arm64
|
2021-08-23 20:48:05 +00:00
|
|
|
- run:
|
|
|
|
name: Build ARM
|
|
|
|
command: |
|
|
|
|
VERSION=$CIRCLE_BRANCH
|
|
|
|
if [ ! -z "${CIRCLE_TAG}" ]; then VERSION=$CIRCLE_TAG; fi
|
2022-11-11 16:10:41 +00:00
|
|
|
make ENV_BUILD_IDENTIFIER=$VERSION ENV_BUILD_VERSION=$(echo $CIRCLE_SHA1 | cut -c1-7) build-arm
|
2021-08-23 20:48:05 +00:00
|
|
|
- store_artifacts:
|
|
|
|
path: ~/repo/dist
|
|
|
|
- run:
|
|
|
|
name: "Publish Release on GitHub"
|
|
|
|
command: |
|
|
|
|
if [ ! -z "${CIRCLE_TAG}" ]; then
|
2022-11-11 18:18:10 +00:00
|
|
|
go install github.com/tcnksm/ghr@latest
|
2021-08-23 20:48:05 +00:00
|
|
|
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -replace $CIRCLE_TAG ~/repo/dist
|
|
|
|
fi
|
2021-10-14 19:21:06 +00:00
|
|
|
working_directory: ~/repo
|
|
|
|
docker:
|
2022-11-11 16:10:41 +00:00
|
|
|
- image: cimg/go:1.19
|
2023-02-18 23:07:38 +00:00
|
|
|
build-118: # just to validate compatibility with minimum go version
|
2021-10-14 19:21:06 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore_cache:
|
|
|
|
keys:
|
2023-02-18 23:07:38 +00:00
|
|
|
- go-mod-118-v4-{{ checksum "go.sum" }}
|
2021-10-14 19:21:06 +00:00
|
|
|
- run:
|
|
|
|
name: Install Dependencies
|
|
|
|
command: |
|
2022-11-11 16:10:41 +00:00
|
|
|
make build-dependencies
|
2021-10-14 19:21:06 +00:00
|
|
|
- save_cache:
|
2023-02-18 23:07:38 +00:00
|
|
|
key: go-mod-118-v4-{{ checksum "go.sum" }}
|
2021-10-14 19:21:06 +00:00
|
|
|
paths:
|
2021-10-14 19:37:10 +00:00
|
|
|
- "~/go/pkg/mod"
|
2021-10-14 19:21:06 +00:00
|
|
|
- run:
|
2022-11-11 16:10:41 +00:00
|
|
|
name: Build
|
2021-10-14 19:21:06 +00:00
|
|
|
command: |
|
|
|
|
VERSION=$CIRCLE_BRANCH
|
|
|
|
if [ ! -z "${CIRCLE_TAG}" ]; then VERSION=$CIRCLE_TAG; fi
|
|
|
|
make ENV_BUILD_IDENTIFIER=$VERSION ENV_BUILD_VERSION=$(echo $CIRCLE_SHA1 | cut -c1-7) build
|
2023-02-18 23:07:38 +00:00
|
|
|
working_directory: ~/repo118
|
2021-10-14 19:21:06 +00:00
|
|
|
docker:
|
2023-02-18 23:07:38 +00:00
|
|
|
- image: cimg/go:1.18
|
2021-08-23 21:03:55 +00:00
|
|
|
|
|
|
|
workflows:
|
|
|
|
build-and-release:
|
|
|
|
jobs:
|
|
|
|
#--------------- BUILD ---------------#
|
2021-10-14 19:21:06 +00:00
|
|
|
- build-latest:
|
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only: /^v.*/
|
2023-02-18 23:10:49 +00:00
|
|
|
- build-118:
|
2021-10-14 19:21:06 +00:00
|
|
|
requires:
|
|
|
|
- build-latest
|
2021-08-23 21:03:55 +00:00
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only: /^v.*/
|