Skip to content

ci: add shared e2e-staging Slack summary script - #223

Merged
piotr-iohk merged 1 commit into
mainfrom
cursor/e2e-staging-slack-summary-412a
Sep 14, 2026
Merged

piotr-iohk merged 1 commit into
mainfrom
cursor/e2e-staging-slack-summary-412a

Conversation

@piotr-iohk

Copy link
Copy Markdown
Collaborator

Summary

Add a shared Slack summary script for Bitkit E2E Staging nightlies, enabling a single implementation for both bitkit-ios and bitkit-android app repos.

Changes

  • scripts/slack_summary.py: New script with e2e-staging CLI mode
  • scripts/test_slack_summary.py: Unit tests (14 tests covering status icons, platform display, message rendering)

Features

  • Posts plain {"text": ...} JSON to SLACK_WEBHOOK_URL via urllib (no Slack action dependency)
  • Skips gracefully (exit 0) if SLACK_WEBHOOK_URL is not set
  • Status icon helpers: :white_check_mark: success, :x: failure, :warning: cancelled, :fast_forward: skipped
  • Platform-aware title (iOS/Android)
  • Rejects unknown CLI modes with helpful error

Message Format

:x: Bitkit iOS E2E staging: failure
Time: 2026-09-14 07:07:11 UTC
Run attempt: 1
Run: https://github.com/synonymdev/bitkit-ios/actions/runs/12345
E2E tests ref: main
Repository: synonymdev/bitkit-ios

Jobs:
  build-staging: :white_check_mark: success
  e2e-branch: :white_check_mark: success
  e2e-tests-staging: :x: failure

Environment Variables for App Workflows

Required

Variable Description
SLACK_WEBHOOK_URL Slack incoming webhook URL
PLATFORM ios or android
STAGING_RESULT Overall workflow result (success/failure/cancelled/...)
BUILD_RESULT build-staging job result
E2E_BRANCH_RESULT e2e-branch job result
E2E_TESTS_RESULT e2e-tests-staging job result
RUN_URL GitHub Actions run URL
RUN_ATTEMPT Current run attempt number

Optional

Variable Description
E2E_TESTS_REF Resolved e2e-tests branch/ref
GITHUB_REPOSITORY Repository name (e.g. synonymdev/bitkit-ios)

Usage in App Workflows

Call from the slack-report job:

slack-report:
  if: always() && (github.event_name == 'schedule' || inputs.post_to_slack == 'true')
  needs: [build-staging, e2e-branch, e2e-tests-staging]
  runs-on: ubuntu-latest
  steps:
    - uses: actions/checkout@v4
      with:
        repository: synonymdev/bitkit-e2e-tests
        ref: ${{ needs.e2e-branch.outputs.e2e_branch }}
    - run: python3 scripts/slack_summary.py e2e-staging
      env:
        SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
        PLATFORM: ios  # or android
        STAGING_RESULT: ${{ needs.e2e-tests-staging.result }}
        BUILD_RESULT: ${{ needs.build-staging.result }}
        E2E_BRANCH_RESULT: ${{ needs.e2e-branch.result }}
        E2E_TESTS_RESULT: ${{ needs.e2e-tests-staging.result }}
        RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
        RUN_ATTEMPT: ${{ github.run_attempt }}
        E2E_TESTS_REF: ${{ needs.e2e-branch.outputs.e2e_branch }}
        GITHUB_REPOSITORY: ${{ github.repository }}

Related

Testing

cd scripts && python3 -m unittest test_slack_summary -v

All 14 tests pass.

Open in Web Open in Cursor 

Add scripts/slack_summary.py with 'e2e-staging' mode for posting workflow
summaries to Slack. This enables a shared implementation for both bitkit-ios
and bitkit-android E2E staging nightlies.

Features:
- CLI mode: e2e-staging (rejects unknown modes)
- Posts plain {"text": ...} to SLACK_WEBHOOK_URL via urllib
- Skips gracefully (exit 0) if SLACK_WEBHOOK_URL is unset
- Status icon helpers (checkmarks, X, warning, etc.)
- Platform-aware title (iOS/Android)

Required env vars for app workflows:
- SLACK_WEBHOOK_URL: Slack incoming webhook
- PLATFORM: ios|android
- STAGING_RESULT: overall workflow result
- BUILD_RESULT, E2E_BRANCH_RESULT, E2E_TESTS_RESULT: job results
- RUN_URL, RUN_ATTEMPT: GitHub Actions context
- E2E_TESTS_REF (optional): resolved e2e-tests branch

Includes unit tests in scripts/test_slack_summary.py.

Co-authored-by: piotr-iohk <piotr-iohk@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants