WIP: Scheduled tests#1690
Conversation
This reverts commit 334e28f.
There was a problem hiding this comment.
Pull request overview
This PR introduces scheduled tests functionality to run network tests against multiple RPC versions, addressing issue #1681. The implementation includes a dispatcher workflow that triggers tests on different SDK repositories with various RPC version configurations.
Changes:
- Added scheduled tests workflow for running network tests on testnet with configurable RPC versions
- Added dispatcher workflow to orchestrate test runs across multiple RPC versions and SDK repositories
- Created a composite action for dispatching workflow runs to target repositories
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
.github/workflows/scheduled-tests.yml |
Defines the test execution workflow with setup and network testing jobs |
.github/workflows/scheduled-tests-dispatcher.yml |
Orchestrates scheduled test runs across multiple RPC versions and repositories |
.github/actions/dispatch-scheduled-tests/action.yml |
Composite action for dispatching workflow runs via GitHub API |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| RPC_VERION="${{ inputs.rpc_version }}" | ||
| URL="${URL%/}" # Remove trailing slash if any | ||
| URL="${URL%/*}" # Get base URL without version | ||
| RPC_URL="${URL}/${RPC_VERION}" |
There was a problem hiding this comment.
Typo in variable name: "RPC_VERION" should be "RPC_VERSION".
| RPC_VERION="${{ inputs.rpc_version }}" | |
| URL="${URL%/}" # Remove trailing slash if any | |
| URL="${URL%/*}" # Get base URL without version | |
| RPC_URL="${URL}/${RPC_VERION}" | |
| RPC_VERSION="${{ inputs.rpc_version }}" | |
| URL="${URL%/}" # Remove trailing slash if any | |
| URL="${URL%/*}" # Get base URL without version | |
| RPC_URL="${URL}/${RPC_VERSION}" |
| RPC_VERION="${{ inputs.rpc_version }}" | ||
| URL="${URL%/}" # Remove trailing slash if any | ||
| URL="${URL%/*}" # Get base URL without version | ||
| RPC_URL="${URL}/${RPC_VERION}" |
There was a problem hiding this comment.
The typo in variable name "RPC_VERION" will cause the URL construction to use an empty value. This variable is referenced on line 103 but defined incorrectly on line 100, which will result in an incorrect RPC URL being set.
| RPC_VERION="${{ inputs.rpc_version }}" | |
| URL="${URL%/}" # Remove trailing slash if any | |
| URL="${URL%/*}" # Get base URL without version | |
| RPC_URL="${URL}/${RPC_VERION}" | |
| RPC_VERSION="${{ inputs.rpc_version }}" | |
| URL="${URL%/}" # Remove trailing slash if any | |
| URL="${URL%/*}" # Get base URL without version | |
| RPC_URL="${URL}/${RPC_VERSION}" |
| name: Run scheduled tests with multiple RPC versions | ||
|
|
||
| on: | ||
| pull_request: |
There was a problem hiding this comment.
The workflow is triggered on pull_request events (line 4), which means it will dispatch scheduled tests to other repositories for every pull request. This could cause excessive workflow runs and consume resources unnecessarily. Consider restricting this to only run on schedule and workflow_dispatch, or add a condition to check if the PR modifies specific files.
| pull_request: |
| curl -f -sS -X POST \ | ||
| -H "Authorization: Bearer ${GH_TOKEN}" \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| "https://api.github.com/repos/${REPO}/actions/workflows/${WORKFLOW_FILE}/dispatches" \ | ||
| -d "{\"ref\":\"${REF}\",\"inputs\":{\"rpc_version\":\"${RPC_VERSION}\"}}" | ||
|
|
||
| echo "Dispatched ${REPO}@${REF} workflow ${WORKFLOW_FILE} with rpc_version=${RPC_VERSION}" | ||
|
|
There was a problem hiding this comment.
The curl command lacks error handling context. When the curl command fails (due to -f flag), the error message won't indicate which repository or workflow failed. Consider adding an echo statement before the curl command to log which workflow is being dispatched, or add error handling that provides more context about the failure.
| curl -f -sS -X POST \ | |
| -H "Authorization: Bearer ${GH_TOKEN}" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| "https://api.github.com/repos/${REPO}/actions/workflows/${WORKFLOW_FILE}/dispatches" \ | |
| -d "{\"ref\":\"${REF}\",\"inputs\":{\"rpc_version\":\"${RPC_VERSION}\"}}" | |
| echo "Dispatched ${REPO}@${REF} workflow ${WORKFLOW_FILE} with rpc_version=${RPC_VERSION}" | |
| echo "Dispatching workflow '${WORKFLOW_FILE}' to repository '${REPO}' at ref '${REF}' with rpc_version='${RPC_VERSION}'" | |
| if ! curl -f -sS -X POST \ | |
| -H "Authorization: Bearer ${GH_TOKEN}" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| "https://api.github.com/repos/${REPO}/actions/workflows/${WORKFLOW_FILE}/dispatches" \ | |
| -d "{\"ref\":\"${REF}\",\"inputs\":{\"rpc_version\":\"${RPC_VERSION}\"}}"; then | |
| echo "Error: Failed to dispatch workflow '${WORKFLOW_FILE}' to repository '${REPO}' at ref '${REF}' with rpc_version='${RPC_VERSION}'" >&2 | |
| exit 1 | |
| fi | |
| echo "Successfully dispatched ${REPO}@${REF} workflow ${WORKFLOW_FILE} with rpc_version=${RPC_VERSION}" |
| curl -f -sS -X POST \ | ||
| -H "Authorization: Bearer ${GH_TOKEN}" \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| "https://api.github.com/repos/${REPO}/actions/workflows/${WORKFLOW_FILE}/dispatches" \ | ||
| -d "{\"ref\":\"${REF}\",\"inputs\":{\"rpc_version\":\"${RPC_VERSION}\"}}" | ||
|
|
||
| echo "Dispatched ${REPO}@${REF} workflow ${WORKFLOW_FILE} with rpc_version=${RPC_VERSION}" | ||
|
|
There was a problem hiding this comment.
The curl command could expose the GitHub token in logs if debugging is enabled. While the token is passed through an environment variable which is generally safe, consider using the GitHub CLI (gh) instead which provides built-in token handling and better security practices. For example: gh workflow run "$WORKFLOW_FILE" --repo "$REPO" --ref "$REF" --field rpc_version="$RPC_VERSION".
| curl -f -sS -X POST \ | |
| -H "Authorization: Bearer ${GH_TOKEN}" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| "https://api.github.com/repos/${REPO}/actions/workflows/${WORKFLOW_FILE}/dispatches" \ | |
| -d "{\"ref\":\"${REF}\",\"inputs\":{\"rpc_version\":\"${RPC_VERSION}\"}}" | |
| echo "Dispatched ${REPO}@${REF} workflow ${WORKFLOW_FILE} with rpc_version=${RPC_VERSION}" | |
| gh workflow run "${WORKFLOW_FILE}" \ | |
| --repo "${REPO}" \ | |
| --ref "${REF}" \ | |
| --field rpc_version="${RPC_VERSION}" | |
| echo "Dispatched ${REPO}@${REF} workflow ${WORKFLOW_FILE} with rpc_version=${RPC_VERSION}" |
Stack
Closes #1681
Introduced changes