1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-07 16:23:38 +03:00

ci: use travis jobs to structure the CI flow

This mostly re-phrases the existing flow using the new language.

Ref. https://blog.travis-ci.com/2017-05-11-introducing-build-stages
This commit is contained in:
Ivan Grokhotkov 2018-12-11 18:37:24 +08:00 committed by Ivan Grokhotkov
parent 47d6f83f5f
commit 9c1e03a1f9
2 changed files with 99 additions and 65 deletions

View File

@ -6,73 +6,103 @@ cache:
directories: directories:
- $HOME/astyle - $HOME/astyle
matrix: stages:
- build
- deploy
jobs:
include: include:
- env: # Build stage. To save time, run all kinds of builds and tests in parallel.
- BUILD_TYPE=package #
- env: # TODO: since we can now call different script for each job,
- BUILD_TYPE=build_even # split the do-it-all common.sh into separate scripts responsible
- env: # for different types of jobs below:
- BUILD_TYPE=build_odd - name: "Host tests"
- env: stage: build
- BUILD_TYPE=debug_even script: $TRAVIS_BUILD_DIR/tests/common.sh
- env: env:
- BUILD_TYPE=debug_odd - BUILD_TYPE=host_tests
- env: install:
- BUILD_TYPE=platformio_even - sudo apt-get install valgrind lcov
- env:
- BUILD_TYPE=platformio_odd
- env:
- BUILD_TYPE=docs
- env:
- BUILD_TYPE=host_tests
- env:
- BUILD_TYPE=style_check
install: - name: "Build (1)"
- > script: $TRAVIS_BUILD_DIR/tests/common.sh
[ "$BUILD_TYPE" = "docs" ] && { env:
pip install --user -r doc/requirements.txt; - BUILD_TYPE=build_even
} || true - name: "Build (2)"
- > script: $TRAVIS_BUILD_DIR/tests/common.sh
[ "$BUILD_TYPE" = "style_check" ] && { env:
[ -f $HOME/astyle/build/gcc/bin/astyle ] || { - BUILD_TYPE=build_odd
wget -O astyle_3.1_linux.tar.gz https://sourceforge.net/projects/astyle/files/astyle/astyle%203.1/astyle_3.1_linux.tar.gz/download; - name: "Debug (1)"
tar -xf astyle_3.1_linux.tar.gz -C $HOME; script: $TRAVIS_BUILD_DIR/tests/common.sh
make -C $HOME/astyle/build/gcc; env:
} - BUILD_TYPE=debug_even
make -C $HOME/astyle/build/gcc prefix=$HOME install; - name: "Debug (2)"
} || true script: $TRAVIS_BUILD_DIR/tests/common.sh
- sudo apt-get install valgrind lcov env:
- BUILD_TYPE=debug_odd
- name: "Platformio (1)"
script: $TRAVIS_BUILD_DIR/tests/common.sh
env:
- BUILD_TYPE=platformio_even
- name: "Platformio (2)"
script: $TRAVIS_BUILD_DIR/tests/common.sh
env:
- BUILD_TYPE=platformio_odd
script: - name: "Docs"
- $TRAVIS_BUILD_DIR/tests/common.sh script: $TRAVIS_BUILD_DIR/tests/common.sh
env:
- BUILD_TYPE=docs
install:
- pip install --user -r doc/requirements.txt;
deploy: - name: "Style check"
- provider: releases script: $TRAVIS_BUILD_DIR/tests/common.sh
draft: true env:
skip_cleanup: true - BUILD_TYPE=style_check
api_key: install:
secure: A4FBmqyhlzy33oPeZVolg2Q/A3ZcJ3WnRQqQJ3NAPy+qGM5xcboOYtwcLL9vKaHZGfUB7lUP9QVZFGou1Wrmo9DnPvAoe3+XvCaDRGzVMxeIpu7UStbBD4Knbh98tlbMvZCXYRlT4VcusI9bMLK6UWw4sMdPislBh2FEfglTiag= - >
file_glob: true [ "$BUILD_TYPE" = "style_check" ] && {
tag_name: $TRAVIS_TAG [ -f $HOME/astyle/build/gcc/bin/astyle ] || {
target_commitish: $TRAVIS_COMMIT wget -O astyle_3.1_linux.tar.gz https://sourceforge.net/projects/astyle/files/astyle/astyle%203.1/astyle_3.1_linux.tar.gz/download;
file: tar -xf astyle_3.1_linux.tar.gz -C $HOME;
- package/versions/$TRAVIS_TAG/esp8266-$TRAVIS_TAG.zip make -C $HOME/astyle/build/gcc;
- package/versions/$TRAVIS_TAG/package_esp8266com_index.json }
on: make -C $HOME/astyle/build/gcc prefix=$HOME install;
repo: esp8266/Arduino } || true
tags: true
condition: "$BUILD_TYPE = package"
- provider: script
skip_cleanup: true
script: bash package/deploy_package_index.sh
on:
repo: esp8266/Arduino
tags: true
condition: "$BUILD_TYPE = package"
# Deploy stage.
# Here we build the package JSON (always) and do the deployments
- name: "Package / deploy"
stage: deploy
script: $TRAVIS_BUILD_DIR/tests/common.sh
env: BUILD_TYPE=package
if: env(CI_GITHUB_API_KEY) IS present
deploy:
# Create Github release, upload artifacts
- provider: releases
draft: true
skip_cleanup: true
api_key:
secure: kYsxX/N21fwLSTLpbb0c96PnQHn1CIMqZstm02hfUhCX83FygWSh4vs3gzW28DMpjQMZ6vC4g+jtfosYU2tUhht/bynurDH4edpEyGeMyK+fzCI9pAr4JT0RbKQI84EC18ScpgP/UP0jTc1LJ+xl8UMwSiDE0mzHx7xJ4mMNQbA=
file_glob: true
tag_name: $TRAVIS_TAG
target_commitish: $TRAVIS_COMMIT
file:
- package/versions/$TRAVIS_TAG/esp8266-$TRAVIS_TAG.zip
- package/versions/$TRAVIS_TAG/package_esp8266com_index.json
on:
repo: esp8266/Arduino
tags: true
# Update the package index URL to point to the new version
- provider: script
skip_cleanup: true
script: bash package/deploy_package_index.sh
on:
repo: esp8266/Arduino
tags: true
notifications: notifications:
email: email:

View File

@ -18,8 +18,7 @@ else
plain_ver=$ver plain_ver=$ver
fi fi
# 'set -e' breaks CI but not local tests set -e
#set -e
package_name=esp8266-$ver package_name=esp8266-$ver
echo "Version: $ver" echo "Version: $ver"
@ -134,8 +133,13 @@ fi
cat $srcdir/package/package_esp8266com_index.template.json | \ cat $srcdir/package/package_esp8266com_index.template.json | \
jq "$jq_arg" > package_esp8266com_index.json jq "$jq_arg" > package_esp8266com_index.json
# Use Github API token, if available
curl_gh_token_arg=()
if [ ! -z "$CI_GITHUB_API_KEY" ]; then
curl_gh_token_arg=(-H "Authorization: token $CI_GITHUB_API_KEY")
fi
# Get previous release name # Get previous release name
curl --silent https://api.github.com/repos/esp8266/Arduino/releases > releases.json curl --silent "${curl_gh_token_arg[@]}" https://api.github.com/repos/esp8266/Arduino/releases > releases.json
# Previous final release (prerelase == false) # Previous final release (prerelase == false)
prev_release=$(jq -r '. | map(select(.draft == false and .prerelease == false)) | sort_by(.created_at | - fromdateiso8601) | .[0].tag_name' releases.json) prev_release=$(jq -r '. | map(select(.draft == false and .prerelease == false)) | sort_by(.created_at | - fromdateiso8601) | .[0].tag_name' releases.json)
# Previous release (possibly a pre-release) # Previous release (possibly a pre-release)