devilbox/.github/workflows/lint.yml
2020-12-12 19:13:31 +01:00

106 lines
2.8 KiB
YAML

---
# -------------------------------------------------------------------------------------------------
# Job Name
# -------------------------------------------------------------------------------------------------
name: Lint
# -------------------------------------------------------------------------------------------------
# When to run
# -------------------------------------------------------------------------------------------------
on:
# Runs on Pull Requests
pull_request:
# Runs on master Branch and Tags
push:
branches:
- master
tags:
# -------------------------------------------------------------------------------------------------
# What to run
# -------------------------------------------------------------------------------------------------
jobs:
lint:
runs-on: ubuntu-latest
name: "[Lint]"
steps:
# ------------------------------------------------------------
# Checkout repository
# ------------------------------------------------------------
- name: Checkout repository
uses: actions/checkout@v1
- name: Lint
shell: bash
run: |
retry() {
for n in $(seq ${RETRIES}); do
echo "[${n}/${RETRIES}] ${*}";
if eval "${*}"; then
echo "[SUCC] ${n}/${RETRIES}";
return 0;
fi;
sleep ${PAUSE};
echo "[FAIL] ${n}/${RETRIES}";
done;
return 1;
}
cd .tests/
retry make lint-tests
env:
RETRIES: 20
PAUSE: 10
- name: Update Readme
shell: bash
run: |
retry() {
for n in $(seq ${RETRIES}); do
echo "[${n}/${RETRIES}] ${*}";
if eval "${*}"; then
echo "[SUCC] ${n}/${RETRIES}";
return 0;
fi;
sleep ${PAUSE};
echo "[FAIL] ${n}/${RETRIES}";
done;
return 1;
}
cd .tests/
retry make update-readme
git diff --quiet || { echo "Build Changes"; git diff; git status; false; };
env:
RETRIES: 20
PAUSE: 10
- name: Check configuration
shell: bash
run: |
retry() {
for n in $(seq ${RETRIES}); do
echo "[${n}/${RETRIES}] ${*}";
if eval "${*}"; then
echo "[SUCC] ${n}/${RETRIES}";
return 0;
fi;
sleep ${PAUSE};
echo "[FAIL] ${n}/${RETRIES}";
done;
return 1;
}
cp env-example .env
sed -i'' "s/^NEW_UID=.*/NEW_UID=$(id -u)/g" .env
sed -i'' "s/^NEW_GID=.*/NEW_GID=$(id -g)/g" .env
retry ./check-config.sh
env:
RETRIES: 20
PAUSE: 10