feat(cli)(#32): canonical UX — --json, --help, asset-pair input, auto-help on errors #43
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| # sphere-cli consumes @unicitylabs/sphere-sdk via `file:../../sphere-sdk` | |
| # because the CLI-extraction commit in sphere-sdk (which promoted types | |
| # like CreateInvoiceRequest, PayInvoiceParams to the public exports) | |
| # landed AFTER the sphere-sdk v0.7.0 npm release. Until a new sphere-sdk | |
| # version is published, CI clones the sibling repo into the expected | |
| # `../../sphere-sdk` location and builds it in-place so the `file:` | |
| # dependency resolves correctly. | |
| # | |
| # Swap to an npm-published version once sphere-sdk v0.7.1+ ships. | |
| jobs: | |
| lint-typecheck-test: | |
| name: lint + typecheck + test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [20.x, 22.x] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Default path: $GITHUB_WORKSPACE/ | |
| # = /home/runner/work/sphere-cli/sphere-cli/ | |
| # package.json's `file:../../sphere-sdk` resolves from there to | |
| # /home/runner/work/sphere-sdk/ — that's where we clone below. | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: npm | |
| - name: Clone sphere-sdk sibling | |
| # Pin to a specific commit SHA (not a branch name) for supply-chain | |
| # integrity — a branch pointer can be force-pushed or rebased, | |
| # silently changing the code CI builds against. | |
| # | |
| # This SHA is the tip of sphere-sdk `main` ("merge: PR #395 #394 | |
| # automated CID delivery re-enabled + 512 KiB inline cap + demo | |
| # playbook"). That commit exports the symbols `src/shared/sphere- | |
| # providers.ts` consumes from `@unicitylabs/sphere-sdk/impl/nodejs`: | |
| # `createUxfCarPublisher`, `DEFAULT_IPFS_GATEWAYS`, | |
| # `PublishToIpfsCallback`. It also exposes `AccountingModule. | |
| # deliverInvoice`, which `invoice-deliver` (PR #18 / issue #226) | |
| # calls. Pinning to `main` (rather than the previous integration- | |
| # branch tip 02cb4550) avoids the "unable to read tree" failure | |
| # when an integration tip is rebased away. | |
| # | |
| # Bump this SHA when a new sphere-sdk commit is required; remove | |
| # this whole workaround once sphere-sdk publishes v0.7.1+ to npm | |
| # with the post-extraction exports. | |
| env: | |
| SPHERE_SDK_SHA: 3f3dadf9d03eb29db87f062921751f24bfefdec8 | |
| run: | | |
| git clone https://github.com/unicity-sphere/sphere-sdk.git ../../sphere-sdk | |
| # The pinned SHA may not be on a branch tip after future merges; | |
| # fetch it explicitly before checkout so the workflow keeps | |
| # working when sphere-sdk main advances past this commit. | |
| git -C ../../sphere-sdk fetch origin "$SPHERE_SDK_SHA" || true | |
| git -C ../../sphere-sdk checkout --detach "$SPHERE_SDK_SHA" | |
| - name: "Build sphere-sdk (required for file: dependency to resolve types)" | |
| run: | | |
| cd ../../sphere-sdk | |
| npm ci | |
| npm run build | |
| - run: npm ci | |
| - run: npm run lint | |
| - run: npm run typecheck | |
| - run: npm run test | |
| - run: npm run build | |
| - name: Verify bin shim is executable | |
| run: | | |
| chmod +x bin/sphere.mjs | |
| node bin/sphere.mjs --version |