Skip to content

Latest commit

 

History

History
136 lines (95 loc) · 4.64 KB

CONTRIBUTING.md

File metadata and controls

136 lines (95 loc) · 4.64 KB

Contributing

  1. File an issue. The issue will be used to discuss the bug or feature and should be created before sending a PR.

  2. Install Go.

    1. Ensure that your GOBIN directory (by default $(go env GOPATH)/bin) is in your PATH.
    2. Check it's working by running go version.
      • If it doesn't work, check the install location, usually /usr/local/go, is on your PATH.
  3. Sign one of the contributor license agreements below.

  4. Clone the repo: git clone https://github.com/googleapis/go-gorm-spanner

  5. Change into the checked out source: cd go-gorm

  6. Fork the repo.

  7. Set your fork as a remote: git remote add fork [email protected]:GITHUB_USERNAME/go-gorm.git

  8. Make changes, commit to your fork.

    Commit messages should follow the Conventional Commits Style. The scope portion should always be filled with the name of the package affected by the changes being made. For example:

    feat(functions): add gophers codelab
    
  9. Send a pull request with your changes.

    To minimize friction, consider setting Allow edits from maintainers on the PR, which will enable project committers and automation to update your PR.

  10. A maintainer will review the pull request and make comments.

    Prefer adding additional commits over amending and force-pushing since it can be difficult to follow code reviews when the commit history changes.

    Commits will be squashed when they're merged.

Testing

We test code against two versions of Go, the minimum and maximum versions supported by our clients. To see which versions these are checkout our README.

Integration Tests

In addition to the unit tests, you may run the integration test suite.

GCP Setup

To run the integrations tests, creation and configuration of a project in the Google Developers Console is required.

After creating the project, you must create a service account for project. Ensure the project-level Owner IAM role role is added to each service account. During the creation of the service account, you should download the JSON credential file for use later.

Local Setup

Once the project is created and configured, set the following environment variables:

  • SPANNER_TEST_PROJECT: Developers Console project's ID (e.g. bamboo-shift-455).

Install the gcloud command-line tool to your machine and use it to create some resources used in integration tests.

From the project's root directory:

# Sets the default project in your env.
$ gcloud config set project $SPANNER_TEST_PROJECT

# Authenticates the gcloud tool with your account.
$ gcloud auth login

# Creates a Spanner instance for the spanner integration tests.
$ gcloud beta spanner instances create go-integration-test --config regional-us-central1 --nodes 10 --description 'Instance for go client test'
# NOTE: Spanner instances are priced by the node-hour, so you may want to
# delete the instance after testing with 'gcloud beta spanner instances delete'.

$ export SPANNER_TEST_INSTANCE=go-integration-test

It may be useful to add exports to your shell initialization for future use. For instance, in .zshrc:

#### START Test Variables
# Developers Console project's ID (e.g. bamboo-shift-455) for the general project.
export SPANNER_TEST_PROJECT=your-project

# Developers Console Spanner's instance ID (e.g. spanner-instance) for the running tests.
export SPANNER_TEST_INSTANCE=go-integration-test
#### END Test Variables

Running

Once you've done the necessary setup, you can run the integration tests by running:

$ go test -v ./...

Contributor License Agreements

Before we can accept your pull requests you'll need to sign a Contributor License Agreement (CLA):

  • If you are an individual writing original source code and you own the intellectual property, then you'll need to sign an individual CLA.
  • If you work for a company that wants to allow you to contribute your work, then you'll need to sign a corporate CLA.

You can sign these electronically (just scroll to the bottom). After that, we'll be able to accept your pull requests.