CircleCI: finishing touches (#3340)

* junit test results; unfortunately this seems to conflict with the verbose out

* fix deps cache: two files can change independently

* verbose print obsoleted by gtest in upsream busted
pull/3341/head
Frans de Jonge 7 years ago committed by GitHub
parent f90973f73a
commit 53c0756def

@ -6,37 +6,42 @@ source "${CI_DIR}/common.sh"
set +e set +e
echo "CIRCLE_NODE_INDEX: ${CIRCLE_NODE_INDEX}" if [ -z "${CIRCLE_PULL_REQUEST}" ] && [ "${CIRCLE_BRANCH}" = 'master' ]; then
if [ ! "$CIRCLE_NODE_INDEX" = 0 ]; then echo "CIRCLE_NODE_INDEX: ${CIRCLE_NODE_INDEX}"
echo -e "\\n${ANSI_GREEN}Not on first node. Skipping documentation update and coverage." if [ "$CIRCLE_NODE_INDEX" = 1 ]; then
elif [ -z "${CIRCLE_PULL_REQUEST}" ] && [ "${CIRCLE_BRANCH}" = 'master' ]; then echo -e "\\n${ANSI_GREEN}Checking out koreader/doc for update."
echo -e "\\n${ANSI_GREEN}Checking out koreader/doc for update." git clone git@github.com:koreader/doc.git koreader_doc
git clone git@github.com:koreader/doc.git koreader_doc
# push doc update # push doc update
pushd doc && { pushd doc && {
luajit "$(which ldoc)" . 2>/dev/null luajit "$(which ldoc)" . 2>/dev/null
if [ ! -d html ]; then if [ ! -d html ]; then
echo "Failed to generate documents..." echo "Failed to generate documents..."
exit 1 exit 1
fi fi
} && popd || exit } && popd || exit
cp -r doc/html/* koreader_doc/ cp -r doc/html/* koreader_doc/
pushd koreader_doc && { pushd koreader_doc && {
git add -A git add -A
echo -e "\\n${ANSI_GREEN}Pushing document update..." echo -e "\\n${ANSI_GREEN}Pushing document update..."
git -c user.name="KOReader build bot" -c user.email="non-reply@koreader.rocks" \ git -c user.name="KOReader build bot" -c user.email="non-reply@koreader.rocks" \
commit -a --amend -m 'Automated documentation build from travis-ci.' commit -a --amend -m 'Automated documentation build from travis-ci.'
git push -f --quiet origin gh-pages >/dev/null git push -f --quiet origin gh-pages >/dev/null
echo -e "\\n${ANSI_GREEN}Documentation update pushed." echo -e "\\n${ANSI_GREEN}Documentation update pushed."
} && popd || exit } && popd || exit
travis_retry make coverage echo -e "\\n${ANSI_GREEN}Running make testfront for timings."
pushd koreader-*/koreader && { make testfront BUSTED_OVERRIDES="--output=junit -Xoutput junit-test-results.xml"
# see https://github.com/codecov/example-lua fi
bash <(curl -s https://codecov.io/bash)
} && popd || exit if [ "$CIRCLE_NODE_INDEX" = 0 ]; then
travis_retry make coverage
pushd koreader-*/koreader && {
# see https://github.com/codecov/example-lua
bash <(curl -s https://codecov.io/bash)
} && popd || exit
fi
else else
echo -e "\\n${ANSI_GREEN}Not on official master branch. Skipping documentation update and coverage." echo -e "\\n${ANSI_GREEN}Not on official master branch. Skipping documentation update and coverage."
fi fi

@ -5,6 +5,8 @@ CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${CI_DIR}/common.sh" source "${CI_DIR}/common.sh"
pushd koreader-emulator-x86_64-linux-gnu/koreader && { pushd koreader-emulator-x86_64-linux-gnu/koreader && {
circleci tests glob "spec/front/unit/*_spec.lua" | circleci tests split --split-by=timings --timings-type=filename | xargs -I{} sh -c 'make -C ../.. testfront BUSTED_SPEC_FILE="{}" || exit 255' # the circleci command spits out newlines; we want spaces instead
} && popd BUSTED_SPEC_FILE="$(circleci tests glob "spec/front/unit/*_spec.lua" | circleci tests split --split-by=timings --timings-type=filename | tr '\n' ' ')"
#make testfront } && popd || exit
make testfront BUSTED_SPEC_FILE="${BUSTED_SPEC_FILE}"

@ -7,13 +7,13 @@ jobs:
EMULATE_READER: 1 EMULATE_READER: 1
# this is for shellcheck 0.4.5 and lower; can be removed for 0.4.6 # this is for shellcheck 0.4.5 and lower; can be removed for 0.4.6
LC_ALL: en_US.UTF8 LC_ALL: en_US.UTF8
parallelism: 3 parallelism: 2
steps: steps:
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
# binary dependencies require {{ arch }} because there are different CPUs in use on the servers # binary dependencies require {{ arch }} because there are different CPUs in use on the servers
- deps-{{ arch }}-{{ checksum ".ci/install.sh" }} - deps-{{ arch }}-{{ checksum ".ci/install.sh" }}-{{ checksum ".ci/helper_luarocks.sh" }}
# need to init some stuff first or git will complain when sticking in base cache # need to init some stuff first or git will complain when sticking in base cache
- run: git submodule init base && git submodule update base && pushd base && git submodule init && git submodule update && popd - run: git submodule init base && git submodule update base && pushd base && git submodule init && git submodule update && popd
# we can't use command output directly for cache check so we write it to git-rev-base # we can't use command output directly for cache check so we write it to git-rev-base
@ -31,7 +31,7 @@ jobs:
name: install name: install
command: .ci/install.sh command: .ci/install.sh
- save_cache: - save_cache:
key: deps-{{ arch }}-{{ checksum ".ci/install.sh" }} key: deps-{{ arch }}-{{ checksum ".ci/install.sh" }}-{{ checksum ".ci/helper_luarocks.sh" }}
paths: paths:
- "/home/ko/bin" - "/home/ko/bin"
- "/home/ko/.luarocks" - "/home/ko/.luarocks"
@ -60,7 +60,10 @@ jobs:
name: test name: test
command: .ci/test.sh command: .ci/test.sh
# docs and coverage, master branch only # docs, coverage, and test timing (can we use two outputs at once?); master branch only
- run: - run:
name: docs-and-coverage name: docs-and-coverage
command: .ci/after_success.sh command: .ci/after_success.sh
# by storing the test results CircleCI automatically distributes tests based on execution time
- store_test_results:
path: koreader-emulator-x86_64-linux-gnu/koreader/junit-test-results.xml

@ -102,7 +102,8 @@ testfront: $(INSTALL_DIR)/koreader/.busted
cd $(INSTALL_DIR)/koreader && ./luajit $(shell which busted) \ cd $(INSTALL_DIR)/koreader && ./luajit $(shell which busted) \
--sort-files \ --sort-files \
--no-auto-insulate \ --no-auto-insulate \
-o verbose_print --exclude-tags=notest $(BUSTED_SPEC_FILE) --output=gtest \
--exclude-tags=notest $(BUSTED_OVERRIDES) $(BUSTED_SPEC_FILE)
test: $(INSTALL_DIR)/koreader/.busted test: $(INSTALL_DIR)/koreader/.busted
$(MAKE) -C $(KOR_BASE) test $(MAKE) -C $(KOR_BASE) test

@ -1,22 +0,0 @@
-- from Mashape/kong/spec/busted-print.lua
local ansicolors = require 'ansicolors'
return function(options)
local handler = require 'busted.outputHandlers.utfTerminal'(options)
handler.fileStart = function(file)
io.write('\n' .. ansicolors('%{cyan}' .. file.name) .. ':')
end
handler.testStart = function(element, parent, status, debug)
io.write('\n ' .. handler.getFullName(element) .. ' ... ')
io.flush()
end
local busted = require 'busted'
busted.subscribe({ 'file', 'start' }, handler.fileStart)
busted.subscribe({ 'test', 'start' }, handler.testStart)
return handler
end
Loading…
Cancel
Save