farmbot_os/.circleci/config.yml

120 lines
3.4 KiB
YAML
Raw Normal View History

2017-12-13 12:11:00 -07:00
version: 2.0
defaults: &defaults
docker:
- image: nervesproject/nerves:0.13.5
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: |
2017-12-31 18:36:28 -07:00
wget https://github.com/elixir-lang/elixir/releases/download/v1.5.1/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
2017-12-13 12:11:00 -07:00
jobs:
test:
<<: *defaults
2017-12-31 18:42:26 -07:00
environment:
MIX_ENV: test
2017-12-11 20:28:35 -07:00
steps:
- checkout
2017-12-11 20:43:47 -07:00
- <<: *install_elixir
2017-12-31 18:31:37 -07:00
- restore_cache:
keys:
- v3-dependency-cache-{{ checksum "mix.lock.host" }}
- v3-dependency-cache
- run: mix local.hex --force
- run: mix local.rebar --force
- run: mix archive.install hex nerves_bootstrap --force
- run: mix deps.get
- run: mix deps.compile
- run: mix compile
- save_cache:
key: v3-dependency-cache-{{ checksum "mix.lock.host" }}
paths:
- _build
- deps
- ~/.mix
2017-12-31 18:42:26 -07:00
- ~/.nerves
2017-12-13 12:11:00 -07:00
- run:
2017-12-31 18:31:37 -07:00
command: mix coveralls.circle
2017-12-11 20:28:35 -07:00
2017-12-13 11:51:27 -07:00
firmware:
2017-12-13 12:11:00 -07:00
<<: *defaults
2017-12-13 11:51:27 -07:00
environment:
MIX_TARGET: rpi3
2017-12-13 12:22:30 -07:00
ENV: CI
2017-12-13 11:51:27 -07:00
steps:
2017-12-13 12:11:00 -07:00
- checkout
- <<: *install_elixir
2017-12-31 18:31:37 -07:00
- restore_cache:
keys:
2017-12-31 18:47:21 -07:00
- v3-dependency-cache-{{ checksum "mix.lock.rpi3" }}
2017-12-31 18:31:37 -07:00
- v3-dependency-cache
- run: mix local.hex --force
- run: mix local.rebar --force
2017-12-31 18:38:06 -07:00
- run: mix archive.install hex nerves_bootstrap --force
2017-12-31 18:31:37 -07:00
- run: mix deps.get
- run: mix deps.compile
- run: mix compile
2017-12-31 18:58:49 -07:00
- run:
command: mix firmware
2017-12-31 18:31:37 -07:00
- save_cache:
2017-12-31 18:47:21 -07:00
key: v3-dependency-cache-{{ checksum "mix.lock.rpi3" }}
2017-12-31 18:31:37 -07:00
paths:
- _build
- deps
- ~/.mix
2017-12-31 18:42:26 -07:00
- ~/.nerves
2017-12-13 12:11:00 -07:00
- run:
command: mix firmware.slack --channels C58DCU4A3
2018-01-03 11:56:52 -07:00
- run:
command: fwup --sign --private-key $NERVES_FW_PRIV_KEY -i _build/{{ .Environment.MIX_TARGET }}/{{ .Environment.MIX_ENV }}/nerves/images/farmbot.fw -o farmbot-v{{ .Environment.Revision }}.fw
- save_cache:
key: v3-firmware-{{ .Revision }}-{{ .Environment.CIRCLE_TAG }}
paths:
- farmbot-v{{ .Environment.Revision }}.fw
deploy_firmware:
<<: *defaults
steps:
- run:
name: Install dependencies
command: |
wget https://github.com/tcnksm/ghr/releases/download/v0.5.4/ghr_v0.5.4_linux_amd64.zip
unzip ghr_v0.5.4_linux_amd64.zip
- run:
command: grep -Pazo "(?s)(?<=## ${CIRCLE_TAG})[^#]+" CHANGELOG.md > RELEASE_NOTES
- restore_cache:
key: v3-firmware-{{ .Revision }}-{{ .Environment.CIRCLE_TAG }}
- run:
command: ./ghr -draft -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME -b "$(cat RELEASE_NOTES)" -replace $CIRCLE_TAG farmbot-v{{ .Environment.Revision }}.fw
2017-12-13 11:51:27 -07:00
workflows:
version: 2
2017-12-13 12:11:00 -07:00
test_firmware_upload:
2017-12-13 11:51:27 -07:00
jobs:
- test:
2017-12-13 12:11:00 -07:00
context: org-global
2018-01-03 10:28:48 -07:00
filters:
branches:
ignore: nightly
2017-12-13 11:51:27 -07:00
- firmware:
2017-12-13 12:11:00 -07:00
context: org-global
2018-01-03 10:28:48 -07:00
filters:
2018-01-03 10:32:04 -07:00
branches:
2018-01-03 10:29:45 -07:00
ignore: nightly
2018-01-03 10:32:04 -07:00
2018-01-03 10:16:00 -07:00
deploy_nightly:
jobs:
2018-01-03 10:16:59 -07:00
- firmware:
2018-01-03 10:10:17 -07:00
context: org-global
filters:
branches:
only: nightly
2018-01-03 11:56:52 -07:00
- deploy_firmware:
context: org-global
filters:
branches:
only: nightly