227 lines
5.6 KiB
YAML
227 lines
5.6 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: build
|
|
|
|
environment:
|
|
HEX_HOME: /drone/src/.hex
|
|
MIX_HOME: /drone/src/.mix
|
|
REBAR_BASE_DIR: /drone/src/.rebar3
|
|
ASDF_DATA_DIR: /drone/src/.asdf
|
|
ASDF_DIR: /root/.asdf
|
|
XDG_DATA_HOME: /drone/src/.nerves_data
|
|
NERVES_FW_PRODUCT: "Bivouac RPI4"
|
|
NERVES_FW_AUTHOR: "James Harton <james@harton.nz>"
|
|
|
|
platform:
|
|
os: linux
|
|
arch: arm64
|
|
|
|
steps:
|
|
- name: submodules
|
|
image: alpine/git
|
|
commands:
|
|
- git submodule update --init --recursive
|
|
|
|
- name: restore ASDF cache
|
|
image: meltwater/drone-cache
|
|
pull: "always"
|
|
environment:
|
|
AWS_ACCESS_KEY_ID:
|
|
from_secret: ACCESS_KEY_ID
|
|
AWS_SECRET_ACCESS_KEY:
|
|
from_secret: SECRET_ACCESS_KEY
|
|
AWS_PLUGIN_PATH_STYLE: true
|
|
settings:
|
|
restore: true
|
|
endpoint:
|
|
from_secret: S3_ENDPOINT
|
|
bucket:
|
|
from_secret: CACHE_BUCKET
|
|
region: us-east-1
|
|
path-style: true
|
|
cache_key: 'asdf-{{ os }}-{{ arch }}-{{ checksum ".tool-versions" }}'
|
|
mount:
|
|
- .asdf
|
|
|
|
- name: restore build cache
|
|
image: meltwater/drone-cache
|
|
environment:
|
|
AWS_ACCESS_KEY_ID:
|
|
from_secret: ACCESS_KEY_ID
|
|
AWS_SECRET_ACCESS_KEY:
|
|
from_secret: SECRET_ACCESS_KEY
|
|
AWS_PLUGIN_PATH_STYLE: true
|
|
settings:
|
|
restore: true
|
|
endpoint:
|
|
from_secret: S3_ENDPOINT
|
|
bucket:
|
|
from_secret: CACHE_BUCKET
|
|
region: us-east-1
|
|
path-style: true
|
|
cache_key: 'elixir-{{ checksum "mix.lock" }}-{{ checksum ".tool-versions" }}'
|
|
mount:
|
|
- deps
|
|
- _build
|
|
- .hex
|
|
- .mix
|
|
- .rebar3
|
|
|
|
- name: restore nerves cache
|
|
image: meltwater/drone-cache
|
|
environment:
|
|
AWS_ACCESS_KEY_ID:
|
|
from_secret: ACCESS_KEY_ID
|
|
AWS_SECRET_ACCESS_KEY:
|
|
from_secret: SECRET_ACCESS_KEY
|
|
AWS_PLUGIN_PATH_STYLE: true
|
|
settings:
|
|
restore: true
|
|
endpoint:
|
|
from_secret: S3_ENDPOINT
|
|
bucket:
|
|
from_secret: CACHE_BUCKET
|
|
region: us-east-1
|
|
path-style: true
|
|
mount:
|
|
- .nerves
|
|
- .nerves_data
|
|
|
|
- name: install dependencies
|
|
image: code.harton.nz/james/asdf_container:latest
|
|
pull: "always"
|
|
depends_on:
|
|
- restore ASDF cache
|
|
- restore build cache
|
|
commands:
|
|
- asdf_install
|
|
- rm -rf .asdf/downloads
|
|
- . $ASDF_DIR/asdf.sh
|
|
- mix local.hex --if-missing --force
|
|
- mix local.rebar --if-missing --force
|
|
- mix archive.install hex nerves_bootstrap --force
|
|
- mix deps.get
|
|
|
|
- name: get buildroot dependencies
|
|
image: code.harton.nz/james/asdf_container:latest
|
|
depends_on:
|
|
- install dependencies
|
|
commands:
|
|
- ./deps/nerves_system_br/create-build.sh bivouac_defconfig .temp_nerves_system
|
|
- (cd .temp_nerves_system && make source)
|
|
|
|
- name: build system
|
|
image: code.harton.nz/james/asdf_container:latest
|
|
depends_on:
|
|
- get buildroot dependencies
|
|
commands:
|
|
- . $ASDF_DIR/asdf.sh
|
|
- mix compile
|
|
|
|
- name: store ASDF cache
|
|
image: meltwater/drone-cache
|
|
environment:
|
|
AWS_ACCESS_KEY_ID:
|
|
from_secret: ACCESS_KEY_ID
|
|
AWS_SECRET_ACCESS_KEY:
|
|
from_secret: SECRET_ACCESS_KEY
|
|
AWS_PLUGIN_PATH_STYLE: true
|
|
depends_on:
|
|
- install dependencies
|
|
settings:
|
|
rebuild: true
|
|
override: false
|
|
endpoint:
|
|
from_secret: S3_ENDPOINT
|
|
bucket:
|
|
from_secret: CACHE_BUCKET
|
|
region: us-east-1
|
|
path-style: true
|
|
cache_key: 'asdf-{{ os }}-{{ arch }}-{{ checksum ".tool-versions" }}'
|
|
mount:
|
|
- .asdf
|
|
|
|
- name: store build cache
|
|
image: meltwater/drone-cache
|
|
environment:
|
|
AWS_ACCESS_KEY_ID:
|
|
from_secret: ACCESS_KEY_ID
|
|
AWS_SECRET_ACCESS_KEY:
|
|
from_secret: SECRET_ACCESS_KEY
|
|
AWS_PLUGIN_PATH_STYLE: true
|
|
depends_on:
|
|
- build system
|
|
settings:
|
|
rebuild: true
|
|
override: false
|
|
endpoint:
|
|
from_secret: S3_ENDPOINT
|
|
bucket:
|
|
from_secret: CACHE_BUCKET
|
|
region: us-east-1
|
|
path-style: true
|
|
cache_key: 'elixir-{{ checksum "mix.lock" }}-{{ checksum ".tool-versions" }}'
|
|
mount:
|
|
- deps
|
|
- _build
|
|
- .hex
|
|
- .mix
|
|
- .rebar3
|
|
|
|
- name: store nerves cache
|
|
image: meltwater/drone-cache
|
|
environment:
|
|
AWS_ACCESS_KEY_ID:
|
|
from_secret: ACCESS_KEY_ID
|
|
AWS_SECRET_ACCESS_KEY:
|
|
from_secret: SECRET_ACCESS_KEY
|
|
AWS_PLUGIN_PATH_STYLE: true
|
|
depends_on:
|
|
- build system
|
|
settings:
|
|
rebuild: true
|
|
override: false
|
|
endpoint:
|
|
from_secret: S3_ENDPOINT
|
|
bucket:
|
|
from_secret: CACHE_BUCKET
|
|
region: us-east-1
|
|
path-style: true
|
|
mount:
|
|
- .nerves
|
|
- .nerves_data
|
|
|
|
- name: lint system
|
|
image: code.harton.nz/james/asdf_container:latest
|
|
depends_on:
|
|
- build system
|
|
commands:
|
|
- . $ASDF_DIR/asdf.sh
|
|
- mix nerves.system.lint bivouac_defconfig
|
|
|
|
- name: build artifacts
|
|
image: code.harton.nz/james/asdf_container:latest
|
|
depends_on:
|
|
- lint system
|
|
commands:
|
|
- . $ASDF_DIR/asdf.sh
|
|
- mkdir -p deploy/system/artifacts
|
|
- cp ./CHANGELOG.md deploy/system/CHANGELOG.md
|
|
- TAG=$${DRONE_TAG:-$$DRONE_COMMIT_SHA} mix nerves.artifact ${DRONE_REPO_NAME} --path deploy/system/artifacts
|
|
|
|
- name: gitea tag release
|
|
image: plugins/gitea-release
|
|
depends_on:
|
|
- build artifacts
|
|
when:
|
|
event:
|
|
- tag
|
|
refs:
|
|
include:
|
|
- refs/tags/v*
|
|
settings:
|
|
api_key:
|
|
from_secret: DRONE_TOKEN
|
|
base_url: https://code.harton.nz
|
|
files: deploy/system/artifacts/*
|
|
checksum: sha256
|