-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
135 lines (125 loc) · 4.19 KB
/
action.yml
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: "Run Leia Action"
description: "A GitHub Action for running Leia tests."
branding:
color: purple
icon: package
inputs:
# Required
leia-test:
description: "The Leia test file to parse and run."
required: true
# Optional
debug:
description: "Toggle debug output. (deprecated). Use https://github.blog/changelog/2022-05-24-github-actions-re-run-jobs-with-debug-logging/ instead."
required: false
default: false
cleanup-header:
description: "The cleanup headers to parse."
required: false
default: "Clean,Tear,Burn"
lagoon-mode:
description: "Turn on Lagoon mode."
required: false
default: false
retry:
description: "The amount of times to retry the test."
required: false
default: 1
setup-header:
description: "The setup headers to parse."
required: false
default: "Start,Setup,This is the dawning"
shell:
description: "The shell to use."
required: false
default: auto
stdin:
description: "Attach stdin when the tests are run."
default: false
required: false
test-header:
description: "The test headers to parse."
required: false
default: "Test,Validat,Verif"
timeout:
description: "The amount of time for the test to run before a timeout, in seconds."
required: false
default: 1800
version:
description: "The fallback global version of Leia to install if no local version is detected."
required: false
default: "latest"
runs:
using: composite
steps:
- name: Validate required inputs
shell: bash
run: |
if [ "${{ inputs.leia-test }}" == "" ]; then
echo "::error title=leia-test is not set!::You must specify a test file to parse and run."
exit 10
fi
if [ ! -f "${{ inputs.leia-test }}" ]; then
echo "::error title=Could not find ${{ inputs.leia-test }}!::${{ inputs.leia-test }} does not seem to exist."
exit 11
fi
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
- name: Add local bin to PATH
shell: bash
run: echo "$GITHUB_WORKSPACE/node_modules/.bin" >> $GITHUB_PATH
- name: Ensure Leia is installed
shell: bash
run: |
if ! leia --version &>/dev/null; then
echo "::group::Globally installing @lando/leia@${{ inputs.version }}"
npm install --global @lando/leia@${{ inputs.version }}
echo "::endgroup::"
fi
if ! leia --version &>/dev/null; then
echo "::error title=Cannot run leia::Cannot seem to find the Leia binary!"
exit 11
fi
- name: Activate Lagoon Mode
if: runner.os == 'Linux' && inputs.lagoon-mode == 'true'
shell: bash
run: |
echo "::group::Activating Lagoon Mode"
set -x
sudo apt-get remove mysql-server --purge
sudo apt-get install apparmor-profiles
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
echo "::endgroup::"
- name: Run Leia tests
shell: bash
run: |
# DO THE OPTS
OPTS=
# SHELL
if [ "${{ inputs.shell }}" != "auto" ]; then
OPTS="$OPTS --shell=${{ inputs.shell }}"
fi
# STDIN
if [ "${{ inputs.stdin }}" == "true" ]; then
OPTS="$OPTS --stdin"
fi
# DEBUG
if [ "${{ runner.debug }}" == "1" ]; then
OPTS="$OPTS --debug"
elif [ "${{ inputs.debug }}" == "true" ]; then
OPTS="$OPTS --debug"
fi
echo "::group::Leia information"
echo "bin: $(which leia)"
echo "version: $(leia --version)"
echo "command: leia ${{ inputs.leia-test }} --cleanup-header=\"${{ inputs.cleanup-header }}\" --retry=${{ inputs.retry }} --setup-header=\"${{ inputs.setup-header }}\" --test-header=\"${{ inputs.test-header }}\" --timeout=\"${{ inputs.timeout }}\" $OPTS"
echo "::endgroup::"
leia ${{ inputs.leia-test }} \
--setup-header="${{ inputs.setup-header }}" \
--test-header="${{ inputs.test-header }}" \
--cleanup-header="${{ inputs.cleanup-header }}" \
--timeout="${{ inputs.timeout }}" \
--retry=${{ inputs.retry }} $OPTS