Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/sanity-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Sanity test

on:
push:
branches:
- main

jobs:

workflow-sanity-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
- name: Install td
run: |
gem install td
- name: Install workflow module
env:
TD_API_ENDPOINT: https://api.treasuredata.com
TD_API_KEY: ${{ secrets.TD_API_KEY }}
run: |
yes | td -e "${TD_API_ENDPOINT}" -k "${TD_API_KEY}" workflow
- name: Run workflow sanity test
env:
TD_API_ENDPOINT: https://api-development.treasuredata.com
TD_API_KEY: ${{ secrets.TD_API_KEY }}
run: |
chmod +x .github/workflows/scripts/workflow-sanity-test.sh
.github/workflows/scripts/workflow-sanity-test.sh
30 changes: 30 additions & 0 deletions .github/workflows/scripts/workflow-sanity-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -euo pipefail

RESPONSE=$(td -e "${TD_API_ENDPOINT}" -k "${TD_API_KEY}" workflow start td-client-python-sanity-test td-client-python-sanity-test --session now)
SESSION_ID=$(echo "${RESPONSE}" | sed -nE 's/^[ \t]*session id:[ \t]+([0-9]+)$/\1/p')

if [ -z "${SESSION_ID}" ]; then
echo "Failed to start workflow session: ${SESSION_ID}"
exit 1
else
echo "Started workflow session with ID: ${SESSION_ID}"
fi

until false
do
STATUS=$(td -e "${TD_API_ENDPOINT}" -k "${TD_API_KEY}" workflow session ${SESSION_ID} | sed -nE 's/[ \t]*status:[ \t]+(.*)/\1/p')
if [ "${STATUS}" = "success" ]; then
echo "Workflow completed successfully."
exit 0
elif [ "${STATUS}" = "error" ]; then
echo "Workflow failed."
exit 1
elif [ "${STATUS}" = "running" ]; then
echo "Workflow running. Waiting for completion..."
sleep 10
else
echo "Unknown status: ${STATUS}. Exiting."
exit 1
fi
done