Skip to content

chore: merge integration/all-fixes into main (50-commit rollup) #40

chore: merge integration/all-fixes into main (50-commit rollup)

chore: merge integration/all-fixes into main (50-commit rollup) #40

Workflow file for this run

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 `integration/all-fixes` after PR #225 (issue-223 cross-
# process UXF delivery fix) landed; that branch contains the
# CLI-consumed type exports (CreateInvoiceRequest, PayInvoice
# Params, encrypt/decrypt helpers, ...) on the public module
# surface. Those exports have not yet landed on `main` or in any
# published npm version.
#
# Why the bump: the previous pin (86468103a, tip of
# `refactor/extract-cli-to-sphere-cli`) became unreachable to
# `git clone` after the refactor branch was deleted from origin —
# the commit still exists in the GitHub repo object database but
# isn't on any branch tip, so a default `git clone` doesn't fetch
# it and `checkout --detach` fails with "unable to read tree".
#
# 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: 02cb4550facae0bea58c3b04aceaf3059599464b
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 integration/all-fixes 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