Skip to content

Commit

Permalink
Merge pull request #33 from smartcontractkit/ggoh/doc-day/readme
Browse files Browse the repository at this point in the history
docs: update readme & added contributing.md
  • Loading branch information
graham-chainlink authored Nov 8, 2024
2 parents fb1491e + d52ee8a commit 99a1e35
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 41 deletions.
56 changes: 56 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Contributing to Chainlink Protos

<!-- TOC -->

- [Team Overview](#team-overview)
- [How to Contribute](#how-to-contribute)
- [Filing a PR on smartcontractkit/spec-generator](#filing-a-pr-on-smartcontractkitspec-generator)
- [Preparing a release](#preparing-a-release)
- [Merging Version Packages PR](#merging-version-packages-pr)

<!-- TOC -->

## Team Overview

The Deployment Automation team is responsible for the development and maintenance of this repo. The GitHub
team [@smartcontractkit/deployment-automation](https://github.com/orgs/smartcontractkit/teams/deployment-automation)
are the primary code owners and reviewers for this repo.

## How to Contribute

To contribute, you must:

- Open a pull request (PR) with your changes.
- Request a review from the Deployment Automation
team ([@smartcontractkit/deployment-automation](https://github.com/orgs/smartcontractkit/teams/deployment-automation))
to
ensure adherence to code and design standards.
- Ensure your PR passes all continuous integration checks and adheres to the contribution guidelines specific to each
repository.

### Filing a PR on smartcontractkit/chainlink-protos

Before creating a PR with your change, you should generate a "changeset" file.

Let's assume that you've made some local changes.
Before filing a PR you need to generate a "changeset" description required for
the automated release process. Follow the steps below:

- Run `pnpm changeset` in the git top level directory.
- Answer remaining questions. At the end, you will have a new
`.changeset/<random-name>.md` file generated.
- Now you need to commit and push your changes
- Create a Pull request which includes your code change and generated
"changeset" file.

### Preparing a release

After merging your PR, a changesets CI job will create or update a "Version Packages" PR
like [this one](https://github.com/smartcontractkit/chainlink-protos/pull/31) which contains a release bump.

### Merging Version Packages PR

Now you can Approve/Request approval and Merge the PR from the previous step. After merging, it will kick off the
release workflow and that will release a new version and push tags automatically. You can navigate to
the [tag view](https://github.com/smartcontractkit/chainlink-protos/tags), to check if the latest release is
available.
79 changes: 39 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# chainlink-protos

> **Note**
>
> _This demo represents an educational example to use a Chainlink system, product, or service and is provided to demonstrate how to interact with Chainlink’s systems, products, and services to integrate them into your own. This template is provided “AS IS” and “AS AVAILABLE” without warranties of any kind, it has not been audited, and it may be missing key checks or error handling to make the usage of the system, product or service more clear. Do not use the code in this example in a production environment without completing your own audits and application of best practices. Neither Chainlink Labs, the Chainlink Foundation, nor Chainlink node operators are responsible for unintended outputs that are generated due to errors in code._
<div align="center">
<h1>Chainlink Protos</h1>
<a><img src="https://github.com/smartcontractkit/chainlink-protos/actions/workflows/push-main.yml/badge.svg" /></a>
<br/>
<br/>
</div>

This repository serves as a central hub for shared protobuf definitions used across various services. Currently, it includes protobuf definitions and generated Go SDKs for the job-distributor and orchestrator services. Contributions and additional proto files for other services are welcome.

Expand All @@ -23,32 +24,57 @@ $ go get github.com/smartcontractkit/chainlink-protos/job-distributor@v<LATEST_V
$ go get github.com/smartcontractkit/chainlink-protos/orchestrator@v<LATEST_VERSION>
```

## Getting Started
### Import

The import varies depending on the `go_package` option defined in the protos.
Below is an example when `go_package` is set to `github.com/smartcontractkit/chainlink-protos/job-distributor/v1/node`

```go
import "github.com/smartcontractkit/chainlink-protos/job-distributor/v1/node"
```

## Development

### Dependencies
### Getting Started

Dependencies are managed via [asdf](https://asdf-vm.com/guide/getting-started.html).
#### Setup

[asdf](https://asdf-vm.com/) is a tool version manager. All dependencies used for local development of this repo are
managed through `asdf`. To install `asdf`:

1. [Install asdf](https://asdf-vm.com/guide/getting-started.html)
2. Follow the instructions to ensure `asdf` is shimmed into your terminal or development environment

#### Installing Dependencies

Install the required tools using [asdf](https://asdf-vm.com/guide/getting-started.html):

```bash
./scripts/setup-asdf-plugin.sh
asdf install
```

### Installing wsRPC
#### Installing wsRPC

Communication between core node and job distributor requires the library [wsRPC](https://github.com/smartcontractkit/wsrpc). To generate protos that are compatible with wsRPC, we will need to install the CLI.

Follow the instructions [here](https://github.com/smartcontractkit/wsrpc?tab=readme-ov-file#set-up) to install it.

## Formatting
### Formatting

Ensure [buf](https://buf.build/product/cli) is installed following the dependencies above.

```bash
task fmt
```

## Generating GO SDKs
### Linting

```bash
task lint
```

### Generating GO SDKs

> [!Note]
> Commiting the generated code resulting from the proto changes is optional. The CI will automatically update the pull request with the generated files through the GitHub workflow.
Expand All @@ -63,32 +89,5 @@ $ task proto:gen:orchestrator: # only run for orchestrator

## Contributing

### Filing a PR

Before creating a PR with your change, you should generate a "changeset" file.

Let's assume that you've made some local changes in one of the protos.
Before filing a PR you need to generate a "changeset" description required for
the automated release process. Follow the steps below:

- Run `pnpm changset` in the git top level directory.
- This repo contains multiple packages, so it will ask you for which package it
should generate changeset update.
- Answer remaining questions. At the end, you will have a new
`.changeset/<random-name>.md` file generated.
- Now you need to commit and push your changes
- Create a Pull request which includes your code change and generated
"changeset" file.

#### Preparing a release

After merging your PR, a changesets CI job will create or update a "Version
Packages" PR which contains a release bump.

#### Merging Version Packages PR

Now you can Approve/Request approval and Merge the PR from the previous step.
After merging, it will kick off the push-main.yml workflow and that will release
a new versions and push tags automatically. You can navigate to the
[tags view](https://github.com/smartcontractkit/chainlink-protos/tags), to check if the
latest tag is available.
For instructions on how to contribute to `chainlink-protos` and the release process,
see [CONTRIBUTING.md](https://github.com/smartcontractkit/chainlink-protos/blob/main/CONTRIBUTING.md)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"ci:changeset:publish": "sh ./scripts/tag-and-push.sh",
"ci:changeset:version": "pnpm changeset version",
"changesets": "pnpm changeset"
"changeset": "pnpm changeset"
},
"author": "smartcontractkit",
"license": "MIT",
Expand Down
5 changes: 5 additions & 0 deletions taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ tasks:
cmds:
- buf format -w

lint:
desc: "Run buf lint"
cmds:
- buf lint

proto:all:
desc: Generate all protobuf files for all services
cmds:
Expand Down

0 comments on commit 99a1e35

Please sign in to comment.