2017-07-07 21:54:11 +00:00
|
|
|
---
|
|
|
|
defaults: &defaults
|
|
|
|
docker:
|
2017-07-18 21:30:02 +00:00
|
|
|
- image: library/docker:17.06.0-ce
|
2017-07-07 21:54:11 +00:00
|
|
|
working_directory: /tmp/build
|
|
|
|
steps:
|
2017-07-17 20:11:24 +00:00
|
|
|
- setup_remote_docker:
|
2017-07-18 21:30:02 +00:00
|
|
|
version: 17.06.0-ce
|
2017-07-17 20:11:24 +00:00
|
|
|
reusable: true
|
2017-07-07 21:54:11 +00:00
|
|
|
- run:
|
|
|
|
name: Check docker is running and install git
|
|
|
|
command: |
|
|
|
|
docker info
|
2017-07-18 21:30:02 +00:00
|
|
|
apk update && apk upgrade && apk add --nocache \
|
|
|
|
make \
|
|
|
|
jq \
|
|
|
|
git \
|
|
|
|
bash \
|
|
|
|
nodejs \
|
|
|
|
nodejs-npm \
|
|
|
|
openssh-client
|
2017-07-07 21:54:11 +00:00
|
|
|
- checkout
|
2017-07-18 21:30:02 +00:00
|
|
|
- run:
|
|
|
|
name: Install npm dependencies
|
|
|
|
working_directory: /tmp/build/automation
|
|
|
|
command: |
|
|
|
|
JOBS=max npm install \
|
|
|
|
&& npm cache clean
|
2017-07-07 21:54:11 +00:00
|
|
|
- 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:
|
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: |
|
2017-07-12 17:18:35 +00:00
|
|
|
VERSION_TAG=v$(jq .version package.json | sed 's/"//g')
|
|
|
|
if [ "${CIRCLE_BRANCH}" = "master" ]; then
|
2017-07-18 21:30:02 +00:00
|
|
|
export EXTRA_TAG=$VERSION_TAG
|
2017-07-12 17:18:35 +00:00
|
|
|
fi
|
2017-07-17 20:11:24 +00:00
|
|
|
echo "Starting build.sh"
|
2017-07-18 21:43:00 +00:00
|
|
|
docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD
|
2017-07-07 21:54:11 +00:00
|
|
|
# start the build for this architecture
|
2017-07-18 21:30:02 +00:00
|
|
|
export TAG=${CIRCLE_BRANCH}
|
|
|
|
export ARCH=${ARCH}
|
|
|
|
export PUSH_IMAGES=${PUSH_IMAGES}
|
|
|
|
bash automation/build.sh
|
2017-07-12 17:18:35 +00:00
|
|
|
if [ "${CIRCLE_BRANCH}" = "master" ] && [ "${DEPLOY_TO_RESIN}" = "true" ]; then
|
|
|
|
echo "Deploying to Resin API (staging)"
|
2017-07-18 21:30:02 +00:00
|
|
|
ARCH=${ARCH} TAG=$VERSION_TAG API_KEY=$STAGING_API_KEY API_ENDPOINT=$STAGING_API_ENDPOINT node automation/deploy-to-resin.js
|
2017-07-12 17:18:35 +00:00
|
|
|
echo "Deploying to Resin API (production)"
|
2017-07-18 21:30:02 +00:00
|
|
|
ARCH=${ARCH} TAG=$VERSION_TAG API_KEY=$PRODUCTION_API_KEY API_ENDPOINT=$PRODUCTION_API_ENDPOINT node automation/deploy-to-resin.js
|
2017-07-12 17:18:35 +00:00
|
|
|
fi
|
2017-07-07 21:54:11 +00:00
|
|
|
|
|
|
|
version: 2
|
|
|
|
jobs:
|
|
|
|
amd64:
|
|
|
|
<<: *defaults
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME: travisciresin
|
|
|
|
ARCH: amd64
|
2017-07-10 15:53:31 +00:00
|
|
|
PUSH_IMAGES: "true"
|
2017-07-12 17:18:35 +00:00
|
|
|
STAGING_API_ENDPOINT: https://api.resinstaging.io
|
|
|
|
PRODUCTION_API_ENDPOINT: https://api.resin.io
|
2017-07-07 21:54:11 +00:00
|
|
|
i386:
|
|
|
|
<<: *defaults
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME: travisciresin
|
|
|
|
ARCH: i386
|
2017-07-10 15:53:31 +00:00
|
|
|
PUSH_IMAGES: "true"
|
2017-07-12 17:18:35 +00:00
|
|
|
STAGING_API_ENDPOINT: https://api.resinstaging.io
|
|
|
|
PRODUCTION_API_ENDPOINT: https://api.resin.io
|
2017-07-10 15:53:31 +00:00
|
|
|
armel:
|
|
|
|
<<: *defaults
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME: travisciresin
|
|
|
|
ARCH: armel
|
|
|
|
PUSH_IMAGES: "true"
|
2017-07-12 17:18:35 +00:00
|
|
|
STAGING_API_ENDPOINT: https://api.resinstaging.io
|
|
|
|
PRODUCTION_API_ENDPOINT: https://api.resin.io
|
2017-07-10 15:53:31 +00:00
|
|
|
armv7hf:
|
|
|
|
<<: *defaults
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME: travisciresin
|
|
|
|
ARCH: armv7hf
|
|
|
|
PUSH_IMAGES: "true"
|
2017-07-12 17:18:35 +00:00
|
|
|
STAGING_API_ENDPOINT: https://api.resinstaging.io
|
|
|
|
PRODUCTION_API_ENDPOINT: https://api.resin.io
|
2017-07-10 15:53:31 +00:00
|
|
|
aarch64:
|
|
|
|
<<: *defaults
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME: travisciresin
|
|
|
|
ARCH: aarch64
|
|
|
|
PUSH_IMAGES: "true"
|
2017-07-12 17:18:35 +00:00
|
|
|
STAGING_API_ENDPOINT: https://api.resinstaging.io
|
|
|
|
PRODUCTION_API_ENDPOINT: https://api.resin.io
|
2017-07-10 15:53:31 +00:00
|
|
|
rpi:
|
|
|
|
<<: *defaults
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME: travisciresin
|
|
|
|
ARCH: rpi
|
|
|
|
PUSH_IMAGES: "true"
|
2017-07-12 17:18:35 +00:00
|
|
|
STAGING_API_ENDPOINT: https://api.resinstaging.io
|
|
|
|
PRODUCTION_API_ENDPOINT: https://api.resin.io
|
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:
|
|
|
|
- amd64
|
|
|
|
- i386
|
2017-07-12 17:18:35 +00:00
|
|
|
- rpi
|
|
|
|
- armv7hf
|
|
|
|
- aarch64
|