Skip to content

ci: use jobs in travis-ci.yml, use Github API key when accessing the API #5474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 92 additions & 62 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,73 +6,103 @@ cache:
directories:
- $HOME/astyle

matrix:
stages:
- build
- deploy

jobs:
include:
- env:
- 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
# 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

install:
- >
[ "$BUILD_TYPE" = "docs" ] && {
pip install --user -r doc/requirements.txt;
} || true
- >
[ "$BUILD_TYPE" = "style_check" ] && {
[ -f $HOME/astyle/build/gcc/bin/astyle ] || {
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;
tar -xf astyle_3.1_linux.tar.gz -C $HOME;
make -C $HOME/astyle/build/gcc;
}
make -C $HOME/astyle/build/gcc prefix=$HOME install;
} || true
- sudo apt-get install valgrind lcov
- name: "Docs"
script: $TRAVIS_BUILD_DIR/tests/common.sh
env:
- BUILD_TYPE=docs
install:
- pip install --user -r doc/requirements.txt;

script:
- $TRAVIS_BUILD_DIR/tests/common.sh
- name: "Style check"
script: $TRAVIS_BUILD_DIR/tests/common.sh
env:
- BUILD_TYPE=style_check
install:
- >
[ "$BUILD_TYPE" = "style_check" ] && {
[ -f $HOME/astyle/build/gcc/bin/astyle ] || {
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;
tar -xf astyle_3.1_linux.tar.gz -C $HOME;
make -C $HOME/astyle/build/gcc;
}
make -C $HOME/astyle/build/gcc prefix=$HOME install;
} || true

deploy:
- provider: releases
draft: true
skip_cleanup: true
api_key:
secure: A4FBmqyhlzy33oPeZVolg2Q/A3ZcJ3WnRQqQJ3NAPy+qGM5xcboOYtwcLL9vKaHZGfUB7lUP9QVZFGou1Wrmo9DnPvAoe3+XvCaDRGzVMxeIpu7UStbBD4Knbh98tlbMvZCXYRlT4VcusI9bMLK6UWw4sMdPislBh2FEfglTiag=
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
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:
email:
Expand Down
10 changes: 7 additions & 3 deletions package/build_boards_manager_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ else
plain_ver=$ver
fi

# 'set -e' breaks CI but not local tests
#set -e
set -e

package_name=esp8266-$ver
echo "Version: $ver"
Expand Down Expand Up @@ -134,8 +133,13 @@ fi
cat $srcdir/package/package_esp8266com_index.template.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
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)
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)
Expand Down