-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathaction.yaml
More file actions
129 lines (112 loc) · 3.63 KB
/
Copy pathaction.yaml
File metadata and controls
129 lines (112 loc) · 3.63 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
125
126
127
128
129
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@54f3c3de99e48b2646ca31230c9b6e9717dac4d4 # https://github.com/Homebrew/actions/commits/main/setup-homebrew/
with:
setup-sandbox: true
- name: Environment setup
shell: bash
run: |
brew trust bats-core/bats-core
brew install bats-core bats-core/bats-core/bats-assert bats-core/bats-core/bats-file bats-core/bats-core/bats-support jq mkcert yq >/dev/null
mkcert -install
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # https://github.com/actions/checkout/commits/v6.0.3/
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 trust ddev/ddev
brew install ddev/ddev/ddev >/dev/null
- name: Use ddev HEAD
shell: bash
if: inputs.ddev_version == 'HEAD'
run: |
brew trust ddev/ddev
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@35b54afac29c97fb54faba5b513f8fbd1882f113 # https://github.com/mxschmitt/action-tmate/commits/v3.24/
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"