farmbot_os/.circleci/config.yml

886 lines
30 KiB
YAML
Raw Normal View History

2017-12-13 12:11:00 -07:00
version: 2.0
defaults: &defaults
2018-11-23 11:25:14 -07:00
working_directory: /nerves/build
2017-12-13 12:11:00 -07:00
docker:
- image: nervesproject/nerves_system_br:1.7.2
2017-12-11 20:28:35 -07:00
2017-12-13 12:11:00 -07:00
install_elixir: &install_elixir
run:
name: Install Elixir
command: |
2019-07-12 11:58:50 -06:00
wget https://github.com/elixir-lang/elixir/releases/download/v1.9.0/Precompiled.zip
2017-12-13 12:11:00 -07:00
unzip -d /usr/local/elixir Precompiled.zip
echo 'export PATH=/usr/local/elixir/bin:$PATH' >> $BASH_ENV
2017-12-11 20:28:35 -07:00
2018-01-03 17:09:13 -07:00
install_hex_archives: &install_hex_archives
run:
name: Install archives
2018-01-03 17:10:34 -07:00
command: |
2018-01-26 10:23:56 -07:00
cd /tmp
2018-01-03 17:10:34 -07:00
mix local.hex --force
mix local.rebar --force
mix archive.install hex nerves_bootstrap "~> 1.2" --force
2018-01-03 17:09:13 -07:00
2018-01-05 11:46:58 -07:00
install_arduino: &install_arduino
2018-01-05 11:48:19 -07:00
run:
name: Run setup script
command: bash .circleci/setup-arduino.sh
2018-01-05 11:46:58 -07:00
install_slack_helpers: &install_slack_helpers
run:
name: Install Slack Helpers
command: |
wget https://gist.githubusercontent.com/ConnorRigby/03e722be4be70f8588f5ed74420e4eaa/raw/28a51d8f52ec7d569e8f7f20b83349816ddf63cf/slack_message.ex
cp .circleci/fwup_meta_slack.sh /usr/bin/
2018-11-21 17:20:11 -07:00
install_ghr: &install_ghr
run:
name: Install ghr (Github Releases)
command: |
wget https://github.com/tcnksm/ghr/releases/download/v0.9.0/ghr_v0.9.0_linux_amd64.tar.gz
tar xf ghr_v0.9.0_linux_amd64.tar.gz
ln -sf ghr_v0.9.0_linux_amd64/ghr .
install_jq: &install_jq
run:
name: Install jq
command: |
wget https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
chmod +x ./jq-linux64
mv ./jq-linux64 /usr/bin/jq
2018-11-21 17:20:11 -07:00
2018-12-17 14:54:10 -07:00
build_firmware_steps: &build_firmware_steps
2018-12-13 09:54:50 -07:00
steps:
- checkout
- run: git submodule update --init --recursive
- run:
name: Setup ENV
command: |
2019-01-25 10:49:52 -07:00
echo "$MIX_TARGET" > MIX_TARGET
echo "$MIX_ENV" > MIX_ENV
2018-11-23 11:25:14 -07:00
- restore_cache:
key: v13-fbos-{{ checksum "MIX_TARGET" }}-{{ checksum "MIX_ENV" }}-dependency-cache-{{ checksum "farmbot_os/mix.lock" }}
2018-11-23 11:25:14 -07:00
- restore_cache:
key: v13-fbos-host-test-dependency-cache-{{ checksum "farmbot_os/mix.lock" }}
2018-12-13 09:54:50 -07:00
- <<: *install_elixir
- <<: *install_hex_archives
- run:
name: Build Farmbot OS Firmware
2018-11-23 11:25:14 -07:00
working_directory: /nerves/build/farmbot_os
2018-12-13 09:54:50 -07:00
command: |
mix deps.get
mix compile --force
mix firmware
- run:
name: Create artifact dir
command: mkdir -p /nerves/deploy/system/artifacts
- run:
name: Create artifacts
command: |
2019-04-09 15:11:45 -06:00
cp /nerves/build/farmbot_os/_build/${MIX_TARGET}/${MIX_TARGET}_${MIX_ENV}/nerves/images/farmbot.fw /nerves/deploy/system/artifacts/farmbot-${MIX_TARGET}-$(cat VERSION).fw
2018-12-13 09:54:50 -07:00
- save_cache:
key: v13-fbos-{{ checksum "MIX_TARGET" }}-{{ checksum "MIX_ENV" }}-dependency-cache-{{ checksum "farmbot_os/mix.lock" }}
2018-12-13 09:54:50 -07:00
paths:
2018-11-23 11:25:14 -07:00
- /nerves/build/farmbot_os/_build/
- /nerves/build/farmbot_os/deps/
2018-12-13 09:54:50 -07:00
- ~/.nerves/
- save_cache:
2018-12-17 14:54:10 -07:00
key: nerves/deploy/system-{{ checksum "MIX_TARGET" }}-{{ .Branch }}-{{ .Revision }}-{{ .Environment.CIRCLE_TAG }}
2018-12-13 09:54:50 -07:00
paths:
- "/nerves/deploy/system"
2018-12-17 14:54:10 -07:00
deploy_nerves_hub_firmware_steps: &deploy_nerves_hub_firmware_steps
steps:
- checkout
- run: git submodule update --init --recursive
2018-12-13 09:54:50 -07:00
- run:
2018-12-17 14:54:10 -07:00
name: Setup ENV
command: |
2019-01-25 10:49:52 -07:00
echo "$MIX_TARGET" > MIX_TARGET
echo "$MIX_ENV" > MIX_ENV
2018-12-17 14:54:10 -07:00
- restore_cache:
key: v13-fbos-{{ checksum "MIX_TARGET" }}-{{ checksum "MIX_ENV" }}-dependency-cache-{{ checksum "farmbot_os/mix.lock" }}
2018-12-17 14:54:10 -07:00
- restore_cache:
key: nerves/deploy/system-{{ checksum "MIX_TARGET" }}-{{ .Branch }}-{{ .Revision }}-{{ .Environment.CIRCLE_TAG }}
- <<: *install_elixir
- <<: *install_hex_archives
- <<: *install_jq
- <<: *install_slack_helpers
2018-12-13 09:54:50 -07:00
- run:
name: Sign Image
2018-11-23 11:25:14 -07:00
working_directory: /nerves/build/farmbot_os
2019-04-09 15:11:45 -06:00
command: mix nerves_hub.firmware sign --key notreal /nerves/deploy/system/artifacts/farmbot-${MIX_TARGET}-$(cat ../VERSION).fw
2018-12-13 09:54:50 -07:00
- run:
name: Publish to NervesHub
2018-11-23 11:25:14 -07:00
working_directory: /nerves/build/farmbot_os
2019-04-09 15:11:45 -06:00
command: mix nerves_hub.firmware publish --deploy ${NERVES_HUB_DEPLOY} ${NERVES_HUB_TTL} /nerves/deploy/system/artifacts/farmbot-${MIX_TARGET}-$(cat ../VERSION).fw
- run:
name: Send Slack Message
command: ./.circleci/fwup_meta_slack.sh -i /nerves/deploy/system/artifacts/farmbot-${MIX_TARGET}-$(cat VERSION).fw
2018-12-13 09:54:50 -07:00
2017-12-13 12:11:00 -07:00
jobs:
2018-11-23 15:37:05 -07:00
################################################################################
# TEST #
################################################################################
2018-11-23 11:25:14 -07:00
test_farmbot_celery_script:
<<: *defaults
environment:
MIX_ENV: test
MIX_TARGET: host
NERVES_LOG_DISABLE_PROGRESS_BAR: "yes"
2019-01-25 10:49:52 -07:00
ELIXIR_VERSION: 1.8.0
2018-11-23 11:25:14 -07:00
steps:
- checkout
- restore_cache:
keys:
- v13-fbcs-test-dependency-cache-{{ checksum "farmbot_celery_script/mix.lock" }}
2018-11-23 11:25:14 -07:00
- <<: *install_elixir
- <<: *install_hex_archives
- run:
name: Test Farmbot CeleryScript
working_directory: /nerves/build/farmbot_celery_script
command: |
mix deps.get
mix compile
mix format --check-formatted
2019-05-07 12:33:37 -06:00
mix coveralls.json
2018-11-23 11:25:14 -07:00
- save_cache:
key: v13-fbcs-test-dependency-cache-{{ checksum "farmbot_celery_script/mix.lock" }}
2018-11-23 11:25:14 -07:00
paths:
- farmbot_celery_script/_build/test
- farmbot_celery_script/deps
2019-05-21 10:54:27 -06:00
- save_cache:
key: v13-fbcs-coverage-cache-{{ .Branch }}-{{ .Revision }}
2019-05-21 10:54:27 -06:00
paths:
2019-05-07 12:33:37 -06:00
- farmbot_celery_script/cover
2019-05-21 10:54:27 -06:00
- store_artifacts:
path: farmbot_celery_script/cover
2018-11-23 11:25:14 -07:00
test_farmbot_firmware:
2017-12-13 12:11:00 -07:00
<<: *defaults
2017-12-31 18:42:26 -07:00
environment:
MIX_ENV: test
2018-01-03 16:48:16 -07:00
MIX_TARGET: host
2018-11-23 11:25:14 -07:00
NERVES_LOG_DISABLE_PROGRESS_BAR: "yes"
2019-01-25 10:49:52 -07:00
ELIXIR_VERSION: 1.8.0
2018-11-23 11:25:14 -07:00
steps:
- checkout
- restore_cache:
keys:
- v13-fbfw-test-dependency-cache-{{ checksum "farmbot_firmware/mix.lock" }}
2018-11-23 11:25:14 -07:00
- <<: *install_elixir
- <<: *install_hex_archives
- run:
name: Test Farmbot Firmware
working_directory: /nerves/build/farmbot_firmware
command: |
mix deps.get
mix compile
mix format --check-formatted
2019-05-07 12:33:37 -06:00
mix coveralls.json
2018-11-23 11:25:14 -07:00
- save_cache:
key: v13-fbfw-test-dependency-cache-{{ checksum "farmbot_firmware/mix.lock" }}
2018-11-23 11:25:14 -07:00
paths:
- farmbot_firmware/_build/test
- farmbot_firmware/deps
2019-05-21 10:54:27 -06:00
- save_cache:
key: v13-fbfw-coverage-cache-{{ .Branch }}-{{ .Revision }}
2019-05-21 10:54:27 -06:00
paths:
2019-05-07 12:33:37 -06:00
- farmbot_firmware/cover
2019-05-21 10:54:27 -06:00
- store_artifacts:
path: farmbot_firmware/cover
2018-11-23 11:25:14 -07:00
test_farmbot_core:
<<: *defaults
environment:
MIX_ENV: test
MIX_TARGET: host
NERVES_LOG_DISABLE_PROGRESS_BAR: "yes"
2019-01-25 10:49:52 -07:00
ELIXIR_VERSION: 1.8.0
2018-11-23 11:25:14 -07:00
TZ: "America/Los_Angeles"
2017-12-11 20:28:35 -07:00
steps:
2018-01-05 12:35:47 -07:00
- checkout
2018-01-05 12:27:12 -07:00
- run: git submodule update --init --recursive
2018-01-05 12:11:12 -07:00
- restore_cache:
2018-11-23 11:25:14 -07:00
keys:
- v13-fbcore-test-dependency-cache-{{ checksum "farmbot_core/mix.lock" }}
2018-11-23 11:25:14 -07:00
- restore_cache:
keys:
- v13-fbcore-test-arduino-dependency-cache-{{ checksum ".circleci/setup-arduino.sh" }}
2018-11-23 11:25:14 -07:00
- <<: *install_elixir
- <<: *install_hex_archives
- <<: *install_arduino
- run:
name: Ensure format
command: |
mix format --check-formatted
- run:
name: Test Farmbot Core
working_directory: /nerves/build/farmbot_core
command: |
mix deps.get
mix compile
mix format --check-formatted
2019-05-07 12:33:37 -06:00
mix coveralls.json --trace
2018-11-23 11:25:14 -07:00
- save_cache:
key: v13-fbcore-test-dependency-cache-{{ checksum "farmbot_core/mix.lock" }}
2018-11-23 11:25:14 -07:00
paths:
- farmbot_core/_build/test
- farmbot_core/deps
- farmbot_core/arduino
2019-05-21 10:54:27 -06:00
- save_cache:
key: v13-fbcore-coverage-cache-{{ .Branch }}-{{ .Revision }}
2019-05-21 10:54:27 -06:00
paths:
2019-05-07 12:33:37 -06:00
- farmbot_core/cover
2019-05-21 10:54:27 -06:00
- store_artifacts:
path: farmbot_core/cover
2018-11-23 11:25:14 -07:00
- save_cache:
key: v13-fbcore-test-arduino-dependency-cache-{{ checksum ".circleci/setup-arduino.sh" }}
2018-11-23 11:25:14 -07:00
paths:
- ~/arduino-1.8.5
- farmbot_core/_build/core
- farmbot_core/_build/libraries
- farmbot_core/_build/farmduino_k14
- farmbot_core/_build/farmduino_v10
- farmbot_core/_build/ramps_v14
test_farmbot_ext:
<<: *defaults
environment:
MIX_ENV: test
MIX_TARGET: host
NERVES_LOG_DISABLE_PROGRESS_BAR: "yes"
2019-01-25 10:49:52 -07:00
ELIXIR_VERSION: 1.8.0
2018-11-23 11:25:14 -07:00
SKIP_ARDUINO_BUILD: 1
steps:
- checkout
- run: git submodule update --init --recursive
- restore_cache:
keys:
- v13-fbext-test-dependency-cache-{{ checksum "farmbot_ext/mix.lock" }}
2018-11-23 11:25:14 -07:00
- <<: *install_elixir
- <<: *install_hex_archives
- run:
name: Test Farmbot Ext
working_directory: /nerves/build/farmbot_ext
command: |
mix deps.get
mix compile
mix format --check-formatted
mix ecto.create
mix ecto.migrate
2019-05-07 12:33:37 -06:00
mix coveralls.json
2018-11-23 11:25:14 -07:00
- save_cache:
key: v13-fbext-test-dependency-cache-{{ checksum "farmbot_ext/mix.lock" }}
2018-11-23 11:25:14 -07:00
paths:
- farmbot_ext/_build/test
- farmbot_ext/deps
2019-05-21 10:54:27 -06:00
- save_cache:
key: v13-fbext-coverage-cache-{{ .Branch }}-{{ .Revision }}
2019-05-21 10:54:27 -06:00
paths:
2019-05-07 12:33:37 -06:00
- farmbot_ext/cover
2019-05-21 10:54:27 -06:00
- store_artifacts:
path: farmbot_ext/cover
2018-11-23 11:25:14 -07:00
test_farmbot_os:
<<: *defaults
environment:
MIX_ENV: test
MIX_TARGET: host
NERVES_LOG_DISABLE_PROGRESS_BAR: "yes"
2019-01-25 10:49:52 -07:00
ELIXIR_VERSION: 1.8.0
2018-11-23 11:25:14 -07:00
steps:
- checkout
- run: git submodule update --init --recursive
- restore_cache:
2019-05-07 12:33:37 -06:00
keys:
- v13-fbos-host-test-dependency-cache-{{ checksum "farmbot_os/mix.lock" }}
2018-11-21 17:20:11 -07:00
- <<: *install_elixir
2018-01-03 17:09:13 -07:00
- <<: *install_hex_archives
2018-11-21 17:20:11 -07:00
- run:
name: Test Farmbot OS
2018-11-23 11:25:14 -07:00
working_directory: /nerves/build/farmbot_os
2018-11-21 17:20:11 -07:00
command: |
mix deps.get
mix compile
2018-11-23 11:25:14 -07:00
mix format --check-formatted
2019-05-07 12:33:37 -06:00
mix coveralls.json
- save_cache:
key: v13-fbos-host-test-dependency-cache-{{ checksum "farmbot_os/mix.lock" }}
2018-11-23 11:25:14 -07:00
paths:
- farmbot_os/_build/host
- farmbot_os/deps/host
2019-05-21 10:54:27 -06:00
- save_cache:
key: v13-fbos-coverage-cache-{{ .Branch }}-{{ .Revision }}
2019-05-21 10:54:27 -06:00
paths:
2019-05-07 12:33:37 -06:00
- farmbot_os/cover
2019-05-21 10:54:27 -06:00
- store_artifacts:
path: farmbot_os/cover
2019-05-07 12:33:37 -06:00
report_coverage:
<<: *defaults
environment:
MIX_ENV: test
MIX_TARGET: host
NERVES_LOG_DISABLE_PROGRESS_BAR: "yes"
ELIXIR_VERSION: 1.8.0
steps:
- checkout
- run: git submodule update --init --recursive
- <<: *install_elixir
- <<: *install_hex_archives
- restore_cache:
keys:
- v13-fbsupport-test-dependency-cache-{{ checksum "mix.lock" }}
2019-05-21 10:54:27 -06:00
- restore_cache:
2019-05-07 12:33:37 -06:00
keys:
- v13-fbcs-coverage-cache-{{ .Branch }}-{{ .Revision }}
2019-05-21 10:54:27 -06:00
- restore_cache:
keys:
- v13-fbcs-coverage-cache-{{ .Branch }}-{{ .Revision }}
2019-05-21 10:54:27 -06:00
- restore_cache:
keys:
- v13-fbfw-coverage-cache-{{ .Branch }}-{{ .Revision }}
2019-05-21 10:54:27 -06:00
- restore_cache:
keys:
- v13-fbcore-coverage-cache-{{ .Branch }}-{{ .Revision }}
2019-05-21 10:54:27 -06:00
- restore_cache:
keys:
- v13-fbext-coverage-cache-{{ .Branch }}-{{ .Revision }}
2019-05-21 10:54:27 -06:00
- restore_cache:
keys:
- v13-fbos-coverage-cache-{{ .Branch }}-{{ .Revision }}
2019-05-07 12:33:37 -06:00
- run:
name: Report Coverage
working_directory: /nerves/build/
command: |
mix deps.get
mix compile
mix format --check-formatted
mix farmbot.coveralls circle
- save_cache:
key: v13-fbsupport-test-dependency-cache-{{ checksum "mix.lock" }}
2019-05-07 12:33:37 -06:00
paths:
- deps/
- _build
2018-11-23 15:37:05 -07:00
2018-12-17 14:54:10 -07:00
################################################################################
# target=rpi app_env=prod #
################################################################################
build_rpi_prod:
<<: *defaults
environment:
MIX_TARGET: rpi
MIX_ENV: prod
<<: *build_firmware_steps
################################################################################
# target=rpi3 app_env=prod #
################################################################################
build_rpi3_prod:
<<: *defaults
environment:
MIX_TARGET: rpi3
MIX_ENV: prod
<<: *build_firmware_steps
################################################################################
# target=rpi app_env=prod channel=stable #
################################################################################
deploy_rpi_prod_stable:
2017-12-13 12:11:00 -07:00
<<: *defaults
2017-12-13 11:51:27 -07:00
environment:
2018-11-23 15:37:05 -07:00
MIX_TARGET: rpi
2018-01-03 16:48:16 -07:00
MIX_ENV: prod
2018-12-13 09:54:50 -07:00
NERVES_HUB_DEPLOY: rpi-prod-stable
2018-12-17 14:54:10 -07:00
<<: *deploy_nerves_hub_firmware_steps
################################################################################
# target=rpi3 app_env=prod channel=stable #
################################################################################
2018-11-23 15:37:05 -07:00
2018-12-17 14:54:10 -07:00
deploy_rpi3_prod_stable:
2018-11-23 15:37:05 -07:00
<<: *defaults
environment:
2018-12-13 09:54:50 -07:00
MIX_TARGET: rpi3
MIX_ENV: prod
NERVES_HUB_DEPLOY: rpi3-prod-stable
2018-12-17 14:54:10 -07:00
<<: *deploy_nerves_hub_firmware_steps
2018-11-23 15:37:05 -07:00
2018-12-17 14:54:10 -07:00
################################################################################
# target=rpi app_env=prod channel=beta #
################################################################################
deploy_rpi_prod_beta:
2018-11-21 17:20:11 -07:00
<<: *defaults
environment:
2018-12-13 09:54:50 -07:00
MIX_TARGET: rpi
MIX_ENV: prod
NERVES_HUB_DEPLOY: rpi-prod-beta
NERVES_HUB_TTL: "--ttl 3600"
2018-12-17 14:54:10 -07:00
<<: *deploy_nerves_hub_firmware_steps
2018-11-23 15:37:05 -07:00
2018-12-17 14:54:10 -07:00
################################################################################
# target=rpi3 app_env=prod channel=beta #
################################################################################
deploy_rpi3_prod_beta:
2018-11-23 15:37:05 -07:00
<<: *defaults
environment:
2018-12-13 09:54:50 -07:00
MIX_TARGET: rpi3
MIX_ENV: prod
NERVES_HUB_DEPLOY: rpi3-prod-beta
NERVES_HUB_TTL: "--ttl 3600"
2018-12-17 14:54:10 -07:00
<<: *deploy_nerves_hub_firmware_steps
2018-11-23 15:37:05 -07:00
2018-12-17 14:54:10 -07:00
################################################################################
# target=rpi app_env=prod channel=staging #
################################################################################
deploy_rpi_prod_staging:
2018-11-21 17:20:11 -07:00
<<: *defaults
environment:
2018-12-13 09:54:50 -07:00
MIX_TARGET: rpi
MIX_ENV: prod
NERVES_HUB_DEPLOY: rpi-prod-staging
NERVES_HUB_TTL: "--ttl 3600"
2018-12-17 14:54:10 -07:00
<<: *deploy_nerves_hub_firmware_steps
2018-11-23 15:37:05 -07:00
2018-12-17 14:54:10 -07:00
################################################################################
# target=rpi3 app_env=prod channel=staging #
################################################################################
deploy_rpi3_prod_staging:
2018-01-03 11:56:52 -07:00
<<: *defaults
2018-11-21 17:20:11 -07:00
environment:
2018-12-13 09:54:50 -07:00
MIX_TARGET: rpi3
MIX_ENV: prod
NERVES_HUB_DEPLOY: rpi3-prod-staging
NERVES_HUB_TTL: "--ttl 3600"
2018-12-17 14:54:10 -07:00
<<: *deploy_nerves_hub_firmware_steps
2018-11-23 15:37:05 -07:00
2018-12-10 10:35:47 -07:00
################################################################################
# target=rpi app_env=prod channel=next #
################################################################################
deploy_rpi_prod_next:
<<: *defaults
environment:
MIX_TARGET: rpi
MIX_ENV: prod
NERVES_HUB_DEPLOY: rpi-prod-next
NERVES_HUB_TTL: "--ttl 3600"
<<: *deploy_nerves_hub_firmware_steps
################################################################################
# target=rpi3 app_env=prod channel=next #
################################################################################
deploy_rpi3_prod_next:
<<: *defaults
environment:
MIX_TARGET: rpi3
MIX_ENV: prod
NERVES_HUB_DEPLOY: rpi3-prod-next
NERVES_HUB_TTL: "--ttl 3600"
<<: *deploy_nerves_hub_firmware_steps
2018-11-23 15:37:05 -07:00
################################################################################
# TARGET FIRMWARE NERVES GITHUB RELEASE BETA #
################################################################################
publish_prod_firmware_beta_release:
<<: *defaults
environment:
MIX_ENV: prod
2019-01-25 10:49:52 -07:00
ELIXIR_VERSION: 1.8.0
2018-11-23 15:37:05 -07:00
steps:
- checkout
2018-12-13 09:54:50 -07:00
- run:
name: Setup ENV
command: |
echo rpi3 > MIX_TARGET_RPI3
echo rpi > MIX_TARGET_RPI
2019-02-08 10:17:22 -07:00
echo $MIX_ENV > MIX_ENV
2018-11-23 15:37:05 -07:00
- restore_cache:
2018-12-17 14:54:10 -07:00
key: nerves/deploy/system-{{ checksum "MIX_TARGET_RPI3" }}-{{ .Branch }}-{{ .Revision }}-{{ .Environment.CIRCLE_TAG }}
- restore_cache:
key: nerves/deploy/system-{{ checksum "MIX_TARGET_RPI" }}-{{ .Branch }}-{{ .Revision }}-{{ .Environment.CIRCLE_TAG }}
2018-05-09 15:25:41 -06:00
- <<: *install_elixir
2018-11-21 17:20:11 -07:00
- <<: *install_hex_archives
- <<: *install_ghr
- <<: *install_slack_helpers
2018-11-21 17:20:11 -07:00
- <<: *install_jq
2018-01-04 10:18:46 -07:00
- add_ssh_keys:
fingerprints:
- "97:92:32:5d:d7:96:e1:fa:f3:6b:f3:bd:d6:aa:84:c6"
- run: grep -Pazo "(?s)(?<=# $(cat VERSION | cut -f1 -d"-"))[^#]+" CHANGELOG.md > RELEASE_NOTES
2018-11-23 15:37:05 -07:00
- run: echo $FWUP_KEY_BASE64 | base64 --decode --ignore-garbage > $NERVES_FW_PRIV_KEY
2018-01-03 11:56:52 -07:00
- run:
2018-11-23 15:37:05 -07:00
name: Sign rpi3 Firmware
2018-01-03 11:57:59 -07:00
command: |
2018-11-23 15:37:05 -07:00
mv /nerves/deploy/system/artifacts/farmbot-rpi3-$(cat VERSION).fw /tmp/farmbot-rpi3-$(cat VERSION).fw
fwup -S -s $NERVES_FW_PRIV_KEY -i /tmp/farmbot-rpi3-$(cat VERSION).fw -o /nerves/deploy/system/artifacts/farmbot-rpi3-$(cat VERSION).fw
fwup -a -t complete -i /nerves/deploy/system/artifacts/farmbot-rpi3-$(cat VERSION).fw -d /nerves/deploy/system/artifacts/farmbot-rpi3-$(cat VERSION).img
sha256sum /nerves/deploy/system/artifacts/farmbot-rpi3-$(cat VERSION).img > /nerves/deploy/system/artifacts/farmbot-rpi3-$(cat VERSION).sha256
- run:
name: Sign rpi Firmware
command: |
mv /nerves/deploy/system/artifacts/farmbot-rpi-$(cat VERSION).fw /tmp/farmbot-rpi-$(cat VERSION).fw
fwup -S -s $NERVES_FW_PRIV_KEY -i /tmp/farmbot-rpi-$(cat VERSION).fw -o /nerves/deploy/system/artifacts/farmbot-rpi-$(cat VERSION).fw
fwup -a -t complete -i /nerves/deploy/system/artifacts/farmbot-rpi-$(cat VERSION).fw -d /nerves/deploy/system/artifacts/farmbot-rpi-$(cat VERSION).img
sha256sum /nerves/deploy/system/artifacts/farmbot-rpi-$(cat VERSION).img > /nerves/deploy/system/artifacts/farmbot-rpi-$(cat VERSION).sha256
2018-01-03 11:56:52 -07:00
- run:
2018-11-21 17:20:11 -07:00
name: Publish Github Release
command: ./ghr -t $GITHUB_TOKEN -u farmbot -r farmbot_os -prerelease -recreate -prerelease -b "$(cat RELEASE_NOTES)" -c $(git rev-parse --verify HEAD) "v$(cat VERSION)" /nerves/deploy/system/artifacts/
2018-01-04 10:19:38 -07:00
- run:
2019-01-02 14:18:04 -07:00
name: Slack message
2018-01-04 10:18:46 -07:00
command: |
export OTA_URL=$(wget https://api.github.com/repos/farmbot/farmbot_os/releases -qO- | jq '.[0].url' | sed -e 's/^"//' -e 's/"$//')
2018-05-09 15:35:54 -06:00
export SLACK_MESSAGE="New Farmbot Beta: $OTA_URL"
elixir slack_message.ex $SLACK_MESSAGE
2018-11-23 15:37:05 -07:00
################################################################################
# TARGET FIRMWARE NERVES GITHUB RELEASE MASTER #
################################################################################
publish_prod_firmware_master_release:
<<: *defaults
environment:
MIX_ENV: prod
2019-01-25 10:49:52 -07:00
ELIXIR_VERSION: 1.8.0
steps:
- checkout
2018-12-13 09:54:50 -07:00
- run:
name: Setup ENV
command: |
echo rpi3 > MIX_TARGET_RPI3
echo rpi > MIX_TARGET_RPI
2019-02-08 10:17:22 -07:00
echo $MIX_ENV > MIX_ENV
- restore_cache:
2018-12-18 15:36:42 -07:00
key: nerves/deploy/system-{{ checksum "MIX_TARGET_RPI3" }}-{{ .Branch }}-{{ .Revision }}-{{ .Environment.CIRCLE_TAG }}
- restore_cache:
key: nerves/deploy/system-{{ checksum "MIX_TARGET_RPI" }}-{{ .Branch }}-{{ .Revision }}-{{ .Environment.CIRCLE_TAG }}
2018-11-21 17:20:11 -07:00
- <<: *install_elixir
- <<: *install_hex_archives
- <<: *install_ghr
- <<: *install_slack_helpers
- add_ssh_keys:
fingerprints:
- "97:92:32:5d:d7:96:e1:fa:f3:6b:f3:bd:d6:aa:84:c6"
2018-11-23 15:37:05 -07:00
- run: grep -Pazo "(?s)(?<=# $(cat VERSION))[^#]+" CHANGELOG.md > RELEASE_NOTES
- run: echo $FWUP_KEY_BASE64 | base64 --decode --ignore-garbage > $NERVES_FW_PRIV_KEY
- run:
2018-11-23 15:37:05 -07:00
name: Sign rpi3 Firmware and create image
command: |
2018-11-23 15:37:05 -07:00
mv /nerves/deploy/system/artifacts/farmbot-rpi3-$(cat VERSION).fw /tmp/farmbot-rpi3-$(cat VERSION).fw
fwup -S -s $NERVES_FW_PRIV_KEY -i /tmp/farmbot-rpi3-$(cat VERSION).fw -o /nerves/deploy/system/artifacts/farmbot-rpi3-$(cat VERSION).fw
2018-12-18 15:44:58 -07:00
fwup -a -t complete -i /nerves/deploy/system/artifacts/farmbot-rpi3-$(cat VERSION).fw -d /nerves/deploy/system/artifacts/farmbot-rpi3-$(cat VERSION).img
sha256sum /nerves/deploy/system/artifacts/farmbot-rpi3-$(cat VERSION).img > /nerves/deploy/system/artifacts/farmbot-rpi3-$(cat VERSION).sha256
- run:
name: Sign rpi Firmware and create image
command: |
mv /nerves/deploy/system/artifacts/farmbot-rpi-$(cat VERSION).fw /tmp/farmbot-rpi-$(cat VERSION).fw
fwup -S -s $NERVES_FW_PRIV_KEY -i /tmp/farmbot-rpi-$(cat VERSION).fw -o /nerves/deploy/system/artifacts/farmbot-rpi-$(cat VERSION).fw
fwup -a -t complete -i /nerves/deploy/system/artifacts/farmbot-rpi-$(cat VERSION).fw -d /nerves/deploy/system/artifacts/farmbot-rpi-$(cat VERSION).img
sha256sum /nerves/deploy/system/artifacts/farmbot-rpi-$(cat VERSION).img > /nerves/deploy/system/artifacts/farmbot-rpi-$(cat VERSION).sha256
- run:
2018-11-21 17:20:11 -07:00
name: Publish Github Release
2018-12-18 15:44:58 -07:00
command: ./ghr -t $GITHUB_TOKEN -u farmbot -r farmbot_os -recreate -prerelease -draft -delete -b "$(cat RELEASE_NOTES)" -c $(git rev-parse --verify HEAD) "v$(cat VERSION)" /nerves/deploy/system/artifacts
2018-11-21 17:20:11 -07:00
- run:
name: Send Slack Message
command: elixir slack_message.ex "New Farmbot Prod release $(cat VERSION)"
2018-11-23 15:37:05 -07:00
2017-12-13 11:51:27 -07:00
workflows:
version: 2
2018-11-21 17:20:11 -07:00
test:
2017-12-13 11:51:27 -07:00
jobs:
2018-11-23 11:25:14 -07:00
- test_farmbot_celery_script:
2017-12-13 12:11:00 -07:00
context: org-global
2018-01-03 10:28:48 -07:00
filters:
branches:
ignore:
2018-11-23 11:25:14 -07:00
- master
- staging
- beta
2018-11-23 11:25:14 -07:00
- next
- test_farmbot_firmware:
context: org-global
filters:
branches:
ignore:
- master
2018-11-21 17:20:11 -07:00
- staging
2018-11-23 11:25:14 -07:00
- beta
- next
- test_farmbot_core:
context: org-global
filters:
branches:
ignore:
- master
- staging
- beta
- next
- test_farmbot_ext:
context: org-global
filters:
branches:
ignore:
- master
- staging
- beta
- next
- test_farmbot_os:
context: org-global
filters:
branches:
ignore:
- master
- staging
- beta
- next
2019-05-07 12:33:37 -06:00
- report_coverage:
context: org-global
requires:
- test_farmbot_celery_script
- test_farmbot_firmware
- test_farmbot_core
- test_farmbot_ext
- test_farmbot_os
filters:
branches:
ignore:
- master
- staging
- beta
- next
2018-11-23 11:25:14 -07:00
2018-12-13 09:54:50 -07:00
# master branch to staging.farmbot.io
nerves_hub_prod_stable_staging:
2018-11-21 17:20:11 -07:00
jobs:
- build_rpi_prod:
context: farmbot-staging
filters:
branches:
only:
- master
2018-12-17 14:54:10 -07:00
- build_rpi3_prod:
2018-12-13 09:54:50 -07:00
context: farmbot-staging
2018-11-23 15:37:05 -07:00
filters:
branches:
only:
- master
- deploy_rpi_prod_stable:
context: farmbot-staging
requires:
- build_rpi_prod
2018-12-17 14:54:10 -07:00
- deploy_rpi3_prod_stable:
context: farmbot-staging
requires:
- build_rpi3_prod
2018-11-23 15:37:05 -07:00
2018-12-13 09:54:50 -07:00
# master branch to my.farmbot.io
nerves_hub_prod_stable_production:
jobs:
- build_rpi_prod:
context: farmbot-production
filters:
branches:
only:
- master
2018-12-17 14:54:10 -07:00
- build_rpi3_prod:
2018-11-23 15:37:05 -07:00
context: farmbot-production
filters:
branches:
only:
- master
- deploy_rpi_prod_stable:
context: farmbot-production
requires:
- build_rpi_prod
2018-12-17 14:54:10 -07:00
- deploy_rpi3_prod_stable:
context: farmbot-production
requires:
- build_rpi3_prod
2018-11-23 15:37:05 -07:00
- publish_prod_firmware_master_release:
2017-12-13 12:11:00 -07:00
context: org-global
2018-01-03 16:48:16 -07:00
requires:
- build_rpi_prod
2018-12-17 14:54:10 -07:00
- build_rpi3_prod
2018-11-23 15:37:05 -07:00
# any tag containint an `-rcXXX` tag to staging.farmbot.io
2018-12-13 09:54:50 -07:00
nerves_hub_prod_beta_staging:
2018-11-21 17:20:11 -07:00
jobs:
- build_rpi_prod:
context: farmbot-staging
filters:
branches:
ignore: /.*/
tags:
only: /v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)-rc(0|[1-9]\d*)+?/
2018-12-17 14:54:10 -07:00
- build_rpi3_prod:
2018-12-13 09:54:50 -07:00
context: farmbot-staging
2018-11-23 15:37:05 -07:00
filters:
branches:
ignore: /.*/
tags:
only: /v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)-rc(0|[1-9]\d*)+?/
- deploy_rpi_prod_beta:
context: farmbot-staging
filters:
branches:
ignore: /.*/
tags:
only: /v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)-rc(0|[1-9]\d*)+?/
requires:
- build_rpi_prod
2018-12-17 14:54:10 -07:00
- deploy_rpi3_prod_beta:
context: farmbot-staging
filters:
branches:
ignore: /.*/
tags:
only: /v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)-rc(0|[1-9]\d*)+?/
2018-12-17 14:54:10 -07:00
requires:
- build_rpi3_prod
2018-11-23 15:37:05 -07:00
# any tag containint an `-rcXXX` tag to my.farmbot.io
2018-12-13 09:54:50 -07:00
nerves_hub_prod_beta_production:
jobs:
- build_rpi_prod:
context: farmbot-production
filters:
branches:
ignore: /.*/
tags:
only: /v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)-rc(0|[1-9]\d*)+?/
2018-12-17 14:54:10 -07:00
- build_rpi3_prod:
2018-11-23 15:37:05 -07:00
context: farmbot-production
filters:
branches:
ignore: /.*/
tags:
only: /v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)-rc(0|[1-9]\d*)+?/
- deploy_rpi_prod_beta:
context: farmbot-production
filters:
branches:
ignore: /.*/
tags:
only: /v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)-rc(0|[1-9]\d*)+?/
requires:
- build_rpi_prod
2018-12-17 14:54:10 -07:00
- deploy_rpi3_prod_beta:
context: farmbot-production
filters:
branches:
ignore: /.*/
tags:
only: /v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)-rc(0|[1-9]\d*)+?/
2018-12-17 14:54:10 -07:00
requires:
- build_rpi3_prod
2018-11-23 15:37:05 -07:00
- publish_prod_firmware_beta_release:
2018-01-03 11:56:52 -07:00
context: org-global
filters:
branches:
ignore: /.*/
tags:
only: /v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)-rc(0|[1-9]\d*)+?/
2018-11-23 11:25:14 -07:00
requires:
# - build_rpi_prod
2018-11-23 11:25:14 -07:00
- build_rpi3_prod
# next branch to staging.farmbot.io
deploy_staging_next:
jobs:
- test_farmbot_celery_script:
context: org-global
filters:
branches:
only:
- next
- test_farmbot_firmware:
context: org-global
filters:
branches:
only:
- next
- test_farmbot_core:
context: org-global
filters:
branches:
only:
- next
- test_farmbot_ext:
context: org-global
filters:
branches:
only:
- next
- test_farmbot_os:
context: org-global
filters:
branches:
only:
- next
2019-05-07 12:33:37 -06:00
- report_coverage:
context: org-global
requires:
- test_farmbot_celery_script
- test_farmbot_firmware
- test_farmbot_core
- test_farmbot_ext
- test_farmbot_os
2018-11-23 11:25:14 -07:00
- build_rpi3_prod:
context: farmbot-staging
filters:
branches:
only:
- next
requires:
- test_farmbot_celery_script
- test_farmbot_firmware
- test_farmbot_core
- test_farmbot_ext
- test_farmbot_os
- build_rpi_prod:
context: farmbot-staging
filters:
branches:
only:
- next
requires:
- test_farmbot_celery_script
- test_farmbot_firmware
- test_farmbot_core
- test_farmbot_ext
- test_farmbot_os
2018-11-23 11:25:14 -07:00
2018-12-10 10:35:47 -07:00
- deploy_rpi3_prod_next:
2018-11-23 11:25:14 -07:00
context: farmbot-staging
filters:
branches:
only:
- next
requires:
- build_rpi3_prod
2019-05-07 12:33:37 -06:00
- report_coverage
2018-11-23 11:25:14 -07:00
- deploy_rpi_prod_next:
context: farmbot-staging
filters:
branches:
only:
- next
requires:
- build_rpi_prod
- report_coverage