Skip to content
Snippets Groups Projects
Unverified Commit 02b882a2 authored by Oliver Smith's avatar Oliver Smith
Browse files

CI: shellcheck: adjust for 'pmbootstrap ci' (MR 3615)

Split out the grep for CHANGEME into a separate .ci/grep.sh script, as
it's not related to shellcheck and also there's another grep check that
I'll move there in a follow-up patch.
parent e932ca68
No related branches found
No related tags found
No related merge requests found
#!/bin/sh -e
# Description: check various bad patterns with grep
# https://postmarktos.org/pmb-ci
if [ "$(id -u)" = 0 ]; then
set -x
apk -q add grep
exec su "${TESTUSER:-build}" -c "sh -e $0"
fi
# Find CHANGEMEs in APKBUILDs
if grep -qr '(CHANGEME!)' *; then
echo "ERROR: Please replace '(CHANGEME!)' in the following files:"
grep --color=always -r '(CHANGEME!)' *
exit 1
fi
#!/bin/sh -e
# Copyright 2021 Oliver Smith
# Copyright 2022 Oliver Smith
# SPDX-License-Identifier: GPL-3.0-or-later
# Description: lint all shell scripts
# https://postmarktos.org/pmb-ci
set -e
DIR="$(cd "$(dirname "$0")" && pwd -P)"
cd "$DIR/.."
DIR="$(cd "$(dirname "$0")/.." && pwd -P)"
# Find CHANGEMEs in APKBUILDs
if grep -qr '(CHANGEME!)' *; then
echo "ERROR: Please replace '(CHANGEME!)' in the following files:"
grep --color=always -r '(CHANGEME!)' *
exit 1
if [ "$(id -u)" = 0 ]; then
set -x
apk -q add shellcheck
exec su "${TESTUSER:-build}" -c "sh -e $0"
fi
# Shell: shellcheck
......@@ -44,8 +43,9 @@ sh_files="
$(find . -path '.ci/*.sh')
"
for file in $sh_files; do
echo "Test with shellcheck: $file"
cd "$DIR/../$(dirname "$file")"
cd "$DIR/$(dirname "$file")"
shellcheck -e SC1008 -x "$(basename "$file")"
done
......@@ -51,15 +51,15 @@ flake8:
- .ci/lib/gitlab_prepare_ci.sh
- .ci/flake8.sh
# shellcheck
shellcheck:
# shellcheck and various grep checks
shellcheck-grep:
stage: lint
<<: *only-default
image: alpine:edge
before_script:
- apk -q add shellcheck
script:
- .ci/lib/gitlab_prepare_ci.sh
- .ci/shellcheck.sh
- .ci/grep.sh
editor-config:
stage: lint
......
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