mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-19 21:57:54 +00:00
3690acbd70
We also remove the Makefile to go to a simpler build system, as long with the retry_docker_push.sh file. We remove the rest of the automation tools as they're no longer used and update the circle.yml file. We also remove debug builds, as these aren't needed moving forward, and were only to enable livepush builds. Change-type: major Signed-off-by: Cameron Diver <cameron@balena.io>
141 lines
4.2 KiB
YAML
141 lines
4.2 KiB
YAML
---
|
|
defaults: &defaults
|
|
docker:
|
|
- image: library/docker:19-git
|
|
working_directory: /tmp/build
|
|
steps:
|
|
- setup_remote_docker:
|
|
version: 18.09.3
|
|
docker_layer_caching: true
|
|
- run:
|
|
name: Check docker is running and install git
|
|
command: |
|
|
docker info
|
|
apk update && apk upgrade && apk add --no-cache \
|
|
make \
|
|
jq \
|
|
bash \
|
|
grep \
|
|
nodejs \
|
|
nodejs-npm \
|
|
openssh-client
|
|
- checkout
|
|
- run:
|
|
name: Initialize the submodules (yocto layers)
|
|
command: |
|
|
git submodule update --init --recursive
|
|
git clean -fxd base-image
|
|
git submodule foreach --recursive git clean -fxd
|
|
- run:
|
|
name: Build $ARCH-supervisor
|
|
no_output_timeout: 10800
|
|
command: |
|
|
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 "")
|
|
VERSION_TAG="${VERSION_TAG_NO_DEBUG}${DEBUG}"
|
|
if [ "${VERSION_TAG_NO_DEBUG}" = "${GIT_TAG}" ]; then
|
|
export EXTRA_TAG="${VERSION_TAG}"
|
|
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
|
|
|
|
version: 2
|
|
jobs:
|
|
generic:
|
|
docker:
|
|
- image: library/node:10
|
|
steps:
|
|
- checkout
|
|
- 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: ''
|
|
amd64:
|
|
<<: *defaults
|
|
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: ''
|
|
i386:
|
|
<<: *defaults
|
|
environment:
|
|
DOCKER_USERNAME: travisciresin
|
|
ARCH: i386
|
|
PUSH_IMAGES: 'true'
|
|
STAGING_API_ENDPOINT: https://api.balena-staging.com
|
|
PRODUCTION_API_ENDPOINT: https://api.balena-cloud.com
|
|
DEBUG: ''
|
|
armv7hf:
|
|
<<: *defaults
|
|
environment:
|
|
DOCKER_USERNAME: travisciresin
|
|
ARCH: armv7hf
|
|
PUSH_IMAGES: 'true'
|
|
STAGING_API_ENDPOINT: https://api.balena-staging.com
|
|
PRODUCTION_API_ENDPOINT: https://api.balena-cloud.com
|
|
DEBUG: ''
|
|
aarch64:
|
|
<<: *defaults
|
|
environment:
|
|
DOCKER_USERNAME: travisciresin
|
|
ARCH: aarch64
|
|
PUSH_IMAGES: 'true'
|
|
STAGING_API_ENDPOINT: https://api.balena-staging.com
|
|
PRODUCTION_API_ENDPOINT: https://api.balena-cloud.com
|
|
DEBUG: ''
|
|
rpi:
|
|
<<: *defaults
|
|
environment:
|
|
DOCKER_USERNAME: travisciresin
|
|
ARCH: rpi
|
|
PUSH_IMAGES: 'true'
|
|
STAGING_API_ENDPOINT: https://api.balena-staging.com
|
|
PRODUCTION_API_ENDPOINT: https://api.balena-cloud.com
|
|
DEBUG: ''
|
|
|
|
workflows:
|
|
version: 2
|
|
build_and_maybe_deploy:
|
|
jobs:
|
|
- generic
|
|
- amd64:
|
|
requires:
|
|
- generic
|
|
- i386:
|
|
requires:
|
|
- generic
|
|
- rpi:
|
|
requires:
|
|
- generic
|
|
- armv7hf:
|
|
requires:
|
|
- generic
|
|
- aarch64:
|
|
requires:
|
|
- generic
|