-
-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathaction.yml
More file actions
76 lines (66 loc) · 2.5 KB
/
action.yml
File metadata and controls
76 lines (66 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Install bashunit
description: Install the bashunit testing framework binary at a pinned, immutable version.
author: TypedDevs
branding:
icon: check-circle
color: green
inputs:
version:
description: 'bashunit version to install (e.g. "0.37.0"). Defaults to the version pinned at this action ref. Pass "latest" to override.'
required: false
default: '0.39.1'
directory:
description: 'Directory, relative to the workspace, where the bashunit binary is installed.'
required: false
default: lib
add-to-path:
description: 'Add the install directory to $GITHUB_PATH so you can run "bashunit" directly.'
required: false
default: 'true'
verify-checksum:
description: 'Verify the downloaded binary against the release sha256 checksum asset.'
required: false
default: 'true'
args:
description: 'If set, run "bashunit <args>" after installing (e.g. "tests/ --strict"). Empty = install only.'
required: false
default: ''
outputs:
path:
description: Path to the installed bashunit binary, relative to the workspace.
value: ${{ steps.install.outputs.path }}
version:
description: The installed bashunit version (e.g. "0.37.0").
value: ${{ steps.install.outputs.version }}
runs:
using: composite
steps:
- id: install
shell: bash
env:
BASHUNIT_VERSION: ${{ inputs.version }}
BASHUNIT_DIRECTORY: ${{ inputs.directory }}
BASHUNIT_ADD_TO_PATH: ${{ inputs.add-to-path }}
BASHUNIT_VERIFY_CHECKSUM: ${{ inputs.verify-checksum }}
BASHUNIT_ARGS: ${{ inputs.args }}
BASHUNIT_ACTION_PATH: ${{ github.action_path }}
run: |
set -euo pipefail
target_dir="$BASHUNIT_DIRECTORY"
case "$target_dir" in
/*) ;;
*) target_dir="$GITHUB_WORKSPACE/$target_dir" ;;
esac
"$BASHUNIT_ACTION_PATH/install.sh" "$target_dir" "$BASHUNIT_VERSION"
echo "path=$BASHUNIT_DIRECTORY/bashunit" >> "$GITHUB_OUTPUT"
version="$(NO_COLOR=1 "$target_dir/bashunit" --version | awk 'NR==1{print $NF}')"
echo "version=$version" >> "$GITHUB_OUTPUT"
if [ "$BASHUNIT_ADD_TO_PATH" = "true" ]; then
echo "$target_dir" >> "$GITHUB_PATH"
fi
# Optionally run the suite. Word-splitting of $BASHUNIT_ARGS is intentional
# so callers can pass multiple CLI arguments as a single string.
if [ -n "$BASHUNIT_ARGS" ]; then
# shellcheck disable=SC2086
"$target_dir/bashunit" $BASHUNIT_ARGS
fi