Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
2 parents a3bbd53 + 8bb6f16 commit ee0ae0c
Show file tree
Hide file tree
Showing 174 changed files with 14,840 additions and 1,529 deletions.
20 changes: 7 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,16 @@ jobs:
with:
node-version: ${{ matrix.node }}

- name: Install Dependencies
- name: Build nodejs sdk
run: |
npm ci
node -v
./scripts/build-and-test-package.sh "client-sdk-nodejs"
- name: Build
run: npm run build

- name: Lint
run: npm run lint

- name: Unit Test
run: npm run unit-test

- name: Integration Test
run: npm run integration-test
# needs to happen after building our common package, since it depends on it
- name: Build web sdk
run: |
node -v
./scripts/build-and-test-package.sh "client-sdk-web"
test-examples:
strategy:
Expand Down
67 changes: 36 additions & 31 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ name: "CodeQL"

on:
push:
branches: [ "main", release ]
branches: ["main", release]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
branches: ["main"]
schedule:
- cron: '37 16 * * 4'
- cron: "37 16 * * 4"

jobs:
analyze:
Expand All @@ -32,43 +32,48 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ["javascript"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

- name: Build nodejs sdk
run: |
node -v
./scripts/build-package.sh "client-sdk-nodejs"
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# needs to happen after building our common package, since it depends on it
- name: Build web sdk
run: |
node -v
./scripts/build-and-test-package.sh "client-sdk-web"
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
20 changes: 7 additions & 13 deletions .github/workflows/on-push-to-main-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,16 @@ jobs:
with:
node-version: 16

- name: Install Dependencies
- name: Build nodejs sdk
run: |
npm ci
node -v
./scripts/build-package.sh "client-sdk-nodejs"
- name: Build
run: npm run build

- name: Lint
run: npm run lint

- name: Unit Test
run: npm run unit-test

- name: Integration Test
run: npm run integration-test
# needs to happen after building our common package, since it depends on it
- name: Build web sdk
run: |
node -v
./scripts/build-package.sh "client-sdk-web"
- name: Generate README
uses: momentohq/standards-and-practices/github-actions/generate-and-commit-oss-readme@gh-actions-v1
Expand Down
45 changes: 22 additions & 23 deletions .github/workflows/on-push-to-release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
# to actually have anything to do with CI:
# https://github.com/go-semantic-release/semantic-release/blob/master/cmd/semantic-release/main.go#L173-L194
# https://github.com/go-semantic-release/condition-github/blob/4c8af3fc516151423fff2f77eb08bf7082570676/pkg/condition/github.go#L42-L44
custom-arguments: '--no-ci'
custom-arguments: "--no-ci"

- name: Output release
id: release
Expand All @@ -46,27 +46,24 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: 'https://registry.npmjs.org'
registry-url: "https://registry.npmjs.org"

- name: Install Dependencies
run: npm ci

- name: Build
run: npm run build

- name: Lint
run: npm run lint
- name: Build nodejs sdk
run: |
node -v
./scripts/build-package.sh "client-sdk-nodejs"
- name: Test
run: npm run test
# TODO: eventually we will have to add build steps for the grpc-web sdk

- name: Publish package to npm
- name: Publish nodejs sdk package to npm
run: |
export VERSION="${{ needs.release.outputs.version }}"
echo "Publishing package with version $VERSION"
mv package.json package.json.ORIG
cat package.json.ORIG|jq ". += {\"version\": \"$VERSION\"}" > package.json
npm publish
pushd ./packages/client-sdk-nodejs
export VERSION="${{ needs.release.outputs.version }}"
echo "Publishing package with version $VERSION"
mv package.json package.json.ORIG
cat package.json.ORIG|jq ". += {\"version\": \"$VERSION\"}" > package.json
npm publish
popd
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
Expand All @@ -84,10 +81,12 @@ jobs:

- name: Publish lambda layer
run: |
export VERSION="${{ needs.release.outputs.version }}"
echo "Publishing lambda layer with version $VERSION"
pushd build-scripts
./build-lambda-layer.sh
./publish-lambda-layer.sh ${VERSION}
pushd ./packages/client-sdk-nodejs
export VERSION="${{ needs.release.outputs.version }}"
echo "Publishing lambda layer with version $VERSION"
pushd build-scripts
./build-lambda-layer.sh
./publish-lambda-layer.sh ${VERSION}
popd
popd
shell: bash
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ main()
console.log('success!!');
})
.catch((e: Error) => {
console.error(`An error occurred! ${e.message}`);
console.error(`Uncaught exception while running example: ${e.message}`);
throw e;
});
Expand Down
28 changes: 28 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,34 @@ MOMENTO_AUTH_TOKEN=<YOUR AUTH TOKEN> npm run dictionary

Example Code: [dictionary.ts](dictionary.ts)

## Running the Pubsub Example

This example demonstrates how to subscribe to a topic and publish values to it.

In one terminal, subscribe to a topic on a cache:

```bash
MOMENTO_AUTH_TOKEN=<YOUR AUTH TOKEN> npm run topic-subscribe <cache-name> <topic-name>
```

Then in another terminal, publish a value to the topic:

```bash
MOMENTO_AUTH_TOKEN=<YOUR AUTH TOKEN> npm run topic-publish <cache-name> <topic-name> <value>
```

Note that you do not need to create the cache before running the examples; the examples take care of that. Also note the service creates a topic automatically.

As an example:

```bash
# in the first terminal
MOMENTO_AUTH_TOKEN=<YOUR AUTH TOKEN> npm run topic-subscribe my-cache dogs
# in another terminal
MOMENTO_AUTH_TOKEN=<YOUR AUTH TOKEN> npm run topic-publish my-cache dogs poodle
# "poodle" should soon appear on the first terminal
```

## Running the load generator example

This repo includes a very basic load generator, to allow you to experiment with
Expand Down
2 changes: 1 addition & 1 deletion examples/advanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,6 @@ main()
logger.info('success!!');
})
.catch((e: Error) => {
console.error(`failed to get from cache ${e.message}`);
console.error(`Uncaught exception while running example: ${e.message}`);
throw e;
});
2 changes: 1 addition & 1 deletion examples/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ main()
console.log('success!!');
})
.catch((e: Error) => {
console.error(`An error occurred! ${e.message}`);
console.error(`Uncaught exception while running example: ${e.message}`);
throw e;
});
30 changes: 15 additions & 15 deletions examples/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"advanced": "tsc && node dist/advanced.js",
"load-gen": "tsc && node dist/load-gen.js",
"dictionary": "tsc && node dist/dictionary.js",
"topic-subscribe": "tsc && node dist/topic-subscribe.js",
"topic-publish": "tsc && node dist/topic-publish.js",
"request-coalescing": "tsc && node dist/request-coalescing.js",
"test": "jest",
"lint": "eslint . --ext .ts",
Expand All @@ -32,7 +34,7 @@
},
"dependencies": {
"@gomomento/generated-types": "0.32.1",
"@gomomento/sdk": "1.5.0",
"@gomomento/sdk": "1.6.0",
"@grpc/grpc-js": "1.7.3",
"hdr-histogram-js": "3.0.0",
"node-fetch": "2.6.7",
Expand Down
Loading

0 comments on commit ee0ae0c

Please sign in to comment.