Skip to content

Commit b3ad562

Browse files
authored
ci: add ci for the cli for rollkit start cmd (#1603)
<!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. --> ## Overview We will want to add this new CLI CI to the required checks when this gets merged in. As such, I won't use auto merge on this so that I can update the branch protection rules right after I merge this. <!-- Please provide an explanation of the PR, including the appropriate context, background, goal, and rationale. If there is an issue with this information, please provide a tl;dr and link the issue. --> ## Checklist <!-- Please complete the checklist to ensure that the PR is ready to be reviewed. IMPORTANT: PRs should be left in Draft until the below checklist is completed. --> - [ ] New and updated code has appropriate documentation - [ ] New and updated code has new and/or updated testing - [ ] Required CI checks are passing - [ ] Visual proof for any user facing features like CLI or documentation updates - [ ] Linked issues closed with keywords <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new job in the CI workflow specifically for testing the CLI with enhanced parameters. - **Refactor** - Updated the CLI's run node command to support CI mode, preventing indefinite blocking during automated tests by adding a new `ci` flag. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 1a6b03d commit b3ad562

3 files changed

Lines changed: 28 additions & 2 deletions

File tree

.github/workflows/ci_release.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,21 @@ jobs:
5050
proto:
5151
uses: ./.github/workflows/proto.yml
5252

53+
cli:
54+
name: Test CLI
55+
needs: [setup]
56+
runs-on: ubuntu-latest
57+
steps:
58+
- uses: actions/checkout@v4
59+
- name: set up go
60+
uses: actions/setup-go@v5
61+
with:
62+
go-version: ${{ needs.setup.outputs.go-version }}
63+
- name: Build cli
64+
run: make install
65+
- name: Run cli
66+
run: rollkit start --ci
67+
5368
# get_merged_pr_labels uses the listPullRequestsAssociatedWithCommit API
5469
# endpoint to get the PR information for the commit during a push event. Once
5570
# the PR information is received, we check to see if the create-release label

cmd/rollkit/commands/run_node.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,17 @@ func NewRunNodeCmd() *cobra.Command {
161161
}
162162
})
163163

164-
// Run forever.
165-
select {}
164+
// Check if we are running in CI mode
165+
inCI, err := cmd.Flags().GetBool("ci")
166+
if err != nil {
167+
return err
168+
}
169+
if !inCI {
170+
// Block forever
171+
select {}
172+
}
173+
174+
return nil
166175
},
167176
}
168177

@@ -187,6 +196,7 @@ func addNodeFlags(cmd *cobra.Command) {
187196
cmtcmd.AddNodeFlags(cmd)
188197

189198
cmd.Flags().String("transport", config.ABCI, "specify abci transport (socket | grpc)")
199+
cmd.Flags().Bool("ci", false, "run node for ci testing")
190200

191201
// Add Rollkit flags
192202
rollconf.AddFlags(cmd)

cmd/rollkit/docs/rollkit_start.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ rollkit start [flags]
1010

1111
```
1212
--abci string specify abci transport (socket | grpc) (default "socket")
13+
--ci run node for ci testing
1314
--consensus.create_empty_blocks set this to false to only produce blocks when there are txs or when the AppHash changes (default true)
1415
--consensus.create_empty_blocks_interval string the possible interval between empty blocks (default "0s")
1516
--consensus.double_sign_check_height int how many blocks to look back to check existence of the node's consensus votes before joining consensus

0 commit comments

Comments
 (0)