Skip to content
Snippets Groups Projects
Commit 8ef77cdb authored by q3k's avatar q3k Committed by Serge Bazanski
Browse files

ci: implement lint & Annoyatron

We want to run a linter on CI submission.

We also want to display nice error messages to the user. Thus,
annoyatron is born.

The flow is as follows:
 - a MR is submitted and triggers the 'lint' pipeline
 - annoyatron gets pinged over https that an MR requires attention
 - annoyatron starts running and waits until the MR's pipeline run
   succeeds or fails
 - the lint jobs either succeeds or fails
 - annoyatron notices the pipeline passed, and inspects its results to
   see if the lint pipeline failed or not.
 - annoyatron posts a comment, if necessary
parent 07dab7e0
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,22 @@ build:
- ninja -C build/
- arm-none-eabi-size build/bootloader/bootloader.elf build/epicardium/epicardium.elf build/pycardium/pycardium.elf
lint:
stage: test
image: "registry.k0.hswaw.net/q3k/card10-lint-env:20190728-233522Z-ded74f0-dirty"
script:
# Annoyatron is maintained by q3k. Its job is to serve MR comments that are friendlier than just a failing pipeline.
# source code: https://git.card10.badge.events.ccc.de/q3k/annoyatron/
# prod deployment: https://gerrit.hackerspace.pl/plugins/gitiles/hscloud/+/refs/heads/master/personal/q3k/annoyatron/
# If this starts failing for any reason, just remove this curl ping.
- curl --fail https://annoyatron-prod.q3k.org/ping/mr?mr=${CI_MERGE_REQUEST_IID}
- git remote rm card10 || true # old gitlab runners might have this remote.
- git fetch https://git.card10.badge.events.ccc.de/card10/firmware.git master:card10/master
- git diff --name-only $(git merge-base --fork-point card10/master)...HEAD | xargs tools/code-style.sh
- git diff --exit-code
only:
- merge_requests
pages:
stage: deploy
# maintaned by q3k, build using docker/deploy-env
......
FROM ubuntu:bionic
RUN set -e -x ;\
export DEBIAN_FRONTEND=noninteractive ;\
apt-get update -y ;\
apt-get install -y \
curl \
ca-certificates \
clang-format \
git \
python3 \
python3-pip ;\
python3 -m pip install black ;\
rm -rf /var/lib/apt/lists
#!/usr/bin/env bash
# Build and push the deploy env Docker container to the Gitlab container registry.
set -e
function rev() {
( cd $1; git describe --always --match "v[0-9].*" --dirty )
}
IMAGE=registry.k0.hswaw.net/q3k/card10-lint-env
TAG=$(TZ=UTC date +%Y%m%d-%H%M%SZ)-$(rev .)
docker build -t $IMAGE:$TAG .
docker push $IMAGE:$TAG
echo "Pushed $IMAGE:$TAG"
......@@ -56,6 +56,5 @@ for source_file in "$@"; do
black -q "$source_file"
else
echo " - Ignoring $source_file" >&2
continue
fi
fi
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment