-
Notifications
You must be signed in to change notification settings - Fork 3
add ci workflow for e2e testing #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| name: Trigger Lightning Node E2E Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| # Need write permission to create status checks (optional) | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| trigger-e2e: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Verify token access to lightning-node repository | ||
| env: | ||
| LIGHTNING_NODE_REPO: ${{ vars.LIGHTNING_NODE_REPO || 'CumuloGlobal/lightning-node' }} | ||
| TOKEN: ${{ secrets.LIGHTNING_NODE_DISPATCH_TOKEN || secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| REPO_OWNER=$(echo "$LIGHTNING_NODE_REPO" | cut -d'/' -f1) | ||
| REPO_NAME=$(echo "$LIGHTNING_NODE_REPO" | cut -d'/' -f2) | ||
|
|
||
| echo "Verifying access to repository: $LIGHTNING_NODE_REPO" | ||
|
|
||
| # Test if we can access the repository | ||
| HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \ | ||
| -H "Authorization: token $TOKEN" \ | ||
| -H "Accept: application/vnd.github.v3+json" \ | ||
| "https://api.github.com/repos/$LIGHTNING_NODE_REPO") | ||
|
|
||
| if [ "$HTTP_CODE" = "200" ]; then | ||
| echo "✅ Successfully verified access to $LIGHTNING_NODE_REPO" | ||
| elif [ "$HTTP_CODE" = "404" ]; then | ||
| echo "❌ Repository not found: $LIGHTNING_NODE_REPO" | ||
| echo "Please verify:" | ||
| echo " 1. The repository name is correct" | ||
| echo " 2. The token has access to this private repository" | ||
| echo " 3. The token owner is a member of the '$REPO_OWNER' organization" | ||
| exit 1 | ||
| elif [ "$HTTP_CODE" = "403" ]; then | ||
| echo "❌ Access forbidden. The token may not have sufficient permissions." | ||
| echo "Please verify:" | ||
| echo " 1. The token has 'repo' scope (for private repos)" | ||
| echo " 2. The token owner has access to the '$REPO_OWNER' organization" | ||
| echo " 3. The repository allows access from external tokens" | ||
| exit 1 | ||
| else | ||
| echo "❌ Unexpected error (HTTP $HTTP_CODE) when accessing $LIGHTNING_NODE_REPO" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Trigger Lightning Node E2E Tests | ||
| uses: peter-evans/repository-dispatch@v3 | ||
| with: | ||
| token: ${{ secrets.LIGHTNING_NODE_DISPATCH_TOKEN || secrets.GITHUB_TOKEN }} | ||
| repository: ${{ vars.LIGHTNING_NODE_REPO || 'cumuloglobal/lightning-node' }} | ||
| event-type: mdk-checkout-pr | ||
|
Comment on lines
+58
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If Useful? React with 👍 / 👎. |
||
| client-payload: | | ||
| { | ||
| "sha": "${{ github.event.pull_request.head.sha }}", | ||
| "ref": "${{ github.event.pull_request.head.ref }}", | ||
| "pr_number": ${{ github.event.pull_request.number }}, | ||
| "pr_url": "${{ github.event.pull_request.html_url }}", | ||
| "repo": "${{ github.repository }}" | ||
| } | ||
|
|
||
| - name: Comment on PR | ||
| if: github.event_name == 'pull_request' | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const lightningNodeRepo = '${{ vars.LIGHTNING_NODE_REPO || 'cumuloglobal/lightning-node' }}'; | ||
| const comment = `🔗 Lightning Node E2E tests have been triggered for this PR. | ||
|
|
||
| View the workflow run: https://github.com/${lightningNodeRepo}/actions/workflows/external-e2e.yml | ||
|
|
||
| The tests will build packages from this PR branch and run integration tests against the Lightning Node infrastructure.`; | ||
|
|
||
| github.rest.issues.createComment({ | ||
| issue_number: context.issue.number, | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| body: comment | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
LIGHTNING_NODE_DISPATCH_TOKENis not set (including all fork PRs, where secrets are unavailable), this step falls back toGITHUB_TOKENbut still targets the externalcumuloglobal/lightning-noderepo.GITHUB_TOKENcannot dispatch events to another repository, so therepository-dispatchcall will 401/403 and the E2E run never starts even though the workflow continues. Consider gating this step to non-fork PRs or requiring the PAT before dispatching to avoid silently skipping external E2E.Useful? React with 👍 / 👎.