Skip to content

Commit 490a5e2

Browse files
committed
improvements to testreport; fix in provisioner to encode json properly
1 parent 220e39b commit 490a5e2

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

.github/workflows/sliderule-testreport.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ jobs:
1212
env:
1313
SLIDERULE_GITHUB_TOKEN: ${{ secrets.SESSION_PAT }}
1414
run: |
15-
set -e # stop workflow if curl exits non-zero
16-
JWT=$(curl -s https://login.slideruleearth.io/auth/github/pat -d "{\"pat\":\"$SLIDERULE_GITHUB_TOKEN\"}" | jq -r '.token')
17-
curl -X POST -H "Authorization: Bearer $JWT" https://provisioner.slideruleearth.io/report/tests | jq -e '.report.status'
15+
set -euo pipeline # stop workflow if curl exits non-zero
16+
JWT=$(curl -fsS https://login.slideruleearth.io/auth/github/pat -d "{\"pat\":\"$SLIDERULE_GITHUB_TOKEN\"}" | jq -r '.token')
17+
REPORT=$(curl -fsS -X POST -H "Authorization: Bearer $JWT" https://provisioner.slideruleearth.io/report/tests)
18+
REPORT_EPOCH=$(date -d "$(echo $REPORT | jq -r '.report.date')" +%s)
19+
TODAY_EPOCH=$(date -d "$(date +%F)" +%s)
20+
jq -e '.report.status == true' <<< "$REPORT" > /dev/null # check success
21+
(( REPORT_EPOCH >= TODAY_EPOCH )) # check test ran today

applications/provisioner/provisioner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def report_tests_handler(event, context):
338338

339339
# read test summary
340340
with open(f"/tmp/{summary_file}", "r") as file:
341-
state["report"] = file.read()
341+
state["report"] = json.loads(file.read())
342342

343343
except Exception as e:
344344

0 commit comments

Comments
 (0)