Wetterstation v2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
3.1 KiB

stages:
- test
- 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: test
# image: docker:stable
# variables:
# DOCKER_DRIVER: overlay2
# allow_failure: true
# services:
# - docker:stable-dind
# script:
# - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
# - docker run
# --env SOURCE_CODE="$PWD"
# --volume "$PWD":/code
# --volume /var/run/docker.sock:/var/run/docker.sock
# "registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
# artifacts:
# reports:
# codequality: gl-code-quality-report.json
static_analysis:
stage: test
image: debian:testing
allow_failure: true
before_script:
- apt -q update
- apt install -qy build-essential
- apt install -qy cppcheck
- apt install -qy clang-format clang-tidy
- apt install -qy python-pip
- pip install -U platformio
- pio init --ide atom
- pip install cppcheck-junit
- mkdir -p build
- pip install junit2html
script:
- script/build_compile_commands.py
- cppcheck --error-exitcode=1 --enable=all --check-config --project=compile_commands.json src 2>&1 | tee build/cppcheck-err.txt
- cppcheck --xml --enable=all --check-config --project=compile_commands.json src 2> build/cppcheck-result.xml
- run-clang-tidy -fix -export-fixes=build/clang-tidy-fixes.yml src
after_script:
- cppcheck_junit build/cppcheck-result.xml build/cppcheck-junit.xml
- cat "build/clang-tidy-fixes.yml" | script/clang-tidy-to-junit.py src >"build/clang-tidy-junit.xml"
- junit2html --summary-matrix build/clang-tidy-junit.xml
- junit2html --summary-matrix build/cppcheck-junit.xml
artifacts:
reports:
junit:
- build/clang-tidy-junit.xml
- build/cppcheck-junit.xml
paths:
- build/clang-tidy-junit.xml.html
- build/cppcheck-junit.xml.html
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}"
- scp build/.pio/build/lolin_d32_pro/build.version "${SSH_USER_HOST}:${DEPLOY_PATH}".version
dependencies:
- build
when: manual
only:
- master