-
-
Notifications
You must be signed in to change notification settings - Fork 0
188 lines (174 loc) · 6.65 KB
/
test.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
177
178
179
180
181
182
183
184
185
186
187
188
name: tests
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- published
schedule:
- cron: '30 19 * * *'
workflow_dispatch:
permissions: read-all
jobs:
tests:
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install fish shell
uses: fish-shop/install-fish-shell@ed88861095a17e8616ca577ffa3ec8d6209d0d2a # v1.0.39
- name: Create fish shell file with valid indentation
run: |
echo "\
function valid-indentation
echo "valid-indentation"
end" > ./valid-indentation.fish
shell: fish {0}
- name: Check indentation of valid fish shell file
id: passing-checks
continue-on-error: true
uses: ./
with:
patterns: valid-indentation.fish
title: 'Passing indentation checks summary'
- name: Check passing indentation checks outcome
run: |
if test "${{ steps.passing-checks.outcome }}" != "success"
echo "Action is expected to succeed for file with valid indentation"
exit 1
end
shell: fish {0}
- name: Check passing indentation checks output parameters
env:
TOTAL: ${{ steps.passing-checks.outputs.total }}
PASSED: ${{ steps.passing-checks.outputs.passed }}
FAILED: ${{ steps.passing-checks.outputs.failed }}
run: |
set failures 0
set expected_total 1
if test "$TOTAL" != "$expected_total"
echo "Output parameter 'total' should equal $expected_total (got '$TOTAL')"
set failures (math $failures + 1)
else
echo "Output parameter 'total' equals expected value $expected_total"
end
set expected_passes 1
if test "$PASSED" != "$expected_passes"
echo "Output parameter 'passed' should equal $expected_passes (got '$PASSED')"
set failures (math $failures + 1)
else
echo "Output parameter 'passed' equals expected value $expected_passes"
end
set expected_failures 0
if test "$FAILED" != "$expected_failures"
echo "Output parameter 'failed' should equal $expected_failures (got '$FAILED')"
set failures (math $failures + 1)
else
echo "Output parameter 'failed' equals expected value $expected_failures"
end
exit $failures
shell: fish {0}
- name: Create fish shell file with invalid indentation
run: |
echo "\
function invalid-indentation
echo "invalid-indentation"
end" > ./invalid-indentation.fish
shell: fish {0}
- name: Check indentation of invalid fish shell file
id: failing-checks
continue-on-error: true
uses: ./
with:
patterns: invalid-indentation.fish
title: 'Failing indentation checks summary'
- name: Check failing indentation checks outcome
run: |
if test "${{ steps.failing-checks.outcome }}" != "failure"
echo "Action is expected to fail for file with invalid indentation"
exit 1
end
shell: fish {0}
- name: Check failing indentation checks output parameters
env:
TOTAL: ${{ steps.failing-checks.outputs.total }}
PASSED: ${{ steps.failing-checks.outputs.passed }}
FAILED: ${{ steps.failing-checks.outputs.failed }}
run: |
set failures 0
set expected_total 1
if test "$TOTAL" != "$expected_total"
echo "Output parameter 'total' should equal $expected_total (got '$TOTAL')"
set failures (math $failures + 1)
else
echo "Output parameter 'total' equals expected value $expected_total"
end
set expected_passes 0
if test "$PASSED" != "$expected_passes"
echo "Output parameter 'passed' should equal $expected_passes (got '$PASSED')"
set failures (math $failures + 1)
else
echo "Output parameter 'passed' equals expected value $expected_passes"
end
set expected_failures 1
if test "$FAILED" != "$expected_failures"
echo "Output parameter 'failed' should equal $expected_failures (got '$FAILED')"
set failures (math $failures + 1)
else
echo "Output parameter 'failed' equals expected value $expected_failures"
end
exit $failures
shell: fish {0}
- name: Check indentation of mixed valid/invalid fish shell files
id: mixed-checks
continue-on-error: true
uses: ./
with:
patterns: 'valid-indentation.fish invalid-indentation.fish'
title: 'Mixed indentation checks summary'
- name: Check mixed valid/invalid indentation checks outcome
run: |
if test "${{ steps.mixed-checks.outcome }}" != "failure"
echo "Action is expected to fail for file with invalid indentation"
exit 1
end
shell: fish {0}
- name: Check mixed valid/invalid indentation checks output parameters
env:
TOTAL: ${{ steps.mixed-checks.outputs.total }}
PASSED: ${{ steps.mixed-checks.outputs.passed }}
FAILED: ${{ steps.mixed-checks.outputs.failed }}
run: |
set failures 0
set expected_total 2
if test "$TOTAL" != "$expected_total"
echo "Output parameter 'total' should equal $expected_total (got '$TOTAL')"
set failures (math $failures + 1)
else
echo "Output parameter 'total' equals expected value $expected_total"
end
set expected_passes 1
if test "$PASSED" != "$expected_passes"
echo "Output parameter 'passed' should equal $expected_passes (got '$PASSED')"
set failures (math $failures + 1)
else
echo "Output parameter 'passed' equals expected value $expected_passes"
end
set expected_failures 1
if test "$FAILED" != "$expected_failures"
echo "Output parameter 'failed' should equal $expected_failures (got '$FAILED')"
set failures (math $failures + 1)
else
echo "Output parameter 'failed' equals expected value $expected_failures"
end
exit $failures
shell: fish {0}