chore(ci): configure linters to run locally

This commit organizes linters in scripts that are included in the
codebase, rather than configured only for Gitlab CI.

This way, the Gitlab CI configuration is simplified (it simply calls
the scripts) and they can be run locally (either manually or triggered
by git hooks: I recommend linting commit messages in the `commit-msg`
hook and everything else in the `pre-commit` hook).

Those scripts are located in `test/lint` and a handy wrapper script has
been created at the root of the project for quick manual run:

This commit also adds a neat build badge on README 
parent 73aa994e
# GitLab CI configuration file
# To run this locally (requires `gitlab-runner`):
# $ gitlab-runner exec docker <job_name>
image: docker:latest
......@@ -20,33 +25,26 @@ variables:
- master
- branches
- lintstage
- lintstage
lint es_input:
lint config-files:
<<: *lint_definition
- apk add --update --no-cache libxml2-utils
- xmllint --noout --relaxng board/recalbox/fsoverlay/recalbox/scripts/es_input.rng board/recalbox/fsoverlay/recalbox/share_init/system/.emulationstation/es_input.cfg
script: test/lint/config-files
lint buildroot packages:
lint buildroot:
<<: *lint_definition
image: python:2-alpine
- buildroot/utils/check-package package/**/*.hash custom/package/**/*.hash
- buildroot/utils/check-package package/**/*.mk custom/package/**/*.mk
- buildroot/utils/check-package package/**/ custom/package/**/
#lint commits:
# <<: *lint_definition
# image: node:8
# script:
# - npm install -g @commitlint/cli @commitlint/config-conventional
# - if [[ ${CI_COMMIT_REF_NAME} = "master" ]]; then
# commitlint --from=257ace67f316d96d0f49de8f349d06d6aa306515;
# else
# git fetch origin master;
# commitlint --from=origin/master;
# fi
script: test/lint/buildroot
lint commits:
<<: *lint_definition
image: node:8
- npm install -g @commitlint/cli @commitlint/config-conventional
script: test/lint/commits
allow_failure: true
# Build
......@@ -24,7 +24,7 @@ Please use **Issues** in corresponding projects to report a bug or request a fea
- []( recalbox forum. You will find support there.
# How to build
# How to build ![Build status](
### General steps
# This script easily runs the full test suite on developer machines
# It should be POSIX-compliant, since we cannot know on which shell it will run
set -e # Exit non-zero if any command fails
RECALBOX_ROOT=$(realpath $(dirname $(readlink -f "$0")))
echo "=== Checking Buildroot files ==="
echo "=== Checking configuration files ==="
echo "=== Checking commit messages ==="
RECALBOX_ROOT=$(realpath $(dirname $(readlink -f "$0"))/../..)
if ! [ -x ${CHECK_PACKAGE_BIN} ]; then
echo "ERROR: Buildroot submodule has probably not been checked out yet. Please do it with:"
echo " $ git submodule init"
exit 1
${RECALBOX_ROOT}/package/**/*.hash ${RECALBOX_ROOT}/custom/package/**/*.hash \
${RECALBOX_ROOT}/package/**/*.mk ${RECALBOX_ROOT}/custom/package/**/*.mk \
${RECALBOX_ROOT}/package/**/ ${RECALBOX_ROOT}/custom/package/**/
if ! which commitlint > /dev/null; then
echo "ERROR: 'commitlint' is required. Please install it, using at your convenience:"
echo " $ npm install -g @commitlint/cli @commitlint/config-conventional"
echo " $ yarn global add @commitlint/cli @commitlint/config-conventional"
exit 1
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ x${CI_COMMIT_REF_NAME} = xmaster -o x${CURRENT_BRANCH} = xmaster ]; then
commitlint --from=HEAD~5
if [ -n "${GITLAB_CI}" ]; then
git fetch -q origin master
commitlint --from=origin/master
commitlint --from=master
if ! which xmllint > /dev/null; then
echo "ERROR: 'xmllint' is required. Please install and try again."
exit 1
RECALBOX_ROOT=$(realpath $(dirname $(readlink -f "$0"))/../..)
xmllint --noout --relaxng \
${RECALBOX_ROOT}/board/recalbox/fsoverlay/recalbox/scripts/es_input.rng \
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment