Skip to content

Commit 54366ef

Browse files
committed
Updated Tinybird CI to trigger & follow infra workflow
Ghost CI now triggers & waits for the dispatched traffic analytics workflow and mirrors its final result.
1 parent 0123e5c commit 54366ef

2 files changed

Lines changed: 46 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -738,11 +738,6 @@ jobs:
738738
image: tinybirdco/tinybird-local:latest
739739
ports:
740740
- 7181:7181
741-
env:
742-
TINYBIRD_HOST: ${{ secrets.TINYBIRD_HOST }}
743-
TINYBIRD_TOKEN: ${{ secrets.TINYBIRD_TOKEN }}
744-
TINYBIRD_HOST_STAGING: ${{ secrets.TINYBIRD_HOST_STAGING }}
745-
TINYBIRD_TOKEN_STAGING: ${{ secrets.TINYBIRD_TOKEN_STAGING }}
746741
steps:
747742
- uses: actions/checkout@v6
748743
- name: Install Tinybird CLI
@@ -751,10 +746,51 @@ jobs:
751746
run: tb build
752747
- name: Test project
753748
run: tb test run
754-
- name: Deployment check - Staging
755-
run: tb --cloud --host ${{ env.TINYBIRD_HOST_STAGING }} --token ${{ env.TINYBIRD_TOKEN_STAGING }} deploy --check
756-
- name: Deployment check - Production
757-
run: tb --cloud --host ${{ env.TINYBIRD_HOST }} --token ${{ env.TINYBIRD_TOKEN }} deploy --check
749+
- name: Trigger and watch traffic analytics infra Tinybird workflow
750+
if: github.repository == 'TryGhost/Ghost'
751+
env:
752+
GH_TOKEN: ${{ secrets.TRAFFIC_ANALYTICS_GITHUB_TOKEN }}
753+
run: |
754+
set -euo pipefail
755+
756+
REPO="TryGhost/traffic-analytics-infra"
757+
WORKFLOW="tinybird.yml"
758+
BRANCH="main"
759+
DISPATCHED_AT=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
760+
761+
gh workflow run "$WORKFLOW" \
762+
--repo "$REPO" \
763+
--ref "$BRANCH" \
764+
-f ghost_ref='${{ github.ref }}' \
765+
-f run_local_tests='false'
766+
767+
RUN_ID=""
768+
RUN_URL=""
769+
770+
for attempt in {1..30}; do
771+
RUN_ID=$(gh run list \
772+
--repo "$REPO" \
773+
--workflow "$WORKFLOW" \
774+
--branch "$BRANCH" \
775+
--event workflow_dispatch \
776+
--json databaseId,createdAt,url \
777+
--jq 'map(select(.createdAt >= "'"$DISPATCHED_AT"'")) | sort_by(.createdAt) | last | .databaseId // empty')
778+
779+
if [ -n "$RUN_ID" ]; then
780+
RUN_URL=$(gh run view "$RUN_ID" --repo "$REPO" --json url --jq '.url')
781+
break
782+
fi
783+
784+
sleep 5
785+
done
786+
787+
if [ -z "$RUN_ID" ]; then
788+
echo "::error::Unable to find the triggered workflow run in $REPO"
789+
exit 1
790+
fi
791+
792+
echo "Watching remote workflow run: $RUN_URL"
793+
gh run watch "$RUN_ID" --repo "$REPO" --exit-status
758794
759795
job_ghost-cli:
760796
name: Ghost-CLI tests

ghost/core/core/server/data/tinybird/tests/api_kpis.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
23
- name: Date range
34
description: All fixture data
45
parameters: site_uuid=mock_site_uuid&date_from=2100-01-01&date_to=2100-01-07

0 commit comments

Comments
 (0)