Skip to content

Commit

Permalink
Run shellcheck on all scripts in the CI
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelLipski committed Jan 9, 2022
1 parent 426182c commit efca6f2
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 15 deletions.
15 changes: 10 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,33 @@ executors:
TERM: ansi

mandatory_jobs: &mandatory_jobs
- initial checks
- general checks
- test against python 3_6 and git 1_8_10
- test against python 3_7 and git 2_7_6
- test against python 3_8 and git 2_25_0 with PEP8 checks
- test against python 3_9 and git 2_30_1 with coverage report and docs creation
- test against python 3_10 and git 2_33_1

jobs:
"initial checks":
"general checks":
executor: ubuntu_executor
steps:
- checkout
- run:
name: Install dependencies
command: |
# For ensure-completion-scripts-correct.sh
sudo apt-get update
# For ensure-completion-scripts-correct.sh
sudo apt-get install zsh fish
# For ensure-shell-scripts-pass-shellcheck.sh
sudo apt-get install shellcheck
# For ensure-links-correct.sh
npm install --global remark-cli remark-lint-no-dead-urls remark-validate-links
- run:
name: Perform initial checks
name: Perform general checks
command: |
# We don't want `less` to open for `git grep` results.
export GIT_PAGER=cat
Expand All @@ -43,6 +47,7 @@ jobs:
enforce-issue-number-for-todos.sh
ensure-completion-scripts-correct.sh
ensure-links-correct.sh
ensure-shell-scripts-pass-shellcheck.sh
ensure-version-bumped.sh
prohibit-tab-character.sh
prohibit-trailing-whitespace.sh
Expand Down Expand Up @@ -176,7 +181,7 @@ workflows:
version: 2
build:
jobs:
- initial checks
- general checks
- test against python 3_6 and git 1_8_10
- test against python 3_7 and git 2_7_6
- test against python 3_8 and git 2_25_0 with PEP8 checks
Expand Down
2 changes: 2 additions & 0 deletions blogs/git-machete-1/sandbox-setup-reduced.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -e -o pipefail -u

newb() {
git checkout -b $1
}
Expand Down
2 changes: 2 additions & 0 deletions blogs/git-machete-1/sandbox-setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -e -o pipefail -u

newb() {
git checkout -b $1
}
Expand Down
2 changes: 2 additions & 0 deletions blogs/git-machete-2/sandbox-setup-2.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -e -o pipefail -u

newb() {
git checkout -b $1
}
Expand Down
4 changes: 2 additions & 2 deletions ci/checks/enforce-issue-number-for-todos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ function error() {

if [[ $# -ge 1 ]]; then
if [[ -t 1 ]]; then
echo -e "${red}>>> $@ <<<${endc}"
echo -e "${red}>>> $* <<<${endc}"
else
echo -e ">>> $@ <<<"
echo -e ">>> $* <<<"
fi
fi
}
Expand Down
6 changes: 3 additions & 3 deletions ci/checks/ensure-completion-scripts-correct.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

set -e -o pipefail -u

bash completion/git-machete.completion.bash
zsh completion/git-machete.completion.zsh
fish completion/git-machete.fish
bash completion/git-machete.completion.bash >/dev/null
zsh completion/git-machete.completion.zsh >/dev/null
fish completion/git-machete.fish >/dev/null
5 changes: 5 additions & 0 deletions ci/checks/ensure-shell-scripts-pass-shellcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

set -e -o pipefail -u

git ls-files '*.sh' | xargs shellcheck --check-sourced --exclude=SC2090,SC2125 --severity=warning --shell=bash
2 changes: 1 addition & 1 deletion ci/github-releases/ci-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ tag=v$(grep '__version__ = ' git_machete/__init__.py | cut -d\' -f2)
# (since apparently all non-draft releases on GitHub must have a corresponding git tag).
hub release create "$tag" \
--message="$tag"$'\n\n'"$(sed '4,/^$/!d; /^$/d' RELEASE_NOTES.md)" \
--attach=$(echo dist/git-machete-*.noarch.rpm)
--attach="$(echo dist/git-machete-*.noarch.rpm)"
3 changes: 1 addition & 2 deletions ci/snap/ci-run-dry-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

set -e -o pipefail -u -x

# `--use-lxd` applied to use a LXD container instead of a VM, to work around lack of support for KVM on CircleCI VMs.

sudo apt-get update
sudo apt-get install -y snapd
sudo snap install snapcraft --classic
sudo lxd init --minimal
# `--use-lxd` applied to use a LXD container instead of a VM, to work around lack of support for KVM on CircleCI VMs.
snapcraft --use-lxd

! command -v git-machete
Expand Down
4 changes: 2 additions & 2 deletions ci/tox/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ ARG check_coverage
ENV CHECK_COVERAGE=${check_coverage}

# Pass build argument to BUILD_DOCS environment variable that is used to
# determine where to run tox environment that builds documentation.
# determine whether to run tox environment that builds documentation.
ARG build_docs
ENV BUILD_DOCS=${build_docs}

# Pass build argument to PEP8 environment variable that is used to
# determine where to run tox environment that runs check against PEP8 standard.
# determine whether to run tox environment that runs check against PEP8 standard.
ARG pep8
ENV PEP8=${pep8}

Expand Down

0 comments on commit efca6f2

Please sign in to comment.