Skip to content

Commit 38a118f

Browse files
committed
windows runner fix
1 parent 68cbe84 commit 38a118f

File tree

2 files changed

+36
-46
lines changed

2 files changed

+36
-46
lines changed

.github/workflows/npm-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Build and Test'
1+
name: 'npm test'
22
on:
33
pull_request:
44

.github/workflows/stackql-exec-test.yml

Lines changed: 35 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'StackQL Exec Test'
1+
name: 'stackql query tests'
22

33
on:
44
push:
@@ -132,63 +132,53 @@ jobs:
132132
- name: validate stackql outputs
133133
shell: bash
134134
run: |
135-
# Test `stackql-command`
136-
output="${{ steps.stackql-command.outputs.stackql-command-output }}"
137-
all_passed=true
138-
echo "$output" | while IFS= read -r line; do
139-
# Skip empty lines
140-
if [[ -z "$line" ]]; then
141-
continue
142-
fi
143-
# Validate against a simple keyword presence
144-
if ! echo "$line" | grep -qi "provider" || ! echo "$line" | grep -qi "version" || ! echo "$line" | grep -qi "successfully installed"; then
145-
echo "Failed line: $line"
146-
all_passed=false
147-
fi
148-
done
149-
if [[ "$all_passed" == "false" ]]; then
150-
echo "One or more lines in the output failed to match the expected format."
151-
exit 1
135+
# Check stackql-command output
136+
if echo "${{ steps.stackql-command.outputs.stackql-command-output }}" | grep -qE "provider, version 'v[0-9.]+' successfully installed"; then
137+
echo "stackql-command output is valid."
152138
else
153-
echo "All lines in the output match the expected format."
139+
echo "stackql-command output is invalid."
140+
exit 1
154141
fi
155142
156-
# Test JSON output
157-
json_output="${{ steps.stackql-query.outputs.stackql-query-results }}"
158-
if ! echo "$json_output" | jq empty; then
159-
echo "JSON output is not valid."
143+
# Check JSON output from stackql-query
144+
if ! echo "${{ steps.stackql-query.outputs.stackql-query-results }}" | jq empty; then
145+
echo "JSON output from stackql-query is invalid."
160146
exit 1
161147
fi
162148
163-
# Test CSV output
164-
csv_output="${{ steps.stackql-query-csv-output.outputs.stackql-query-results }}"
165-
IFS=',' read -ra ADDR <<< "$(echo "$csv_output" | head -n 1)"
166-
if [ "${ADDR[0]}" != "visibility" ] || [ "${ADDR[1]}" != "number_of_repos" ]; then
167-
echo "CSV header does not match expected format."
149+
# Check CSV output from stackql-query-csv-output
150+
csv_header="${{ steps.stackql-query-csv-output.outputs.stackql-query-results }}"
151+
if ! echo "$csv_header" | head -n 1 | grep -q "visibility,number_of_repos"; then
152+
echo "CSV header from stackql-query-csv-output is invalid."
168153
exit 1
169154
fi
170155
171-
# Test Table output
172-
table_output="${{ steps.stackql-query-table-output.outputs.stackql-query-results }}"
173-
table_header=$(echo "$table_output" | sed -n 2p)
174-
if [[ "$table_header" != "| visibility | number_of_repos |" ]]; then
175-
echo "Table header does not match expected format."
156+
# Check Table output from stackql-query-table-output
157+
table_header="${{ steps.stackql-query-table-output.outputs.stackql-query-results }}"
158+
if ! echo "$table_header" | sed -n 2p | grep -q "| visibility | number_of_repos |"; then
159+
echo "Table header from stackql-query-table-output is invalid."
176160
exit 1
177161
fi
178162
179-
# Test Text output (similar to CSV)
163+
# Check Text output from stackql-query-text-output
180164
text_output="${{ steps.stackql-query-text-output.outputs.stackql-query-results }}"
181-
IFS=',' read -ra ADDR <<< "$(echo "$text_output" | head -n 1)"
182-
if [ "${ADDR[0]}" != "visibility" ] || [ "${ADDR[1]}" != "number_of_repos" ]; then
183-
echo "Text output does not match expected CSV format."
165+
if ! echo "$text_output" | head -n 1 | grep -q "visibility,number_of_repos"; then
166+
echo "Text output from stackql-query-text-output is invalid."
167+
exit 1
168+
fi
169+
170+
# Check outputs from files and variable dependent queries
171+
if ! echo "${{ steps.stackql-query-file.outputs.stackql-query-results }}" | jq empty; then
172+
echo "JSON output from stackql-query-file is invalid."
184173
exit 1
185174
fi
186175
187-
# Additional tests for JSON outputs from file, with vars, and with data file
188-
for step_id in stackql-query-file stackql-query-file-with-vars stackql-query-file-with-data-file-and-vars; do
189-
json_output="${{ steps[step_id].outputs.stackql-query-results }}"
190-
if ! echo "$json_output" | jq empty; then
191-
echo "$step_id output is not valid JSON."
192-
exit 1
193-
fi
194-
done
176+
if ! echo "${{ steps.stackql-query-file-with-vars.outputs.stackql-query-results }}" | jq empty; then
177+
echo "JSON output from stackql-query-file-with-vars is invalid."
178+
exit 1
179+
fi
180+
181+
if ! echo "${{ steps.stackql-query-file-with-data-file-and-vars.outputs.stackql-query-results }}" | jq empty; then
182+
echo "JSON output from stackql-query-file-with-data-file-and-vars is invalid."
183+
exit 1
184+
fi

0 commit comments

Comments
 (0)