Skip to content

Commit ff118a8

Browse files
committed
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
1 parent 47d6f83 commit ff118a8

File tree

1 file changed

+86
-62
lines changed

1 file changed

+86
-62
lines changed

.travis.yml

Lines changed: 86 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -6,73 +6,97 @@ cache:
66
directories:
77
- $HOME/astyle
88

9-
matrix:
9+
stages:
10+
- build
11+
- deploy
12+
13+
jobs:
1014
include:
11-
- env:
12-
- BUILD_TYPE=package
13-
- env:
14-
- BUILD_TYPE=build_even
15-
- env:
16-
- BUILD_TYPE=build_odd
17-
- env:
18-
- BUILD_TYPE=debug_even
19-
- env:
20-
- BUILD_TYPE=debug_odd
21-
- env:
22-
- BUILD_TYPE=platformio_even
23-
- env:
24-
- BUILD_TYPE=platformio_odd
25-
- env:
26-
- BUILD_TYPE=docs
27-
- env:
28-
- BUILD_TYPE=host_tests
29-
- env:
30-
- BUILD_TYPE=style_check
15+
- stage: build
16+
# Build stage. To save time, run all kinds of builds and tests in parallel.
17+
#
18+
# TODO: since we can now call different script for each job,
19+
# split the do-it-all common.sh into separate scripts responsible
20+
# for different types of jobs below:
21+
- name: "Build (1)"
22+
env:
23+
- BUILD_TYPE=build_even
24+
- name: "Build (2)"
25+
env:
26+
- BUILD_TYPE=build_odd
27+
- name: "Debug (1)"
28+
env:
29+
- BUILD_TYPE=debug_even
30+
- name: "Debug (2)"
31+
env:
32+
- BUILD_TYPE=debug_odd
33+
- name: "Platformio (1)"
34+
env:
35+
- BUILD_TYPE=platformio_even
36+
- name: "Platformio (2)"
37+
env:
38+
- BUILD_TYPE=platformio_odd
3139

32-
install:
33-
- >
34-
[ "$BUILD_TYPE" = "docs" ] && {
35-
pip install --user -r doc/requirements.txt;
36-
} || true
37-
- >
38-
[ "$BUILD_TYPE" = "style_check" ] && {
39-
[ -f $HOME/astyle/build/gcc/bin/astyle ] || {
40-
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;
41-
tar -xf astyle_3.1_linux.tar.gz -C $HOME;
42-
make -C $HOME/astyle/build/gcc;
43-
}
44-
make -C $HOME/astyle/build/gcc prefix=$HOME install;
45-
} || true
46-
- sudo apt-get install valgrind lcov
40+
- name: "Docs"
41+
env:
42+
- BUILD_TYPE=docs
43+
install:
44+
- pip install --user -r doc/requirements.txt;
4745

48-
script:
49-
- $TRAVIS_BUILD_DIR/tests/common.sh
46+
- name: "Host tests"
47+
env:
48+
- BUILD_TYPE=host_tests
49+
install:
50+
- sudo apt-get install valgrind lcov
51+
52+
- name: "Style check"
53+
env:
54+
- BUILD_TYPE=style_check
55+
install:
56+
- >
57+
[ "$BUILD_TYPE" = "style_check" ] && {
58+
[ -f $HOME/astyle/build/gcc/bin/astyle ] || {
59+
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;
60+
tar -xf astyle_3.1_linux.tar.gz -C $HOME;
61+
make -C $HOME/astyle/build/gcc;
62+
}
63+
make -C $HOME/astyle/build/gcc prefix=$HOME install;
64+
} || true
5065
51-
deploy:
52-
- provider: releases
53-
draft: true
54-
skip_cleanup: true
55-
api_key:
56-
secure: A4FBmqyhlzy33oPeZVolg2Q/A3ZcJ3WnRQqQJ3NAPy+qGM5xcboOYtwcLL9vKaHZGfUB7lUP9QVZFGou1Wrmo9DnPvAoe3+XvCaDRGzVMxeIpu7UStbBD4Knbh98tlbMvZCXYRlT4VcusI9bMLK6UWw4sMdPislBh2FEfglTiag=
57-
file_glob: true
58-
tag_name: $TRAVIS_TAG
59-
target_commitish: $TRAVIS_COMMIT
60-
file:
61-
- package/versions/$TRAVIS_TAG/esp8266-$TRAVIS_TAG.zip
62-
- package/versions/$TRAVIS_TAG/package_esp8266com_index.json
63-
on:
64-
repo: esp8266/Arduino
65-
tags: true
66-
condition: "$BUILD_TYPE = package"
67-
68-
- provider: script
69-
skip_cleanup: true
70-
script: bash package/deploy_package_index.sh
71-
on:
72-
repo: esp8266/Arduino
73-
tags: true
74-
condition: "$BUILD_TYPE = package"
66+
# Deploy stage.
67+
# Here we build the package JSON (always) and do the deployments
68+
- stage: deploy
69+
if: env(TRAVIS_SECURE_ENV_VARS) = true
70+
env: BUILD_TYPE=package
71+
script: $TRAVIS_BUILD_DIR/tests/common.sh
72+
deploy:
73+
# Create Github release, upload artifacts
74+
- provider: releases
75+
draft: true
76+
skip_cleanup: true
77+
api_key:
78+
secure: kYsxX/N21fwLSTLpbb0c96PnQHn1CIMqZstm02hfUhCX83FygWSh4vs3gzW28DMpjQMZ6vC4g+jtfosYU2tUhht/bynurDH4edpEyGeMyK+fzCI9pAr4JT0RbKQI84EC18ScpgP/UP0jTc1LJ+xl8UMwSiDE0mzHx7xJ4mMNQbA=
79+
file_glob: true
80+
tag_name: $TRAVIS_TAG
81+
target_commitish: $TRAVIS_COMMIT
82+
file:
83+
- package/versions/$TRAVIS_TAG/esp8266-$TRAVIS_TAG.zip
84+
- package/versions/$TRAVIS_TAG/package_esp8266com_index.json
85+
on:
86+
repo: esp8266/Arduino
87+
tags: true
7588

89+
# Update the package index URL to point to the new version
90+
- provider: script
91+
skip_cleanup: true
92+
script: bash package/deploy_package_index.sh
93+
on:
94+
repo: esp8266/Arduino
95+
tags: true
96+
97+
# This is to catch jobs which accidentally don't specify the script to run
98+
script:
99+
- false
76100

77101
notifications:
78102
email:

0 commit comments

Comments
 (0)