-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathaction.yaml
More file actions
124 lines (107 loc) · 3.37 KB
/
action.yaml
File metadata and controls
124 lines (107 loc) · 3.37 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
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
name: "DDEV add-on test"
author: "Julien Loizelet"
description: "A Github Action to run DDEV add-on tests"
inputs:
ddev_version:
type: choice
required: false
default: "stable"
description: "DDEV Version to use"
options:
- "stable"
- "HEAD"
addon_repository:
description: "Repository of the tested addon"
required: true
addon_ref:
description: "Repository ref of the tested addon"
required: true
addon_path:
description: "Path to clone the addon"
required: false
default: "./"
debug_enabled:
type: boolean
description: "Debug with tmate"
required: false
default: false
disable_checkout_action:
type: boolean
description: "Disable addon checkout action"
required: false
default: false
token:
description: "A Github PAT"
required: true
test_command:
description: "Test command to run"
required: false
default: ""
runs:
using: "composite"
steps:
- uses: Homebrew/actions/setup-homebrew@675fcd27b59e54d310c5484c8c27c01d03da660c #no release tags available
- name: Environment setup
shell: bash
run: |
# For bats-assert and friends
brew tap bats-core/bats-core >/dev/null
brew install bats-core bats-file bats-assert bats-support jq mkcert yq >/dev/null
mkcert -install
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
if: inputs.disable_checkout_action == 'false'
with:
repository: ${{ inputs.addon_repository }}
ref: ${{ inputs.addon_ref }}
path: ${{ inputs.addon_path }}
- name: Use ddev stable
shell: bash
if: inputs.ddev_version == 'stable'
run: brew install ddev/ddev/ddev >/dev/null
- name: Use ddev HEAD
shell: bash
if: inputs.ddev_version == 'HEAD'
run: brew install --HEAD ddev/ddev/ddev >/dev/null
- name: Download docker images
shell: bash
run: ddev debug download-images >/dev/null
- uses: mxschmitt/action-tmate@c0afd6f790e3a5564914980036ebf83216678101 #v3.23
with:
limit-access-to-actor: true
github-token: ${{ inputs.token }}
if: inputs.debug_enabled == 'true'
- name: Run test
env:
# Allow ddev get to use a GitHub token to prevent rate limiting by tests
DDEV_GITHUB_TOKEN: ${{ inputs.token }}
# Don't try interactive behaviors
DDEV_NONINTERACTIVE: "true"
# Don't send telemetry to amplitude
DDEV_NO_INSTRUMENTATION: "true"
# Use test_command input if provided
TEST_COMMAND_INPUT: ${{ inputs.test_command }}
# Use the addon path
ADDON_PATH: ${{ inputs.addon_path }}
# Use the event name
GITHUB_EVENT_NAME: ${{ github.event_name }}
shell: bash
# Use of "set +H" to ensure that bash history expansion is disabled so that ! can be used in test command
run: |
set +H
if [ -n "$TEST_COMMAND_INPUT" ]; then
TEST_COMMAND="$TEST_COMMAND_INPUT"
else
case "$GITHUB_EVENT_NAME" in
"push"|"pull_request")
TEST_COMMAND="bats tests --filter-tags !release"
;;
*)
TEST_COMMAND="bats tests"
;;
esac
fi
echo "Running: $TEST_COMMAND in $ADDON_PATH"
cd $ADDON_PATH && $TEST_COMMAND
branding:
icon: "code"
color: "blue"