|
|
|
stages:
|
|
|
|
- codequality
|
|
|
|
- build
|
|
|
|
- deploy
|
|
|
|
|
|
|
|
build:
|
|
|
|
stage: build
|
|
|
|
image: python:2.7
|
|
|
|
before_script:
|
|
|
|
- pip install -U platformio
|
|
|
|
- platformio update
|
|
|
|
script:
|
|
|
|
- platformio ci --project-conf platformio.ini --board=lolin_d32_pro --build-dir build --keep-build-dir
|
|
|
|
# - cp ~/.platformio/packages/framework-arduinoespressif32/tools/sdk/bin/bootloader_dio_40m.bin build/.pio/build/lolin_d32_pro/
|
|
|
|
# - cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/default.bin build/.pio/build/lolin_d32_pro/
|
|
|
|
variables: {PLATFORMIO_CI_SRC: "src"}
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- build/.pio/build/lolin_d32_pro/*.bin
|
|
|
|
|
|
|
|
codequality:
|
|
|
|
stage: codequality
|
|
|
|
image: docker:latest
|
|
|
|
variables:
|
|
|
|
DOCKER_DRIVER: overlay
|
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
script:
|
|
|
|
- docker pull codeclimate/codeclimate
|
|
|
|
- docker run --env CODECLIMATE_CODE="$PWD" --volume "$PWD":/code --volume /var/run/docker.sock:/var/run/docker.sock --volume /tmp/cc:/tmp/cc codeclimate/codeclimate init
|
|
|
|
- docker run --env CODECLIMATE_CODE="$PWD" --volume "$PWD":/code --volume /var/run/docker.sock:/var/run/docker.sock --volume /tmp/cc:/tmp/cc codeclimate/codeclimate analyze -f json > codeclimate.json
|
|
|
|
artifacts:
|
|
|
|
paths: [codeclimate.json]
|
|
|
|
|
|
|
|
deploy:
|
|
|
|
stage: deploy
|
|
|
|
image: alpine:latest
|
|
|
|
before_script:
|
|
|
|
- apk update && apk add openssh-client bash rsync
|
|
|
|
# - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
|
|
|
- eval $(ssh-agent -s)
|
|
|
|
- echo "${SSH_PRIVATE_KEY}" | tr -d '\r' | ssh-add - > /dev/null
|
|
|
|
- mkdir -p ~/.ssh
|
|
|
|
- chmod 700 ~/.ssh
|
|
|
|
- echo "${SSH_HOST_KEY}" > ~/.ssh/known_hosts
|
|
|
|
- chmod 644 ~/.ssh/known_hosts
|
|
|
|
script:
|
|
|
|
- scp build/.pio/build/lolin_d32_pro/firmware.bin "${SSH_USER_HOST}:${DEPLOY_PATH}"
|
|
|
|
dependencies:
|
|
|
|
- build
|
|
|
|
when: manual
|
|
|
|
only:
|
|
|
|
- master
|