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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.go text eol=lf
5 changes: 5 additions & 0 deletions .github/workflows/release-go-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ on:
permissions:
contents: read

env:
# Release checks must exercise the tagged modules exactly as consumers see
# them, without resolving sibling modules through the repository workspace.
GOWORK: "off"

concurrency:
group: release-go-sdk-${{ github.ref_name }}
cancel-in-progress: false
Expand Down
81 changes: 81 additions & 0 deletions .github/workflows/validate-gemini-markets-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Validate Gemini Markets CLI

on:
pull_request:
paths:
- "packages/gemini-markets-cli/**"
- "packages/sdk-go/**"
- "go.work"
- "go.work.sum"
- ".github/workflows/validate-gemini-markets-cli.yml"

permissions:
contents: read

jobs:
validate:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-24.04
- macos-14
- windows-2022
runs-on: ${{ matrix.os }}
timeout-minutes: 20
env:
# The root workspace includes the SDK generator module, whose pinned Go
# version defines the monorepo toolchain used by this integration check.
GOTOOLCHAIN: local
defaults:
run:
working-directory: packages/gemini-markets-cli

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false

- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version-file: packages/sdk-go/scripts/go.mod
cache: true
cache-dependency-path: |
go.work
go.work.sum
packages/gemini-markets-cli/go.mod
packages/gemini-markets-cli/go.sum
packages/sdk-go/go.mod
packages/sdk-go/go.sum
packages/sdk-go/cmd/demo/go.mod
packages/sdk-go/cmd/demo/go.sum
packages/sdk-go/scripts/go.mod
packages/sdk-go/scripts/go.sum
packages/sdk-go/websocket/gorilla/go.mod
packages/sdk-go/websocket/gorilla/go.sum
samples/go/go.mod
samples/go/go.sum

- name: Verify module dependencies
run: go mod verify
- name: Check formatting
shell: bash
run: |
files="$(gofmt -l .)"
if [[ -n "$files" ]]; then
echo "The following files require gofmt:"
echo "$files"
exit 1
fi
- name: Run tests
run: go test ./...
- name: Run race detector
run: go test -race ./...
- name: Run vet
run: go vet ./...
- name: Build command
run: go build -o "${{ runner.temp }}/gemini-markets" ./cmd/gemini-markets
- name: Smoke-test help
run: go run ./cmd/gemini-markets --help
- name: Check package documentation
run: go doc ./internal/cli
5 changes: 5 additions & 0 deletions .github/workflows/validate-go-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
permissions:
contents: read

env:
# Validate each published module in isolation. The repository workspace is
# for monorepo development and must not mask missing module requirements.
GOWORK: "off"

jobs:
minimum-go:
runs-on: ubuntu-24.04
Expand Down
10 changes: 10 additions & 0 deletions go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
go 1.25.13

use (
./packages/gemini-markets-cli
./packages/sdk-go
./packages/sdk-go/cmd/demo
./packages/sdk-go/scripts
./packages/sdk-go/websocket/gorilla
./samples/go
)
10 changes: 10 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts=
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/telemetry v0.0.0-20260209163413-e7419c687ee4/go.mod h1:g5NllXBEermZrmR51cJDQxmJUHUOfRAaNyWBM+R+548=
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
7 changes: 7 additions & 0 deletions packages/gemini-markets-cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Local CLI build output.
/bin/
/gemini-markets
/gemini-markets.exe

# GoReleaser snapshot/release output.
/dist/
52 changes: 52 additions & 0 deletions packages/gemini-markets-cli/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
version: 2

project_name: gemini-markets

# Run GoReleaser from this module directory in a full repository checkout. The
# root go.work resolves the CLI against the sibling SDK modules at this commit.
before:
hooks:
- go mod verify

builds:
- id: gemini-markets
main: ./cmd/gemini-markets
binary: gemini-markets
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
ldflags:
- -s -w -X github.com/gemini/developer-platform/packages/gemini-markets-cli/internal/cli.Version={{ .Version }}
mod_timestamp: '{{ .CommitTimestamp }}'

archives:
- id: gemini-markets
ids:
- gemini-markets
formats:
- tar.gz
format_overrides:
- goos: windows
formats:
- zip
name_template: >-
{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}

checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt'

snapshot:
version_template: '{{ incpatch .Version }}-next'

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
38 changes: 38 additions & 0 deletions packages/gemini-markets-cli/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
GO ?= go
BINARY ?= gemini-markets
BUILD_DIR ?= ./bin

.PHONY: all build check test race vet docs smoke fmt mod-verify

all: check

build:
mkdir -p "$(BUILD_DIR)"
$(GO) build -trimpath -o "$(BUILD_DIR)/$(BINARY)" ./cmd/gemini-markets

test:
$(GO) test ./...

race:
$(GO) test -race ./...

vet:
$(GO) vet ./...

docs:
$(GO) doc ./cmd/gemini-markets >/dev/null
$(GO) doc ./internal/cli >/dev/null
$(GO) doc ./internal/credentials >/dev/null
$(GO) doc ./internal/output >/dev/null
$(GO) doc ./internal/session >/dev/null

smoke:
$(GO) run ./cmd/gemini-markets --help >/dev/null

fmt:
@test -z "$$(gofmt -l .)" || (echo "gofmt required; run gofmt -w ." && exit 1)

mod-verify:
$(GO) mod verify

check: fmt mod-verify test race vet build docs smoke
Loading
Loading