forked from department-of-veterans-affairs/va.gov-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.yml
176 lines (165 loc) · 6.48 KB
/
tests.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# If any of these test names get updated they need to be updated here too
# https://github.com/department-of-veterans-affairs/va.gov-cms/settings/branches
version: '3'
dotenv: ['.env']
output: 'group'
tasks:
# Any changes to test names or additions or removals must be updated in
# .github/workflows/set-tugboat-tests-pending.yml as well for the
# test to be required effectively.
va/tests/behat:
desc: Behat Tests
cmds:
- |
cat <<EOF | bash
: "${SKIP_REPORTING:=0}"
: "${RETURN_EXIT_CODE:=0}"
set -o pipefail
output="\$(mktemp -d)/output"
mkfifo \$output
(cat \$output&)
cd tests/behat
result="\$(time behat --strict --colors 2>&1 | tee \$output)"
exit_code=\$?
if [ "$SKIP_REPORTING" -ne 1 ]; then
if [ "\$exit_code" -eq 0 ]; then
github-status-updater -action=update_state -state=success -context='{{ .TASK }}' -description='Success'
else
github-status-updater -action=update_state -state=failure -context='{{ .TASK }}' -description='Failed'
fi
fi
if [ "$RETURN_EXIT_CODE" -ne 0 ]; then
exit "\$exit_code";
fi
EOF
va/tests/cypress:
desc: Accessibility and Behavioral tests with Cypress
cmds:
- |
cat <<EOF | bash
: "${SKIP_REPORTING:=0}"
: "${RETURN_EXIT_CODE:=0}"
set -o pipefail
output="\$(mktemp -d)/output"
mkfifo \$output
(cat \$output&)
result="\$(time composer va:test:cypress 2>&1 | tee \$output)"
exit_code=\$?
if [ "$SKIP_REPORTING" -ne 1 ]; then
if [ "\$exit_code" -eq 0 ]; then
github-status-updater -action=update_state -state=success -context='{{ .TASK }}' -description='Success'
else
github-status-updater -action=update_state -state=failure -context='{{ .TASK }}' -description='Failed'
node tests/report_cypress_accessibility_errors.js
fi
fi
if [ "$RETURN_EXIT_CODE" -ne 0 ]; then
exit "\$exit_code";
fi
EOF
va/tests/phplint:
desc: PHP Lint
cmds:
- |
cat <<EOF | bash
: "${SKIP_REPORTING:=0}"
: "${RETURN_EXIT_CODE:=0}"
exit_code=0
result="{{ .TASK }}<br/><br/>"
trap '{ (( exit_code |=\$? )); result+="\$output_text<br/>"; }' ERR
output_text=\$(find docroot/modules/custom docroot/themes -name '*.inc' -o -name '*.php' -o -name '*.module' -o -name '*.install' -print0 | xargs -0 -n1 php -l 2>&1)
trap - ERR
if [ "$SKIP_REPORTING" -ne 1 ]; then
if [ "\$exit_code" -eq 0 ]; then
github-status-updater -action=update_state -state=success -context='{{ .TASK }}' -description='Success'
else
github-status-updater -action=update_state -state=failure -context='{{ .TASK }}' -description='Failed'
[ "\${GITHUB_COMMENT_TYPE}" == "pr" ] && github-commenter -delete-comment-regex="{{ .TASK }}" -comment="\${result}"
fi
fi
if [ "$RETURN_EXIT_CODE" -ne 0 ]; then
exit "\$exit_code";
fi
EOF
va/tests/phpunit:
desc: PHPUnit
cmds:
- |
cat <<EOF | bash
: "${SKIP_REPORTING:=0}"
: "${RETURN_EXIT_CODE:=0}"
set -o pipefail
output="\$(mktemp -d)/output"
mkfifo \$output
(cat \$output&)
result="\$(time phpunit --group functional --exclude-group disabled tests/phpunit --colors=always 2>&1 | tee \$output)"
exit_code=\$?
if [ "$SKIP_REPORTING" -ne 1 ]; then
if [ "\$exit_code" -eq 0 ]; then
github-status-updater -action=update_state -state=success -context='{{ .TASK }}' -description='Success'
else
github-status-updater -action=update_state -state=failure -context='{{ .TASK }}' -description='Failed'
fi
fi
if [ "$RETURN_EXIT_CODE" -ne 0 ]; then
exit "\$exit_code";
fi
EOF
va/tests/status-error:
desc: Check for Drupal status errors
cmds:
- |
cat <<EOF | bash
: "${SKIP_REPORTING:=0}"
: "${RETURN_EXIT_CODE:=0}"
set -o pipefail
output="\$(mktemp -d)/output"
mkfifo \$output
(cat \$output&)
lines=\$(drush $DRUSH_ALIAS core-requirements --format=list --ignore='update_core,update_contrib,"update status"' --severity=2 2>&1 | tee \$output)
line_count=\$(grep -c "\S" <<< \$lines)
if [ "$SKIP_REPORTING" -ne 1 ]; then
if [ "\$line_count" -eq 0 ]; then
github-status-updater -action=update_state -state=success -context='{{ .TASK }}' -description='Success: No Drupal status requirement errors were found.'
else
github-status-updater -action=update_state -state=failure -context='{{ .TASK }}' -description="Failed: \${line_count} Drupal status requirements found."
[ "\${GITHUB_COMMENT_TYPE}" == "pr" ] && github-commenter -delete-comment-regex="{{ .TASK }}" -comment="{{ .TASK }}:<br /><br /><pre>\$(drush $DRUSH_ALIAS core-requirements --severity=2)</pre>"
fi
fi
if [ "$RETURN_EXIT_CODE" -ne 0 ]; then
exit "\$line_count";
fi
EOF
va/tests/content-build-gql:
desc: Ensure that the content build graphql queries succeed
cmds:
- |
cat <<EOF | bash
: "${SKIP_REPORTING:=0}"
: "${RETURN_EXIT_CODE:=0}"
set -o pipefail
output="\$(mktemp -d)/output"
mkfifo \$output
(cat \$output&)
result="\$(composer va:test:content-build-gql 2>&1 | tee \$output)"
exit_code=\$?
if [ "$SKIP_REPORTING" -ne 1 ]; then
if [ "\$exit_code" -eq 0 ]; then
github-status-updater -action=update_state -state=success -context='{{ .TASK }}' -description='Success'
else
github-status-updater -action=update_state -state=failure -context='{{ .TASK }}' -description='Failed'
fi
fi
if [ "$RETURN_EXIT_CODE" -ne 0 ]; then
exit "\$exit_code";
fi
EOF
default:
desc:
deps:
- va/tests/behat
- va/tests/cypress
- va/tests/phplint
- va/tests/phpunit
- va/tests/status-error
- va/tests/content-build-gql