From 70e11dc890b93ab83195188a49649be7e8e6a249 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Wed, 12 May 2021 07:40:56 +0200 Subject: [PATCH] Makefile: add lint target to run shellcheck --- .builds/archlinux.yml | 1 + .builds/freebsd.yml | 1 + .builds/openbsd.yml | 1 + .gitlab-ci.yml | 2 +- Makefile | 5 +++++ ci/run | 1 + 6 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.builds/archlinux.yml b/.builds/archlinux.yml index 4adc85f..0c4671c 100644 --- a/.builds/archlinux.yml +++ b/.builds/archlinux.yml @@ -1,6 +1,7 @@ image: archlinux packages: - go + - shellcheck tasks: - all: | cd safcm diff --git a/.builds/freebsd.yml b/.builds/freebsd.yml index e3ea472..6ede0f8 100644 --- a/.builds/freebsd.yml +++ b/.builds/freebsd.yml @@ -2,6 +2,7 @@ image: freebsd/latest packages: - go - gmake + - hs-shellcheck tasks: - all: | sudo ln -sf /usr/local/bin/gmake /usr/bin/make diff --git a/.builds/openbsd.yml b/.builds/openbsd.yml index 025d49a..a0d29d9 100644 --- a/.builds/openbsd.yml +++ b/.builds/openbsd.yml @@ -3,6 +3,7 @@ packages: - go - gmake - xz + - shellcheck tasks: - all: | # OpenBSD 6.8 only ships with Go 1.15 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e2ec0a5..0bacecd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ .template-docker: &template-docker before_script: - apt-get update - - apt-get install --no-install-recommends --yes build-essential ca-certificates git golang golang-1.16 golang-golang-x-tools make openssh-server + - apt-get install --no-install-recommends --yes build-essential ca-certificates git golang golang-1.16 golang-golang-x-tools make openssh-server shellcheck script: # Gitlab-runner uses umask 0000 (wtf?!) and mixes nobody and root user # when setting up the environment. This breaks ssh's permission check on diff --git a/Makefile b/Makefile index 95cc9c8..fa2db0b 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,11 @@ test: go vet ./... go test $(GOFLAGS) ./... +lint: + shellcheck ci/run + shellcheck cmd/safcm-remote/build.sh + shellcheck cmd/safcm/testdata/ssh/prepare.sh + clean: rm -rf remote/helpers/ rm -f safcm diff --git a/ci/run b/ci/run index 1b240a6..67c0e47 100755 --- a/ci/run +++ b/ci/run @@ -20,6 +20,7 @@ export SAFCM_CI_RUN make $flags # shellcheck disable=SC2086 make test $flags +make lint # Strict umask umask 077 -- 2.45.2