From 7947b9fd79a1631189ad6bd40ccd3ae5a262b4aa Mon Sep 17 00:00:00 2001 From: Vu Tung Date: Thu, 27 Nov 2025 18:00:39 +0700 Subject: [PATCH 1/9] Add workflow sanity test CI --- .github/workflows/sanity-test.yml | 25 ++++++++++++++ .../workflows/scripts/workflow-sanity-test.sh | 33 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 .github/workflows/sanity-test.yml create mode 100755 .github/workflows/scripts/workflow-sanity-test.sh diff --git a/.github/workflows/sanity-test.yml b/.github/workflows/sanity-test.yml new file mode 100644 index 0000000..4738b8b --- /dev/null +++ b/.github/workflows/sanity-test.yml @@ -0,0 +1,25 @@ +name: Sanity test + +on: + push: + branches: + - main + pull_request: + create: + +jobs: + + workflow-sanity-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - name: Install td + run: | + gem install td + - name: Run workflow sanity test + env: + TD_API_ENDPOINT: https://api.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 diff --git a/.github/workflows/scripts/workflow-sanity-test.sh b/.github/workflows/scripts/workflow-sanity-test.sh new file mode 100755 index 0000000..f3a6f53 --- /dev/null +++ b/.github/workflows/scripts/workflow-sanity-test.sh @@ -0,0 +1,33 @@ +#!/bin/bash +set -euo pipefail + +echo "${TD_API_ENDPOINT}" +echo "${TD_API_KEY}" + +RESPONSE=$(td -e "${TD_API_ENDPOINT}" -k "${TD_API_KEY}" workflow start aki_pytd_test aki_pytd_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 From 81ee5e9bf53849ff82047322e6988ae586d25168 Mon Sep 17 00:00:00 2001 From: Vu Tung Date: Thu, 27 Nov 2025 18:02:20 +0700 Subject: [PATCH 2/9] Temporarily allow sanity test on feature branch --- .github/workflows/sanity-test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/sanity-test.yml b/.github/workflows/sanity-test.yml index 4738b8b..c55ec20 100644 --- a/.github/workflows/sanity-test.yml +++ b/.github/workflows/sanity-test.yml @@ -2,8 +2,6 @@ name: Sanity test on: push: - branches: - - main pull_request: create: From 5152ff9672aa890a9b9508ac4a0024b2856faea2 Mon Sep 17 00:00:00 2001 From: Vu Tung Date: Thu, 27 Nov 2025 18:09:27 +0700 Subject: [PATCH 3/9] Add ruby/setup-ruby@v1 --- .github/workflows/sanity-test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/sanity-test.yml b/.github/workflows/sanity-test.yml index c55ec20..38762b5 100644 --- a/.github/workflows/sanity-test.yml +++ b/.github/workflows/sanity-test.yml @@ -11,6 +11,9 @@ jobs: 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 From 1807e9ed237ad9d8dc0ddf6f41a72e3c37b3ce79 Mon Sep 17 00:00:00 2001 From: Vu Tung Date: Thu, 27 Nov 2025 18:12:27 +0700 Subject: [PATCH 4/9] Add install workflow module step --- .github/workflows/sanity-test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/sanity-test.yml b/.github/workflows/sanity-test.yml index 38762b5..a97db5c 100644 --- a/.github/workflows/sanity-test.yml +++ b/.github/workflows/sanity-test.yml @@ -17,6 +17,9 @@ jobs: - name: Install td run: | gem install td + - name: Install workflow module + run: | + yes | td workflow - name: Run workflow sanity test env: TD_API_ENDPOINT: https://api.treasuredata.com From 64558298c8643c590f285954cde0d6d9a0b3cb0d Mon Sep 17 00:00:00 2001 From: Vu Tung Date: Thu, 27 Nov 2025 18:14:42 +0700 Subject: [PATCH 5/9] Add env variables for Install workflow module step --- .github/workflows/sanity-test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/sanity-test.yml b/.github/workflows/sanity-test.yml index a97db5c..c6164ed 100644 --- a/.github/workflows/sanity-test.yml +++ b/.github/workflows/sanity-test.yml @@ -18,6 +18,9 @@ jobs: 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 workflow - name: Run workflow sanity test From f8044f7e367825bb5ec96a53ba7e2470c181cf27 Mon Sep 17 00:00:00 2001 From: Vu Tung Date: Thu, 27 Nov 2025 18:17:35 +0700 Subject: [PATCH 6/9] . --- .github/workflows/sanity-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sanity-test.yml b/.github/workflows/sanity-test.yml index c6164ed..59d7c39 100644 --- a/.github/workflows/sanity-test.yml +++ b/.github/workflows/sanity-test.yml @@ -22,7 +22,7 @@ jobs: TD_API_ENDPOINT: https://api.treasuredata.com TD_API_KEY: ${{ secrets.TD_API_KEY }} run: | - yes | td workflow + yes | td -e "${TD_API_ENDPOINT}" -k "${TD_API_KEY}" workflow - name: Run workflow sanity test env: TD_API_ENDPOINT: https://api.treasuredata.com From 9d68e8595b7e4a28b41d9ca6e1d624b595d05f6e Mon Sep 17 00:00:00 2001 From: Vu Tung Date: Fri, 28 Nov 2025 17:49:05 +0700 Subject: [PATCH 7/9] Use td-client-python-sanity-test workflow --- .github/workflows/sanity-test.yml | 2 +- .github/workflows/scripts/workflow-sanity-test.sh | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sanity-test.yml b/.github/workflows/sanity-test.yml index 59d7c39..7887af9 100644 --- a/.github/workflows/sanity-test.yml +++ b/.github/workflows/sanity-test.yml @@ -25,7 +25,7 @@ jobs: yes | td -e "${TD_API_ENDPOINT}" -k "${TD_API_KEY}" workflow - name: Run workflow sanity test env: - TD_API_ENDPOINT: https://api.treasuredata.com + 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 diff --git a/.github/workflows/scripts/workflow-sanity-test.sh b/.github/workflows/scripts/workflow-sanity-test.sh index f3a6f53..9072fdf 100755 --- a/.github/workflows/scripts/workflow-sanity-test.sh +++ b/.github/workflows/scripts/workflow-sanity-test.sh @@ -1,10 +1,7 @@ #!/bin/bash set -euo pipefail -echo "${TD_API_ENDPOINT}" -echo "${TD_API_KEY}" - -RESPONSE=$(td -e "${TD_API_ENDPOINT}" -k "${TD_API_KEY}" workflow start aki_pytd_test aki_pytd_test --session now) +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 From ba7a0d9a59c096611f3143e65b8bba57271f6cbe Mon Sep 17 00:00:00 2001 From: Vu Tung Date: Fri, 28 Nov 2025 18:24:34 +0700 Subject: [PATCH 8/9] Run sanity test on push to main --- .github/workflows/sanity-test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/sanity-test.yml b/.github/workflows/sanity-test.yml index 7887af9..936e0ff 100644 --- a/.github/workflows/sanity-test.yml +++ b/.github/workflows/sanity-test.yml @@ -2,6 +2,8 @@ name: Sanity test on: push: + branches: + - main pull_request: create: From 03c78d49c406a092e8865158e7e684c471616ad0 Mon Sep 17 00:00:00 2001 From: Vu Tung Date: Fri, 28 Nov 2025 18:34:33 +0700 Subject: [PATCH 9/9] Only run sanity test on push to main --- .github/workflows/sanity-test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/sanity-test.yml b/.github/workflows/sanity-test.yml index 936e0ff..11ee2e6 100644 --- a/.github/workflows/sanity-test.yml +++ b/.github/workflows/sanity-test.yml @@ -4,8 +4,6 @@ on: push: branches: - main - pull_request: - create: jobs: