-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8dcaf0a
commit 527c5d8
Showing
11 changed files
with
202 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ on: | |
|
||
jobs: | ||
lintYaml: | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
set -o pipefail | ||
|
||
# shellcheck source=SCRIPTDIR/print.sh | ||
source "$(dirname "${BASH_SOURCE[0]}")/print.sh" | ||
|
||
function util::git::token::fetch() { | ||
if [[ -z "${GIT_TOKEN:-""}" ]]; then | ||
util::print::title "Fetching GIT_TOKEN" | ||
|
||
GIT_TOKEN="$( | ||
lpass show Shared-CF\ Buildpacks/concourse-private.yml \ | ||
| grep buildpacks-github-token \ | ||
| cut -d ' ' -f 2 | ||
)" | ||
fi | ||
|
||
printf "%s" "${GIT_TOKEN}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
set -o pipefail | ||
|
||
function util::print::title() { | ||
local blue reset message | ||
blue="\033[0;34m" | ||
reset="\033[0;39m" | ||
message="${1}" | ||
|
||
echo -e "\n${blue}${message}${reset}" >&2 | ||
} | ||
|
||
function util::print::info() { | ||
local message | ||
message="${1}" | ||
|
||
echo -e "${message}" >&2 | ||
} | ||
|
||
function util::print::error() { | ||
local message red reset | ||
message="${1}" | ||
red="\033[0;31m" | ||
reset="\033[0;39m" | ||
|
||
echo -e "${red}${message}${reset}" >&2 | ||
exit 1 | ||
} | ||
|
||
function util::print::success() { | ||
local message green reset | ||
message="${1}" | ||
green="\033[0;32m" | ||
reset="\033[0;39m" | ||
|
||
echo -e "${green}${message}${reset}" >&2 | ||
exitcode="${2:-0}" | ||
exit "${exitcode}" | ||
} | ||
|
||
function util::print::warn() { | ||
local message yellow reset | ||
message="${1}" | ||
yellow="\033[0;33m" | ||
reset="\033[0;39m" | ||
|
||
echo -e "${yellow}${message}${reset}" >&2 | ||
exit 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
set -o pipefail | ||
|
||
# shellcheck source=SCRIPTDIR/print.sh | ||
source "$(dirname "${BASH_SOURCE[0]}")/print.sh" | ||
|
||
function util::tools::tests::checkfocus() { | ||
testout="${1}" | ||
if grep -q 'Focused: [1-9]' "${testout}"; then | ||
echo "Detected Focused Test(s) - setting exit code to 197" | ||
rm "${testout}" | ||
util::print::success "** GO Test Succeeded **" 197 | ||
fi | ||
rm "${testout}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
set -o pipefail | ||
|
||
readonly PROGDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
readonly BUILDPACKDIR="$(cd "${PROGDIR}/.." && pwd)" | ||
|
||
# shellcheck source=SCRIPTDIR/.util/tools.sh | ||
source "${PROGDIR}/.util/tools.sh" | ||
|
||
# shellcheck source=SCRIPTDIR/.util/print.sh | ||
source "${PROGDIR}/.util/print.sh" | ||
|
||
function main() { | ||
while [[ "${#}" != 0 ]]; do | ||
case "${1}" in | ||
--help|-h) | ||
shift 1 | ||
usage | ||
exit 0 | ||
;; | ||
|
||
"") | ||
# skip if the argument is empty | ||
shift 1 | ||
;; | ||
|
||
*) | ||
util::print::error "unknown argument \"${1}\"" | ||
esac | ||
done | ||
|
||
unit::run | ||
} | ||
|
||
function usage() { | ||
cat <<-USAGE | ||
unit.sh [OPTIONS] | ||
Runs the unit test suite. | ||
OPTIONS | ||
--help -h prints the command usage | ||
USAGE | ||
} | ||
|
||
function unit::run() { | ||
util::print::title "Run Library pack Unit and Example Tests" | ||
|
||
testout=$(mktemp) | ||
pushd "${BUILDPACKDIR}" > /dev/null | ||
if go test ./... -v | tee "${testout}"; then | ||
util::tools::tests::checkfocus "${testout}" | ||
util::print::success "** GO Test Succeeded **" | ||
else | ||
util::print::error "** GO Test Failed **" | ||
fi | ||
popd > /dev/null | ||
} | ||
|
||
main "${@:-}" |