Browse Source

Restore WebUI builds in travis (#1953)

* test: restore webui builds in travis

* show build.sh usage via -h, exclude build stage instead of explicitly including it
master
Max Prokhorov 5 years ago
committed by GitHub
parent
commit
a2ada68d6e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 89 additions and 20 deletions
  1. +6
    -8
      .travis.yml
  2. +46
    -8
      code/build.sh
  3. +27
    -0
      travis_install.sh
  4. +10
    -4
      travis_script.sh

+ 6
- 8
.travis.yml View File

@ -6,10 +6,7 @@ cache:
- "~/.npm" - "~/.npm"
- "~/.platformio" - "~/.platformio"
install: install:
- pip install -U platformio
- pio platform update -p
- npm install -g npm@latest
- cd code && npm ci && cd ..
- ./travis_install.sh
env: env:
global: global:
- BUILDER_TOTAL_THREADS=4 - BUILDER_TOTAL_THREADS=4
@ -23,10 +20,11 @@ stages:
if: tag IS present AND tag =~ ^\d+\.\d+\.\d+$ if: tag IS present AND tag =~ ^\d+\.\d+\.\d+$
jobs: jobs:
include: include:
- stage: Test
env: BUILDER_ENV=travis-2_3_0
- env: BUILDER_ENV=travis-latest
- env: BUILDER_ENV=travis-git BUILDER_EXTRA="-a test/build/extra/secure_client.h"
- stage: Test WebUI
- stage: Test PlatformIO Build
env: TEST_ENV=travis-2_3_0
- env: TEST_ENV=travis-latest
- env: TEST_ENV=travis-git TEST_EXTRA_ARGS="-a test/build/extra/secure_client.h"
- stage: Release - stage: Release
env: BUILDER_THREAD=0 env: BUILDER_THREAD=0
- env: BUILDER_THREAD=1 - env: BUILDER_THREAD=1


+ 46
- 8
code/build.sh View File

@ -21,6 +21,8 @@ stat_bytes() {
destination=../firmware destination=../firmware
version_file=espurna/config/version.h version_file=espurna/config/version.h
version=$(grep -E '^#define APP_VERSION' $version_file | awk '{print $3}' | sed 's/"//g') version=$(grep -E '^#define APP_VERSION' $version_file | awk '{print $3}' | sed 's/"//g')
script_build_environments=true
script_build_webui=true
if ${TRAVIS:-false}; then if ${TRAVIS:-false}; then
git_revision=${TRAVIS_COMMIT::7} git_revision=${TRAVIS_COMMIT::7}
@ -133,8 +135,36 @@ build_environments() {
} }
# Parameters # Parameters
while getopts "lpd:" opt; do
print_getopts_help() {
cat <<EOF
Usage: $(basename "$0") [OPTION] <ENVIRONMENT>...
Where ENVIRONMENT is environment name(s) from platformio.ini
Options:
-f VALUE Filter build stage by name to skip it
Supported VALUEs are "environments" and "webui"
Can be specified multiple times
-l Print available environments
-d VALUE Destination to move .bin files after building environments
-p Enable parallel build
Depends on following exported variables:
BUILDER_THREAD=<number> (default 0...4)
BUILDER_TOTAL_THREADS=<number> (default 4)
When building platformio environments, will only pick every <BUILDER_THREAD>th
-h Display this message
EOF
}
while getopts "f:lpd:h" opt; do
case $opt in case $opt in
f)
case "$OPTARG" in
webui) script_build_webui=false ;;
environments) script_build_environments=false ;;
esac
;;
l) l)
print_available print_available
exit exit
@ -145,6 +175,9 @@ while getopts "lpd:" opt; do
d) d)
destination=$OPTARG destination=$OPTARG
;; ;;
h)
print_getopts_help
exit
esac esac
done done
@ -158,13 +191,18 @@ echo "Building for version ${version}" ${git_revision:+($git_revision)}
# Environments to build # Environments to build
environments=$@ environments=$@
if [ $# -eq 0 ]; then
set_default_environments
if $script_build_webui ; then
build_webui
fi fi
if ${CI:-false}; then
print_environments
fi
if $script_build_environments ; then
if [ $# -eq 0 ]; then
set_default_environments
fi
if ${CI:-false}; then
print_environments
fi
build_webui
build_environments
build_environments
fi

+ 27
- 0
travis_install.sh View File

@ -0,0 +1,27 @@
#!/bin/bash
set -x -e -v
npm_install() {
npm install -g npm@latest
npm ci
}
pio_install() {
pip install -U platformio
pio platform update -p
}
cd code
if [ "${TRAVIS_BUILD_STAGE_NAME}" = "Test webui" ]; then
npm_install
elif [ "${TRAVIS_BUILD_STAGE_NAME}" = "Test platformio build" ]; then
pio_install
elif [ "${TRAVIS_BUILD_STAGE_NAME}" = "Release" ]; then
npm_install
pio_install
else
echo -e "\e[1;33mUnknown stage name, exiting!\e[0m"
exit 1
fi

+ 10
- 4
travis_script.sh View File

@ -1,11 +1,17 @@
#!/bin/bash #!/bin/bash
set -e -v
set -x -e -v
cd code cd code
if [ ${TRAVIS_BUILD_STAGE_NAME} = "Test" ]; then
scripts/test_build.py -e $BUILDER_ENV $BUILDER_EXTRA
else
if [ "${TRAVIS_BUILD_STAGE_NAME}" = "Test webui" ]; then
./build.sh -f environments
elif [ "${TRAVIS_BUILD_STAGE_NAME}" = "Test platformio build" ]; then
# shellcheck disable=SC2086
scripts/test_build.py -e "$TEST_ENV" $TEST_EXTRA_ARGS
elif [ "${TRAVIS_BUILD_STAGE_NAME}" = "Release" ]; then
./build.sh -p ./build.sh -p
else
echo -e "\e[1;33mUnknown stage name, exiting!\e[0m"
exit 1
fi fi

Loading…
Cancel
Save