Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 128 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: CI

on:
pull_request:
push:
branches: [main]

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
changes:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
typescript: ${{ steps.filter.outputs.typescript }}
python: ${{ steps.filter.outputs.python }}
rust: ${{ steps.filter.outputs.rust }}
go: ${{ steps.filter.outputs.go }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
typescript:
- 'typescript/**'
- '.github/workflows/ci.yml'
python:
- 'python/**'
- '.github/workflows/ci.yml'
rust:
- 'rust/**'
- '.github/workflows/ci.yml'
go:
- 'go/**'
- '.github/workflows/ci.yml'

typescript:
needs: changes
if: needs.changes.outputs.typescript == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: typescript
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: typescript/package-lock.json
- run: npm ci
- run: npm run typecheck
- run: npm test
- run: npm run build

python:
needs: changes
if: needs.changes.outputs.python == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: python
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: pip install -e ".[dev]"
- run: pytest

rust:
needs: changes
if: needs.changes.outputs.rust == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: rust
steps:
- uses: actions/checkout@v4
- run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: rust
- run: cargo build
- run: cargo test

go:
needs: changes
if: needs.changes.outputs.go == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: go
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go/go.mod
cache-dependency-path: go/go.sum
- run: go build ./...
- run: go test ./...
Comment thread
cursor[bot] marked this conversation as resolved.

# Single required status check: always runs, passes when every language job
# either succeeded or was skipped (not touched by the PR). Make THIS job the
# required check in branch protection — the per-language jobs are skipped on
# PRs that don't touch them and would otherwise hang as "pending" forever.
ci-ok:
needs: [changes, typescript, python, rust, go]
if: always()
runs-on: ubuntu-latest
steps:
- name: Check job results
run: |
results="${{ needs.typescript.result }} ${{ needs.python.result }} ${{ needs.rust.result }} ${{ needs.go.result }} ${{ needs.changes.result }}"
echo "Job results: $results"
for r in $results; do
if [ "$r" = "failure" ] || [ "$r" = "cancelled" ]; then
echo "::error::A CI job failed or was cancelled."
exit 1
fi
done
echo "All CI jobs passed or were skipped."
32 changes: 32 additions & 0 deletions .github/workflows/publish-go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish Go

# Go modules are published by the tag itself — the Go module proxy serves
# go/vX.Y.Z directly from GitHub. This workflow is just a release gate.
on:
push:
tags:
- 'go/v*'

jobs:
release-gate:
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
working-directory: go
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go/go.mod
cache-dependency-path: go/go.sum
- run: go build ./...
- run: go test ./...

- name: Release info
run: |
VERSION="${GITHUB_REF_NAME#go/}"
echo "Go module released. Users can install it with:"
echo
echo " go get github.com/quiknode-labs/hyperliquid-sdk/go@$VERSION"
48 changes: 48 additions & 0 deletions .github/workflows/publish-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Publish Python

on:
push:
tags:
- 'python/v*'

jobs:
publish:
runs-on: ubuntu-latest
environment: pypi
permissions:
contents: read
id-token: write # PyPI Trusted Publishing
defaults:
run:
working-directory: python
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Assert tag matches pyproject.toml version
run: |
TAG_VERSION="${GITHUB_REF_NAME#python/v}"
PROJECT_VERSION="$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")"
if [ "$TAG_VERSION" != "$PROJECT_VERSION" ]; then
echo "::error::Tag version ($TAG_VERSION) does not match python/pyproject.toml version ($PROJECT_VERSION)."
echo "Bump pyproject.toml or re-tag, then push again."
exit 1
fi
echo "Version check OK: $PROJECT_VERSION"

- run: pip install -e ".[dev]"
- run: pytest

- name: Build sdist and wheel
run: |
rm -rf dist
pip install build
python -m build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: python/dist/
37 changes: 37 additions & 0 deletions .github/workflows/publish-rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish Rust

on:
push:
tags:
- 'rust/v*'

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
working-directory: rust
steps:
- uses: actions/checkout@v4
- run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: rust

- name: Assert tag matches Cargo.toml version
run: |
TAG_VERSION="${GITHUB_REF_NAME#rust/v}"
CRATE_VERSION="$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')"
if [ "$TAG_VERSION" != "$CRATE_VERSION" ]; then
echo "::error::Tag version ($TAG_VERSION) does not match rust/Cargo.toml version ($CRATE_VERSION)."
echo "Bump Cargo.toml or re-tag, then push again."
exit 1
fi
echo "Version check OK: $CRATE_VERSION"

- run: cargo test

- run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
46 changes: 46 additions & 0 deletions .github/workflows/publish-typescript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish TypeScript

on:
push:
tags:
- 'typescript/v*'

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # npm --provenance
defaults:
run:
working-directory: typescript
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: typescript/package-lock.json
registry-url: https://registry.npmjs.org

- name: Assert tag matches package.json version
run: |
TAG_VERSION="${GITHUB_REF_NAME#typescript/v}"
PKG_VERSION="$(node -p "require('./package.json').version")"
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
echo "::error::Tag version ($TAG_VERSION) does not match typescript/package.json version ($PKG_VERSION)."
echo "Bump package.json or re-tag, then push again."
exit 1
fi
echo "Version check OK: $PKG_VERSION"

- run: npm ci
- run: npm run typecheck
- run: npm test
- run: npm run build

# prepublishOnly re-runs the build; that's fine.
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,28 @@ Thumbs.db
.env
.env.local
*.pem

# Environment (all variants)
.env.*
!.env.example

# Coverage / build info
coverage/
*.tsbuildinfo
.nyc_output/

# Go binaries (no extension; built with `go build` at go/ root or in an example dir)
go/evm_example
go/full_demo
go/grpc_streaming
go/hypercore_example
go/info_example
go/place_order
go/trading_example
go/websocket_streaming

# Claude Code local settings
.claude/settings.local.json

# Internal release runbook (kept local, not published)
.github/RELEASING.md
Loading
Loading