Skip to content

Commit

Permalink
Merge pull request #117 from tegonal/install-shellspec
Browse files Browse the repository at this point in the history
add install-shellspec.sh
  • Loading branch information
robstoll authored Sep 14, 2022
2 parents 85ceaab + 3ad75b1 commit 762d76c
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ body:
label: Script
options:
- ci/install-shellcheck.sh
- ci/install-shellspec.sh
- qa/run-shellcheck.sh
- releasing/sneak-peek-banner.sh
- releasing/toggle-sections.sh
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ jobs:
run: ./src/ci/install-shellcheck.sh

- name: Install shellspec
run: |
echo "${HOME}/.local/bin" >> "$GITHUB_PATH"
curl -fsSL https://git.io/shellspec | sh -s 0.28.1 -y
run: ./src/ci/install-shellspec.sh

- name: before pr
run: ./scripts/before-pr.sh
Expand Down
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ Note that `source "$dir_of_tegonal_scripts/setup.sh"` will automatically source
The scripts are ordered by topic:
- [CI](#continuous-integration)
- [install shellcheck](#install-shellcheck)
- [install shellspec](#install-shellcheck)
- [Quality Assurance](#quality-assurance)
- [runShellcheck](#runshellcheck)
- [Releasing](#releasing)
Expand All @@ -112,6 +114,7 @@ The scripts are ordered by topic:
- [Checks](#checks)
- [git Utils](#git-utils)
- [GPG Utils](#gpg-utils)
- [Http functions](#http-functions)
- [IO functions](#io-functions)
- [Log functions](#log-functions)
- [Parse arguments](#parse-arguments)
Expand All @@ -124,7 +127,7 @@ The scripts are ordered by topic:
# Continuous Integration
The scripts under this topic (in directory `ci`) help out in performing CI steps.
## install-shellcheck.sh
## Install shellcheck
Installs shellcheck v0.8.0.
Most likely used together with [runShellcheck](#runshellcheck).
Expand All @@ -149,6 +152,27 @@ jobs:
</ci-install-shellcheck>
## Install shellspec
<ci-install-shellspec>
<!-- auto-generated, do not modify here but in src/ci/install-shellspec.sh -->
```bash
# run the install-shellcheck.sh in your github/gitlab workflow
# for instance, assuming you fetched this file via gget and remote name is tegonal-scripts
# then in a github workflow you would have
jobs:
steps:
- name: install shellspec v0.28.1
run: ./lib/tegonal-scripts/src/ci/install-shellspec.sh
# and most likely as well
- name: run shellspec
run: shellspec
```
</ci-install-shellspec>
# Quality Assurance
The scripts under this topic (in directory `qa`) perform checks or execute qa tools.
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-shellcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function customRunShellcheck() {
"$dir_of_tegonal_scripts/../spec"
)
local sourcePath="$dir_of_tegonal_scripts:$scriptsDir"
runShellcheck dirs "$sourcePath" -not -name "install-shellcheck.doc.sh"
runShellcheck dirs "$sourcePath" -not -name "install-*.doc.sh"
}

${__SOURCED__:+return}
Expand Down
12 changes: 12 additions & 0 deletions src/ci/install-shellspec.doc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# run the install-shellcheck.sh in your github/gitlab workflow
# for instance, assuming you fetched this file via gget and remote name is tegonal-scripts
# then in a github workflow you would have

jobs:
steps:
- name: install shellspec v0.28.1
run: ./lib/tegonal-scripts/src/ci/install-shellspec.sh
# and most likely as well
- name: run shellspec
run: shellspec

44 changes: 44 additions & 0 deletions src/ci/install-shellspec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
#
# __ __
# / /____ ___ ____ ___ ___ _/ / This script is provided to you by https://github.com/tegonal/scripts
# / __/ -_) _ `/ _ \/ _ \/ _ `/ / It is licensed under Apache 2.0
# \__/\__/\_, /\___/_//_/\_,_/_/ Please report bugs and contribute back your improvements
# /___/
# Version: v0.17.0-SNAPSHOT
#
####### Description #############
#
# function which searches for *.sh files within defined paths (directories or a single *.sh) and
# runs shellcheck on each file with predefined settings i.a. sets `-s bash`
#
####### Usage ###################
#
# # run the install-shellcheck.sh in your github/gitlab workflow
# # for instance, assuming you fetched this file via gget and remote name is tegonal-scripts
# # then in a github workflow you would have
#
# jobs:
# steps:
# - name: install shellspec v0.28.1
# run: ./lib/tegonal-scripts/src/ci/install-shellspec.sh
# # and most likely as well
# - name: run shellspec
# run: shellspec
#
###################################
set -euo pipefail
shopt -s inherit_errexit
unset CDPATH

declare currentDir
currentDir=$(pwd)
tmpDir=$(mktemp -d -t download-shellspec-XXXXXXXXXX)
cd "$tmpDir"
echo "4cac73d958d1ca8c502f3aff1a3b3cfa46ab0062f81f1cc522b83b7b2b302175 shellspec" >shellspec.sha256
wget --no-verbose https://git.io/shellspec
sha256sum -c shellspec.sha256
sh ./shellspec 0.28.1 -y
cd "$currentDir"
echo "shellspec version is:"
shellspec --version

0 comments on commit 762d76c

Please sign in to comment.