mirror of
https://github.com/koreader/koreader
synced 2024-10-31 21:20:20 +00:00
Add CircleCI (#3321)
This commit is contained in:
parent
6e52e559ae
commit
283bffdce9
@ -6,7 +6,8 @@ source "${CI_DIR}/common.sh"
|
|||||||
|
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
if [ "${TRAVIS_PULL_REQUEST}" = false ] && [ "${TRAVIS_BRANCH}" = 'master' ]; then
|
# if [ "${TRAVIS_PULL_REQUEST}" = false ] && [ "${TRAVIS_BRANCH}" = 'master' ]; then
|
||||||
|
if [ -z "${CIRCLE_PULL_REQUEST}" ] && [ "${CIRCLE_BRANCH}" = 'master' ]; then
|
||||||
travis_retry luarocks --local install ldoc
|
travis_retry luarocks --local install ldoc
|
||||||
# get deploy key for doc repo
|
# get deploy key for doc repo
|
||||||
openssl aes-256-cbc -k "${doc_build_secret:?}" -in .ci/koreader_doc.enc -out ~/.ssh/koreader_doc -d
|
openssl aes-256-cbc -k "${doc_build_secret:?}" -in .ci/koreader_doc.enc -out ~/.ssh/koreader_doc -d
|
||||||
|
@ -8,10 +8,10 @@ fi
|
|||||||
mkdir bin
|
mkdir bin
|
||||||
ln -s "$(which gcc-4.8)" bin/cc
|
ln -s "$(which gcc-4.8)" bin/cc
|
||||||
ln -s "$(which gcc-4.8)" bin/gcc
|
ln -s "$(which gcc-4.8)" bin/gcc
|
||||||
ln -s "$(which c++-4.8)" bin/c++
|
ln -s "$(which c++)" bin/c++
|
||||||
ln -s "$(which g++-4.8)" bin/g++
|
ln -s "$(which g++-4.8)" bin/g++
|
||||||
|
|
||||||
# Travis only makes a shallow clone of --depth=50. KOReader is small enough that
|
# Travis only makes a shallow clone of --depth=50. KOReader is small enough that
|
||||||
# we can just grab it all. This is necessary to generate the version number,
|
# we can just grab it all. This is necessary to generate the version number,
|
||||||
# without which some tests will fail.
|
# without which some tests will fail.
|
||||||
git fetch --unshallow
|
# git fetch --unshallow
|
||||||
|
7
.ci/build.sh
Executable file
7
.ci/build.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
source "${CI_DIR}/common.sh"
|
||||||
|
|
||||||
|
make all
|
25
.ci/check.sh
Executable file
25
.ci/check.sh
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
source "${CI_DIR}/common.sh"
|
||||||
|
|
||||||
|
echo -e "\n${ANSI_GREEN}shellcheck results"
|
||||||
|
"${CI_DIR}/helper_shellchecks.sh"
|
||||||
|
|
||||||
|
echo -e "\\n${ANSI_GREEN}Checking for unscaled sizes"
|
||||||
|
# stick `|| true` at the end to prevent Travis exit on failed command
|
||||||
|
unscaled_size_check=$(grep -nr --include=*.lua --exclude=koptoptions.lua --exclude-dir=base --exclude-dir=install --exclude-dir=keyboardlayouts --exclude-dir=*arm* "\\(padding\\|margin\\|bordersize\\|width\\|height\\|radius\\|linesize\\) = [0-9]\\{1,2\\}" | grep -v '= 0' | grep -v '= [0-9]/[0-9]' | grep -Ev '(default_option_height|default_option_padding)' | grep -v scaleBySize || true)
|
||||||
|
# Also check Geom objects; for legibility two regular expressions rather than
|
||||||
|
# one enormous indecipharable blob.
|
||||||
|
unscaled_size_check_geom=$(grep -E -nr --include=*.lua --exclude=gesturerange_spec.lua --exclude-dir=base --exclude-dir=*arm* 'Geom:new{.+ [wh] = [0-9]{1,4}' | grep -Ev '[wh] = 0' | grep -v '= [0-9]/[0-9]' | grep -v scaleBySize || true)
|
||||||
|
|
||||||
|
if [ "${unscaled_size_check}" ] || [ "${unscaled_size_check_geom}" ]; then
|
||||||
|
echo -e "\\n${ANSI_RED}Warning: it looks like you might be using unscaled sizes.\\nIt is almost always preferable to defer to one of the predefined sizes in ui.elements.commonui in the following files:"
|
||||||
|
echo "${unscaled_size_check}"
|
||||||
|
echo "${unscaled_size_check_geom}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "\n${ANSI_GREEN}Luacheck results"
|
||||||
|
luajit "$(which luacheck)" --no-color -q {reader,setupkoenv,datastorage}.lua frontend plugins spec
|
12
.ci/common.sh
Normal file → Executable file
12
.ci/common.sh
Normal file → Executable file
@ -61,9 +61,15 @@ retry_cmd() {
|
|||||||
return $result
|
return $result
|
||||||
}
|
}
|
||||||
|
|
||||||
export PATH=$PWD/bin:$PATH
|
# export CI_BUILD_DIR=${TRAVIS_BUILD_DIR}
|
||||||
export PATH=$PATH:${TRAVIS_BUILD_DIR}/install/bin
|
# use eval to get fully expanded path
|
||||||
if [ -f "${TRAVIS_BUILD_DIR}/install/bin/luarocks" ]; then
|
eval CI_BUILD_DIR="${CIRCLE_WORKING_DIRECTORY}"
|
||||||
|
export CI_BUILD_DIR
|
||||||
|
|
||||||
|
test -e "${HOME}/bin" || mkdir "${HOME}/bin"
|
||||||
|
export PATH=$PWD/bin:$HOME/bin:$PATH
|
||||||
|
export PATH=$PATH:${CI_BUILD_DIR}/install/bin
|
||||||
|
if [ -f "${CI_BUILD_DIR}/install/bin/luarocks" ]; then
|
||||||
# add local rocks to $PATH
|
# add local rocks to $PATH
|
||||||
eval "$(luarocks path --bin)"
|
eval "$(luarocks path --bin)"
|
||||||
fi
|
fi
|
||||||
|
7
.ci/fetch.sh
Executable file
7
.ci/fetch.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
source "${CI_DIR}/common.sh"
|
||||||
|
|
||||||
|
travis_retry make fetchthirdparty
|
@ -6,7 +6,7 @@ source "${CI_DIR}/common.sh"
|
|||||||
|
|
||||||
rm -rf "${HOME}/.luarocks"
|
rm -rf "${HOME}/.luarocks"
|
||||||
mkdir "${HOME}/.luarocks"
|
mkdir "${HOME}/.luarocks"
|
||||||
cp "${TRAVIS_BUILD_DIR}/install/etc/luarocks/config.lua" "${HOME}/.luarocks/config.lua"
|
cp "${CI_BUILD_DIR}/install/etc/luarocks/config.lua" "${HOME}/.luarocks/config.lua"
|
||||||
echo "wrap_bin_scripts = false" >>"$HOME/.luarocks/config.lua"
|
echo "wrap_bin_scripts = false" >>"$HOME/.luarocks/config.lua"
|
||||||
travis_retry luarocks --local install luafilesystem
|
travis_retry luarocks --local install luafilesystem
|
||||||
# for verbose_print module
|
# for verbose_print module
|
||||||
|
@ -5,7 +5,7 @@ CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|||||||
source "${CI_DIR}/common.sh"
|
source "${CI_DIR}/common.sh"
|
||||||
|
|
||||||
# print some useful info
|
# print some useful info
|
||||||
echo "TRAVIS_BUILD_DIR: ${TRAVIS_BUILD_DIR}"
|
echo "BUILD_DIR: ${CI_BUILD_DIR}"
|
||||||
echo "pwd: $(pwd)"
|
echo "pwd: $(pwd)"
|
||||||
ls
|
ls
|
||||||
|
|
||||||
@ -24,11 +24,12 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# install our own updated luarocks
|
# install our own updated luarocks
|
||||||
if [ ! -f "${TRAVIS_BUILD_DIR}/install/bin/luarocks" ]; then
|
echo "luarocks installation path: ${CI_BUILD_DIR}"
|
||||||
|
if [ ! -f "${CI_BUILD_DIR}/install/bin/luarocks" ]; then
|
||||||
git clone https://github.com/torch/luajit-rocks.git
|
git clone https://github.com/torch/luajit-rocks.git
|
||||||
pushd luajit-rocks && {
|
pushd luajit-rocks && {
|
||||||
git checkout 6529891
|
git checkout 6529891
|
||||||
cmake . -DWITH_LUAJIT21=ON -DCMAKE_INSTALL_PREFIX="${TRAVIS_BUILD_DIR}/install"
|
cmake . -DWITH_LUAJIT21=ON -DCMAKE_INSTALL_PREFIX="${CI_BUILD_DIR}/install"
|
||||||
make install
|
make install
|
||||||
} || exit
|
} || exit
|
||||||
popd
|
popd
|
||||||
@ -38,6 +39,10 @@ fi
|
|||||||
|
|
||||||
if [ ! -d "${HOME}/.luarocks" ] || [ ! -f "${HOME}/.luarocks/$(md5sum <"${CI_DIR}/helper_luarocks.sh")" ]; then
|
if [ ! -d "${HOME}/.luarocks" ] || [ ! -f "${HOME}/.luarocks/$(md5sum <"${CI_DIR}/helper_luarocks.sh")" ]; then
|
||||||
echo -e "${ANSI_GREEN}Grabbing new .luarocks."
|
echo -e "${ANSI_GREEN}Grabbing new .luarocks."
|
||||||
|
sudo apt-get update
|
||||||
|
# install openssl devel for luasec
|
||||||
|
sudo apt-get -y install libssl-dev
|
||||||
|
|
||||||
"${CI_DIR}/helper_luarocks.sh"
|
"${CI_DIR}/helper_luarocks.sh"
|
||||||
touch "${HOME}/.luarocks/$(md5sum <"${CI_DIR}/helper_luarocks.sh")"
|
touch "${HOME}/.luarocks/$(md5sum <"${CI_DIR}/helper_luarocks.sh")"
|
||||||
else
|
else
|
||||||
|
@ -5,28 +5,13 @@ CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|||||||
source "${CI_DIR}/common.sh"
|
source "${CI_DIR}/common.sh"
|
||||||
|
|
||||||
echo -e "\\n${ANSI_GREEN}make fetchthirdparty"
|
echo -e "\\n${ANSI_GREEN}make fetchthirdparty"
|
||||||
travis_retry make fetchthirdparty
|
bash "${CI_DIR}/fetch.sh"
|
||||||
|
|
||||||
"${CI_DIR}/helper_shellchecks.sh"
|
echo -e "\\n${ANSI_GREEN}static checks"
|
||||||
|
bash "${CI_DIR}/check.sh"
|
||||||
echo -e "\\n${ANSI_GREEN}Checking for unscaled sizes"
|
|
||||||
# stick `|| true` at the end to prevent Travis exit on failed command
|
|
||||||
unscaled_size_check=$(grep -nr --include=*.lua --exclude=koptoptions.lua --exclude-dir=base --exclude-dir=install --exclude-dir=keyboardlayouts --exclude-dir=*arm* "\\(padding\\|margin\\|bordersize\\|width\\|height\\|radius\\|linesize\\) = [0-9]\\{1,2\\}" | grep -v '= 0' | grep -v '= [0-9]/[0-9]' | grep -Ev '(default_option_height|default_option_padding)' | grep -v scaleBySize || true)
|
|
||||||
# Also check Geom objects; for legibility two regular expressions rather than
|
|
||||||
# one enormous indecipharable blob.
|
|
||||||
unscaled_size_check_geom=$(grep -E -nr --include=*.lua --exclude=gesturerange_spec.lua --exclude-dir=base --exclude-dir=*arm* 'Geom:new{.+ [wh] = [0-9]{1,4}' | grep -Ev '[wh] = 0' | grep -v '= [0-9]/[0-9]' | grep -v scaleBySize || true)
|
|
||||||
|
|
||||||
if [ "${unscaled_size_check}" ] || [ "${unscaled_size_check_geom}" ]; then
|
|
||||||
echo -e "\\n${ANSI_RED}Warning: it looks like you might be using unscaled sizes.\\nIt is almost always preferable to defer to one of the predefined sizes in ui.size in the following files:"
|
|
||||||
echo "${unscaled_size_check}"
|
|
||||||
echo "${unscaled_size_check_geom}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "\\n${ANSI_GREEN}Luacheck results"
|
|
||||||
luajit "$(which luacheck)" --no-color -q {reader,setupkoenv,datastorage}.lua frontend plugins spec
|
|
||||||
|
|
||||||
echo -e "\\n${ANSI_GREEN}make all"
|
echo -e "\\n${ANSI_GREEN}make all"
|
||||||
make all
|
bash "${CI_DIR}/build.sh"
|
||||||
|
|
||||||
echo -e "\\n${ANSI_GREEN}make testfront"
|
echo -e "\\n${ANSI_GREEN}make testfront"
|
||||||
make testfront
|
bash "${CI_DIR}/test.sh"
|
||||||
|
7
.ci/test.sh
Executable file
7
.ci/test.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
source "${CI_DIR}/common.sh"
|
||||||
|
|
||||||
|
make testfront
|
52
.circleci/config.yml
Normal file
52
.circleci/config.yml
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
version: 2
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
docker:
|
||||||
|
- image: houqp/kobase:0.0.5
|
||||||
|
environment:
|
||||||
|
EMULATE_READER: 1
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- restore_cache:
|
||||||
|
keys:
|
||||||
|
- deps
|
||||||
|
- build
|
||||||
|
- run: echo 'export PATH=${HOME}/bin:${PATH}' >> $BASH_ENV
|
||||||
|
|
||||||
|
- run:
|
||||||
|
name: setup
|
||||||
|
command: .ci/before_install.sh
|
||||||
|
- run:
|
||||||
|
name: install
|
||||||
|
command: .ci/install.sh
|
||||||
|
- run:
|
||||||
|
name: fetch
|
||||||
|
command: .ci/fetch.sh
|
||||||
|
- run:
|
||||||
|
name: check
|
||||||
|
command: .ci/check.sh
|
||||||
|
- run:
|
||||||
|
name: build
|
||||||
|
command: .ci/build.sh
|
||||||
|
- run:
|
||||||
|
name: test
|
||||||
|
command: .ci/test.sh
|
||||||
|
- run:
|
||||||
|
name: cleanup
|
||||||
|
command: .ci/after_success.sh
|
||||||
|
|
||||||
|
- run:
|
||||||
|
name: clean up cache
|
||||||
|
command: rm -frv ./base/build/*/{spec,cache/*}
|
||||||
|
- save_cache:
|
||||||
|
key: build
|
||||||
|
paths:
|
||||||
|
- "/home/ko/.ccache"
|
||||||
|
- "base"
|
||||||
|
- save_cache:
|
||||||
|
key: deps
|
||||||
|
paths:
|
||||||
|
- "/home/ko/bin"
|
||||||
|
- "/home/ko/.luarocks"
|
||||||
|
# compiled luarocks binaries
|
||||||
|
- "install"
|
10
README.md
10
README.md
@ -1,4 +1,4 @@
|
|||||||
[![Build Status][travis-badge]][travis-link]
|
[![Build Status][circleci-badge]][circleci-link]
|
||||||
[![Coverage Status][coverage-badge]][coverage-link]
|
[![Coverage Status][coverage-badge]][coverage-link]
|
||||||
[![AGPL Licence][licence-badge]](COPYING)
|
[![AGPL Licence][licence-badge]](COPYING)
|
||||||
KOReader
|
KOReader
|
||||||
@ -174,7 +174,7 @@ make static-check
|
|||||||
|
|
||||||
NOTE: Extra dependencies for tests: `luacheck` from luarocks
|
NOTE: Extra dependencies for tests: `luacheck` from luarocks
|
||||||
|
|
||||||
You may need to checkout the [travis config file][travis-conf] to setup up
|
You may need to checkout the [circleci config file][circleci-conf] to setup up
|
||||||
a proper testing environment. Briefly, you need to install `luarocks` and
|
a proper testing environment. Briefly, you need to install `luarocks` and
|
||||||
then install `busted` with `luarocks`. The "eng" language data file for
|
then install `busted` with `luarocks`. The "eng" language data file for
|
||||||
tesseract-ocr is also need to test OCR functionality. Finally, make sure
|
tesseract-ocr is also need to test OCR functionality. Finally, make sure
|
||||||
@ -294,9 +294,9 @@ http://ccache.samba.org
|
|||||||
|
|
||||||
[base-readme]:https://github.com/koreader/koreader-base/blob/master/README.md
|
[base-readme]:https://github.com/koreader/koreader-base/blob/master/README.md
|
||||||
[nb-script]:https://gitlab.com/koreader/nightly-builds/blob/master/build_release.sh
|
[nb-script]:https://gitlab.com/koreader/nightly-builds/blob/master/build_release.sh
|
||||||
[travis-badge]:https://travis-ci.org/koreader/koreader.svg?branch=master
|
[circleci-badge]:https://circleci.com/gh/koreader/koreader.svg?style=svg
|
||||||
[travis-link]:https://travis-ci.org/koreader/koreader
|
[circleci-link]:https://circleci.com/gh/koreader/koreader
|
||||||
[travis-conf]:https://github.com/koreader/koreader-base/blob/master/.travis.yml
|
[circleci-conf]:https://github.com/koreader/koreader-base/blob/master/.circleci/config.yml
|
||||||
[linux-vm]:http://www.howtogeek.com/howto/11287/how-to-run-ubuntu-in-windows-7-with-vmware-player/
|
[linux-vm]:http://www.howtogeek.com/howto/11287/how-to-run-ubuntu-in-windows-7-with-vmware-player/
|
||||||
[l10n-readme]:https://github.com/koreader/koreader/blob/master/l10n/README.md
|
[l10n-readme]:https://github.com/koreader/koreader/blob/master/l10n/README.md
|
||||||
[koreader-transifex]:https://www.transifex.com/projects/p/koreader/
|
[koreader-transifex]:https://www.transifex.com/projects/p/koreader/
|
||||||
|
Loading…
Reference in New Issue
Block a user