Skip to content

Latest commit

 

History

History
100 lines (68 loc) · 2.15 KB

CONTRIBUTING.md

File metadata and controls

100 lines (68 loc) · 2.15 KB

Contributing to NewStack Deploy CLI SDK

Setup

Ensure git uses the custom directory for git hooks so the pre-commit and commit-msg linting hooks kick in.

git config core.hooksPath .githooks

Requirements

  • Go >= 1.26.4 (go.mod)
  • Node.js >= 22.20.0
  • Yarn 4 (packageManager in package.json)

NPM dependencies

There are npm dependencies that provide tools that are used in git hooks for commit linting.

Install dependencies from the root directory by simply running:

yarn

Running Tests

Run all tests with integration tests, race detection and coverage:

bash scripts/run-tests.sh --integration

This will:

  • Run all tests with race detection enabled
  • Include integration tests
  • Generate coverage.txt with coverage data
  • Generate coverage.html for visual coverage inspection (on dev machines)

To run unit tests only (without integration tests):

bash scripts/run-tests.sh

To run tests for a specific package:

go test -v ./styles/...
go test -v ./config/...

stateio's tests, unit tests included, need the integration stack, so go test ./... fails there without it; use bash scripts/run-tests.sh --integration for that package.

The integration run needs docker, the aws CLI, jq and curl, and test credentials for LocalStack, as CI sets them:

AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test bash scripts/run-tests.sh --integration

Linting

Run static analysis and vet checks:

bash scripts/lint.sh

This runs:

  • staticcheck - static analysis tool for Go
  • go vet - reports suspicious constructs

Prerequisites

Install staticcheck if not already installed:

go install honnef.co/go/tools/cmd/staticcheck@latest

Running Individual Checks

# Run staticcheck on all packages
staticcheck ./...

# Run go vet on all packages
go vet ./...

# Format code
go fmt ./...

Further documentation