2017-07-07 21:54:11 +00:00
|
|
|
---
|
|
|
|
defaults: &defaults
|
|
|
|
docker:
|
2020-05-08 11:31:36 +00:00
|
|
|
- image: library/docker:18-git
|
2017-07-07 21:54:11 +00:00
|
|
|
working_directory: /tmp/build
|
|
|
|
steps:
|
2017-07-17 20:11:24 +00:00
|
|
|
- setup_remote_docker:
|
2020-01-16 18:06:27 +00:00
|
|
|
version: 18.09.3
|
2021-04-27 16:38:13 +00:00
|
|
|
docker_layer_caching: true
|
2017-07-07 21:54:11 +00:00
|
|
|
- run:
|
|
|
|
name: Check docker is running and install git
|
|
|
|
command: |
|
|
|
|
docker info
|
2020-01-16 18:06:27 +00:00
|
|
|
apk update && apk upgrade && apk add --no-cache \
|
2017-07-18 21:30:02 +00:00
|
|
|
make \
|
|
|
|
jq \
|
|
|
|
bash \
|
2018-10-22 22:16:47 +00:00
|
|
|
grep \
|
2017-07-18 21:30:02 +00:00
|
|
|
nodejs \
|
|
|
|
nodejs-npm \
|
|
|
|
openssh-client
|
2017-07-07 21:54:11 +00:00
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
name: Initialize the submodules (yocto layers)
|
|
|
|
command: |
|
2019-05-08 13:37:16 +00:00
|
|
|
git submodule update --init --recursive
|
|
|
|
git clean -fxd base-image
|
|
|
|
git submodule foreach --recursive git clean -fxd
|
2017-07-07 21:54:11 +00:00
|
|
|
- run:
|
2017-07-18 21:30:02 +00:00
|
|
|
name: Build $ARCH-supervisor
|
2017-07-07 21:54:11 +00:00
|
|
|
no_output_timeout: 10800
|
|
|
|
command: |
|
2019-05-08 13:37:16 +00:00
|
|
|
VERSION_TAG_NO_DEBUG=v$(jq --raw-output .version package.json)
|
|
|
|
GIT_TAG=$(git describe --tags | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' || echo "")
|
2019-05-16 09:45:12 +00:00
|
|
|
VERSION_TAG="${VERSION_TAG_NO_DEBUG}${DEBUG}"
|
2019-05-08 13:37:16 +00:00
|
|
|
if [ "${VERSION_TAG_NO_DEBUG}" = "${GIT_TAG}" ]; then
|
2019-05-16 09:45:12 +00:00
|
|
|
export EXTRA_TAG="${VERSION_TAG}"
|
2019-05-08 13:37:16 +00:00
|
|
|
fi
|
|
|
|
echo "Starting build.sh"
|
|
|
|
if [ "$DOCKER_PASSWORD" != "" ]; then
|
|
|
|
docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD
|
|
|
|
export PUSH_IMAGES=${PUSH_IMAGES}
|
|
|
|
else
|
|
|
|
export PUSH_IMAGES=false
|
|
|
|
fi
|
|
|
|
# start the build for this architecture
|
|
|
|
export TAG=$(echo ${CIRCLE_BRANCH} | sed 's/[^a-z0-9A-Z_.-]/-/g')
|
|
|
|
export ARCH=${ARCH}
|
|
|
|
bash automation/build.sh
|
|
|
|
if [ "${CIRCLE_BRANCH}" = "master" ] && [ "${DEPLOY_TO_BALENA}" = "true" ]; then
|
|
|
|
echo "Deploying to balena API (staging)"
|
|
|
|
ARCH=${ARCH} TAG=$VERSION_TAG API_KEY=$STAGING_API_KEY API_ENDPOINT=$STAGING_API_ENDPOINT node automation/deploy-to-balena-cloud.js
|
|
|
|
echo "Deploying to balena API (production)"
|
|
|
|
ARCH=${ARCH} TAG=$VERSION_TAG API_KEY=$PRODUCTION_API_KEY API_ENDPOINT=$PRODUCTION_API_ENDPOINT node automation/deploy-to-balena-cloud.js
|
|
|
|
fi
|
2017-07-07 21:54:11 +00:00
|
|
|
|
|
|
|
version: 2
|
|
|
|
jobs:
|
2020-03-23 17:44:17 +00:00
|
|
|
generic:
|
|
|
|
docker:
|
2020-05-08 11:31:58 +00:00
|
|
|
- image: balenalib/amd64-alpine-node:12
|
2020-03-23 17:44:17 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
2020-04-09 10:45:32 +00:00
|
|
|
- run:
|
|
|
|
name: Install dependencies
|
|
|
|
command: |
|
2020-06-05 15:24:12 +00:00
|
|
|
apk add dbus-dev python3 make \
|
2020-04-09 10:45:32 +00:00
|
|
|
gcc libgcc libc-dev g++
|
2020-03-23 17:44:17 +00:00
|
|
|
- run:
|
|
|
|
name: Run tests
|
|
|
|
command: |
|
|
|
|
JOBS=max npm ci && npm test
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME: travisciresin
|
|
|
|
ARCH: amd64
|
|
|
|
PUSH_IMAGES: 'true'
|
|
|
|
STAGING_API_ENDPOINT: https://api.balena-staging.com
|
|
|
|
PRODUCTION_API_ENDPOINT: https://api.balena-cloud.com
|
|
|
|
DEBUG: ''
|
2017-07-07 21:54:11 +00:00
|
|
|
amd64:
|
|
|
|
<<: *defaults
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME: travisciresin
|
|
|
|
ARCH: amd64
|
2019-05-08 13:37:16 +00:00
|
|
|
PUSH_IMAGES: 'true'
|
2018-10-18 18:54:19 +00:00
|
|
|
STAGING_API_ENDPOINT: https://api.balena-staging.com
|
|
|
|
PRODUCTION_API_ENDPOINT: https://api.balena-cloud.com
|
2019-05-08 13:37:16 +00:00
|
|
|
DEBUG: ''
|
2017-07-07 21:54:11 +00:00
|
|
|
i386:
|
|
|
|
<<: *defaults
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME: travisciresin
|
|
|
|
ARCH: i386
|
2019-05-08 13:37:16 +00:00
|
|
|
PUSH_IMAGES: 'true'
|
2018-10-18 18:54:19 +00:00
|
|
|
STAGING_API_ENDPOINT: https://api.balena-staging.com
|
|
|
|
PRODUCTION_API_ENDPOINT: https://api.balena-cloud.com
|
2019-05-08 13:37:16 +00:00
|
|
|
DEBUG: ''
|
2017-07-10 15:53:31 +00:00
|
|
|
armv7hf:
|
|
|
|
<<: *defaults
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME: travisciresin
|
|
|
|
ARCH: armv7hf
|
2019-05-08 13:37:16 +00:00
|
|
|
PUSH_IMAGES: 'true'
|
2018-10-18 18:54:19 +00:00
|
|
|
STAGING_API_ENDPOINT: https://api.balena-staging.com
|
|
|
|
PRODUCTION_API_ENDPOINT: https://api.balena-cloud.com
|
2019-05-08 13:37:16 +00:00
|
|
|
DEBUG: ''
|
2017-07-10 15:53:31 +00:00
|
|
|
aarch64:
|
|
|
|
<<: *defaults
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME: travisciresin
|
|
|
|
ARCH: aarch64
|
2019-05-08 13:37:16 +00:00
|
|
|
PUSH_IMAGES: 'true'
|
2018-10-18 18:54:19 +00:00
|
|
|
STAGING_API_ENDPOINT: https://api.balena-staging.com
|
|
|
|
PRODUCTION_API_ENDPOINT: https://api.balena-cloud.com
|
2019-05-08 13:37:16 +00:00
|
|
|
DEBUG: ''
|
2017-07-10 15:53:31 +00:00
|
|
|
rpi:
|
|
|
|
<<: *defaults
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME: travisciresin
|
|
|
|
ARCH: rpi
|
2019-05-08 13:37:16 +00:00
|
|
|
PUSH_IMAGES: 'true'
|
2018-10-18 18:54:19 +00:00
|
|
|
STAGING_API_ENDPOINT: https://api.balena-staging.com
|
|
|
|
PRODUCTION_API_ENDPOINT: https://api.balena-cloud.com
|
2019-05-08 13:37:16 +00:00
|
|
|
DEBUG: ''
|
2017-07-07 21:54:11 +00:00
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
2017-07-12 17:18:35 +00:00
|
|
|
build_and_maybe_deploy:
|
2017-07-07 21:54:11 +00:00
|
|
|
jobs:
|
2020-03-23 17:44:17 +00:00
|
|
|
- generic
|
|
|
|
- amd64:
|
|
|
|
requires:
|
|
|
|
- generic
|
|
|
|
- i386:
|
|
|
|
requires:
|
|
|
|
- generic
|
|
|
|
- rpi:
|
|
|
|
requires:
|
|
|
|
- generic
|
|
|
|
- armv7hf:
|
|
|
|
requires:
|
|
|
|
- generic
|
|
|
|
- aarch64:
|
|
|
|
requires:
|
|
|
|
- generic
|