Skip to content

Commit

Permalink
Merge pull request #16 from momentohq/update-readme
Browse files Browse the repository at this point in the history
chore: update readmes
  • Loading branch information
anitarua authored Jul 3, 2024
2 parents 9f6d083 + bf1c0c9 commit 7d0e31e
Show file tree
Hide file tree
Showing 8 changed files with 377 additions and 16 deletions.
25 changes: 23 additions & 2 deletions .github/workflows/on_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,32 @@ jobs:
uses: momentohq/standards-and-practices/github-actions/shared-build@gh-actions-v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

readme:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3

- name: Verify README generation
uses: momentohq/standards-and-practices/github-actions/oss-readme-template@gh-actions-v2
with:
project_status: official
project_stability: beta
project_type: other
template_file: README.template.md
output_file: README.md

- name: Verify CONTRIBUTING generation
uses: momentohq/standards-and-practices/github-actions/oss-readme-template@gh-actions-v2
with:
project_status: official
project_stability: beta
project_type: other
template_file: CONTRIBUTING.template.md
output_file: CONTRIBUTING.md

test:
uses: ./.github/workflows/test.yml
secrets:
auth-token: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
github-token: ${{ secrets.MOMENTO_MACHINE_USER_GITHUB_TOKEN }}


33 changes: 33 additions & 0 deletions .github/workflows/on_push_to_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Push to Main

on:
push:
branches: [ "main" ]

jobs:
readme:
runs-on: ubuntu-latest

steps:
- name: Setup repo
uses: actions/checkout@v3
with:
token: ${{ secrets.MOMENTO_MACHINE_USER_GITHUB_TOKEN }}

- name: Generate README
uses: momentohq/standards-and-practices/github-actions/generate-and-commit-oss-readme@gh-actions-v2
with:
project_status: official
project_stability: beta
project_type: other
template_file: README.template.md
output_file: README.md

- name: Generate CONTRIBUTING
uses: momentohq/standards-and-practices/github-actions/generate-and-commit-oss-readme@gh-actions-v2
with:
project_status: official
project_stability: beta
project_type: other
template_file: CONTRIBUTING.template.md
output_file: CONTRIBUTING.md
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Happy coding :dancer:
## Requirements :coffee:

- Go 1.18 or above is required https://go.dev/doc/install
- A Momento auth token is required, you can generate one using the [Momento Console](https://console.gomomento.com)
- A Momento API key is required, you can generate one using the [Momento Console](https://console.gomomento.com)

<br/>

Expand Down
73 changes: 73 additions & 0 deletions CONTRIBUTING.template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{{ ossHeader }}

# Welcome to the Momento Go-Redis contributing guide :wave:

Thank you for taking your time to contribute to our Momento `go-redis` wrapper!
<br/>
This guide will provide you information to start your own development and testing.
<br/>
Happy coding :dancer:
<br/>

## Submitting

If you've found a bug or have a suggestion, please [open an issue in our project](https://github.com/momentohq/terraform-provider-momento/issues).

If you want to submit a change, please [submit a pull request to our project](https://github.com/momentohq/terraform-provider-momento/pulls). Use the normal [Github pull request process](https://docs.github.com/en/pull-requests).

## Requirements :coffee:

- [Go 1.18 or above](https://go.dev/doc/install) is required
- A Momento API key is required, you can generate one using the [Momento Console](https://console.gomomento.com)

## Developing :computer:

### Build

```bash
make build
```

### Formatting and Tidy :flashlight:

```bash
make lint
```

## Tests :zap:

### Run integration tests against Momento

```bash
export TEST_AUTH_TOKEN=<YOUR_AUTH_TOKEN>
make test-momento
```

### Run integration tests against Redis

First run Redis either natively, run Redis in a Docker container, or do your development in a devcontainer. Here is an example of running Redis in a Docker container:

```bash
docker run -it -p 6379:6379 redis
```

Then run the tests

```bash
make test-redis
```

This assumes the Redis server is running on `localhost:6379`.

By running Redis on the local host, you can use the `redis-cli` to inspect the state of the Redis server as well as interactively debug the tests.

### Run all tests

This will run both the integration tests against Momento and Redis. As above, we assume the Redis server is running on `localhost:6379`.

```bash
export TEST_AUTH_TOKEN=<YOUR_AUTH_TOKEN>
make test
```

{{ ossFooter }}
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ import (
)

func initRedisClient() redis.Cmdable {
credential, eErr := auth.NewEnvMomentoTokenProvider("MOMENTO_AUTH_TOKEN")
credential, eErr := auth.NewEnvMomentoTokenProvider("MOMENTO_API_KEY")
if eErr != nil {
panic("Failed to initialize credentials through auth token " + eErr.Error())
panic("Failed to initialize credentials through API key " + eErr.Error())
}
cacheClient, cErr := momento.NewCacheClient(config.LaptopLatest(), credential, 60*time.Second)
if cErr != nil {
Expand Down Expand Up @@ -88,9 +88,9 @@ go get github.com/momentohq/momento-go-redis-client

### Prerequisites

To run these examples, you will need a Momento auth token. A Momento auth token is required, you can generate one using the [Momento Console](https://console.gomomento.com)
To run these examples, you will need a Momento API key. A Momento API key is required, you can generate one using the [Momento Console](https://console.gomomento.com)

The examples will utilize your auth token via the environment variable `MOMENTO_AUTH_TOKEN` you set.
The examples will utilize your API key via the environment variable `MOMENTO_API_KEY` you set.

### Basic Example

Expand All @@ -104,7 +104,7 @@ Here's an example run against Momento Cache:

```bash
cd examples/basic
export MOMENTO_AUTH_TOKEN=<your momento auth token goes here>
export MOMENTO_API_KEY=<your momento API key goes here>
go run main.go -cacheName cache
```

Expand Down Expand Up @@ -208,9 +208,9 @@ import (

// only change in the function definition from before and the body remains the same
func initRedisClient() momentoredis.MomentoRedisCmdable {
credential, eErr := auth.NewEnvMomentoTokenProvider("MOMENTO_AUTH_TOKEN")
credential, eErr := auth.NewEnvMomentoTokenProvider("MOMENTO_API_KEY")
if eErr != nil {
panic("Failed to initialize credentials through auth token " + eErr.Error())
panic("Failed to initialize credentials through API key " + eErr.Error())
}
cacheClient, cErr := momento.NewCacheClient(config.LaptopLatest(), credential, 60*time.Second)
if cErr != nil {
Expand Down
Loading

0 comments on commit 7d0e31e

Please sign in to comment.