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,34 +6,62 @@ cache:
directories: directories:
- $HOME/astyle - $HOME/astyle
matrix: stages:
include: - build
- env: - deploy
- BUILD_TYPE=package
- env:
- BUILD_TYPE=build_even
- env:
- BUILD_TYPE=build_odd
- env:
- BUILD_TYPE=debug_even
- env:
- BUILD_TYPE=debug_odd
- env:
- BUILD_TYPE=platformio_even
- env:
- BUILD_TYPE=platformio_odd
- env:
- BUILD_TYPE=docs
- env:
- BUILD_TYPE=host_tests
- env:
- BUILD_TYPE=style_check
jobs:
include:
# Build stage. To save time, run all kinds of builds and tests in parallel.
#
# TODO: since we can now call different script for each job,
# split the do-it-all common.sh into separate scripts responsible
# for different types of jobs below:
- name: "Host tests"
stage: build
script: $TRAVIS_BUILD_DIR/tests/common.sh
env:
- BUILD_TYPE=host_tests
install:
- sudo apt-get install valgrind lcov
- name: "Build (1)"
script: $TRAVIS_BUILD_DIR/tests/common.sh
env:
- BUILD_TYPE=build_even
- name: "Build (2)"
script: $TRAVIS_BUILD_DIR/tests/common.sh
env:
- BUILD_TYPE=build_odd
- name: "Debug (1)"
script: $TRAVIS_BUILD_DIR/tests/common.sh
env:
- BUILD_TYPE=debug_even
- name: "Debug (2)"
script: $TRAVIS_BUILD_DIR/tests/common.sh
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
- name: "Docs"
script: $TRAVIS_BUILD_DIR/tests/common.sh
env:
- BUILD_TYPE=docs
install:
- pip install --user -r doc/requirements.txt;
- name: "Style check"
script: $TRAVIS_BUILD_DIR/tests/common.sh
env:
- BUILD_TYPE=style_check
install: install:
- >
[ "$BUILD_TYPE" = "docs" ] && {
pip install --user -r doc/requirements.txt;
} || true
- > - >
[ "$BUILD_TYPE" = "style_check" ] && { [ "$BUILD_TYPE" = "style_check" ] && {
[ -f $HOME/astyle/build/gcc/bin/astyle ] || { [ -f $HOME/astyle/build/gcc/bin/astyle ] || {
@ -43,17 +71,21 @@ install:
} }
make -C $HOME/astyle/build/gcc prefix=$HOME install; make -C $HOME/astyle/build/gcc prefix=$HOME install;
} || true } || true
- sudo apt-get install valgrind lcov
script:
- $TRAVIS_BUILD_DIR/tests/common.sh
# 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: deploy:
# Create Github release, upload artifacts
- provider: releases - provider: releases
draft: true draft: true
skip_cleanup: true skip_cleanup: true
api_key: api_key:
secure: A4FBmqyhlzy33oPeZVolg2Q/A3ZcJ3WnRQqQJ3NAPy+qGM5xcboOYtwcLL9vKaHZGfUB7lUP9QVZFGou1Wrmo9DnPvAoe3+XvCaDRGzVMxeIpu7UStbBD4Knbh98tlbMvZCXYRlT4VcusI9bMLK6UWw4sMdPislBh2FEfglTiag= secure: kYsxX/N21fwLSTLpbb0c96PnQHn1CIMqZstm02hfUhCX83FygWSh4vs3gzW28DMpjQMZ6vC4g+jtfosYU2tUhht/bynurDH4edpEyGeMyK+fzCI9pAr4JT0RbKQI84EC18ScpgP/UP0jTc1LJ+xl8UMwSiDE0mzHx7xJ4mMNQbA=
file_glob: true file_glob: true
tag_name: $TRAVIS_TAG tag_name: $TRAVIS_TAG
target_commitish: $TRAVIS_COMMIT target_commitish: $TRAVIS_COMMIT
@ -63,16 +95,14 @@ deploy:
on: on:
repo: esp8266/Arduino repo: esp8266/Arduino
tags: true tags: true
condition: "$BUILD_TYPE = package"
# Update the package index URL to point to the new version
- provider: script - provider: script
skip_cleanup: true skip_cleanup: true
script: bash package/deploy_package_index.sh script: bash package/deploy_package_index.sh
on: on:
repo: esp8266/Arduino repo: esp8266/Arduino
tags: true tags: true
condition: "$BUILD_TYPE = package"
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)