Skip to content

Commit 70988b2

Browse files
author
Joshua Goldstein
committed
squash
1 parent b55b179 commit 70988b2

13 files changed

+3526
-5868
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: ci-aqua-security-trivy-tests
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
types:
8+
- opened
9+
- reopened
10+
- synchronize
11+
- ready_for_review
12+
branches:
13+
- master
14+
schedule:
15+
- cron: "0 * * * *"
16+
jobs:
17+
build:
18+
name: trivy-tests
19+
runs-on: ubuntu-20.04
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v3
23+
- name: Run Trivy vulnerability scanner
24+
uses: aquasecurity/trivy-action@master
25+
with:
26+
scan-type: 'fs'
27+
scan-ref: '.'
28+
format: 'sarif'
29+
output: 'trivy-results.sarif'
30+
- name: Upload Trivy scan results to GitHub Security tab
31+
uses: github/codeql-action/upload-sarif@v2
32+
with:
33+
sarif_file: 'trivy-results.sarif'
Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

22
name: ci-dgraph-js-http-tests
3-
43
on:
54
push:
65
branches:
@@ -13,27 +12,49 @@ on:
1312
- ready_for_review
1413
branches:
1514
- master
16-
1715
jobs:
1816
build:
19-
2017
runs-on: ubuntu-20.04
21-
2218
strategy:
19+
fail-fast: false
2320
matrix:
24-
node-version: [14.x, 16.x, 18.x, 19.x]
21+
node-version: [16.x, 18.x, 19.x, 20.x]
2522
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
26-
2723
steps:
28-
- uses: actions/checkout@v3
29-
- name: Use Node.js ${{ matrix.node-version }}
24+
- name: Checkout dgraph-js-http repo
25+
uses: actions/checkout@v3
26+
with:
27+
path: dgraph-js-http
28+
repository: dgraph-io/dgraph-js-http
29+
ref: ${{ github.ref }}
30+
- name: Checkout dgraph repo
31+
uses: actions/checkout@v3
32+
with:
33+
path: dgraph
34+
repository: dgraph-io/dgraph
35+
ref: main
36+
- name: Get Go Version
37+
run: |
38+
#!/bin/bash
39+
cd dgraph
40+
GOVERSION=$({ [ -f .go-version ] && cat .go-version; })
41+
echo "GOVERSION=$GOVERSION" >> $GITHUB_ENV
42+
- name: Set up Go
43+
uses: actions/setup-go@v3
44+
with:
45+
go-version: ${{ env.GOVERSION }}
46+
- name: Build dgraph binary
47+
run: cd dgraph && make docker-image # also builds dgraph binary
48+
- name: Move dgraph binary to gopath
49+
run: cd dgraph && mv dgraph/dgraph ~/go/bin/dgraph
50+
- name: Setup node.js ${{ matrix.node-version }}
3051
uses: actions/setup-node@v3
3152
with:
3253
node-version: ${{ matrix.node-version }}
3354
cache: 'npm'
34-
- name: Install Dependencies
35-
run: bash ./scripts/install_dgraph.sh
36-
- name: run tests
55+
cache-dependency-path: dgraph-js-http/package-lock.json
56+
- name: Run dgraph-js-http tests
57+
working-directory: dgraph-js-http
3758
run: |
3859
npm ci --legacy-peer-deps
39-
bash ./scripts/build.sh
60+
bash ./scripts/run-tests.sh

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,8 @@ coverage/
3737
Thumbs.db
3838

3939
# Dgraph
40-
4140
data/**
41+
dgraph-local-data/
42+
43+
# npm test cruft
44+
t/

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ and understand how to run and work with Dgraph.
1414

1515
[docs.dgraph.io]: https://docs.dgraph.io
1616

17-
**Use [Discuss Issues](https://discuss.dgraph.io/c/issues/35) for reporting issues about this repository.**
18-
1917
## Table of contents
2018

2119
- [Install](#install)
@@ -47,7 +45,7 @@ yarn add dgraph-js-http
4745
or npm:
4846

4947
```sh
50-
npm install dgraph-js-http --save
48+
npm install dgraph-js-http
5149
```
5250

5351
You will also need a Promise polyfill for
@@ -62,9 +60,9 @@ use a different version of this client.
6260

6361
| Dgraph version | dgraph-js-http version |
6462
| :------------: | :--------------------: |
65-
| >= 21.03.0 | >= _21.3.0_ |
66-
| >= 20.03.0 | >= _20.3.0_ |
67-
| >= 1.1 | >= _1.1.0_ |
63+
| 21.3.X | *21.3.0* |
64+
| 22.0.X | *21.3.0* |
65+
| 23.0.X | *23.0.0* |
6866

6967
## Quickstart
7068

@@ -418,8 +416,8 @@ npm run build
418416

419417
### Running tests
420418

421-
Make sure you have a Dgraph server running on localhost before you run this task.
419+
The script `run-tests.sh` spins up a local cluster and runs the npm tests.
422420

423421
```sh
424-
npm test
422+
bash scripts/run-tests.sh
425423
```

examples/simple/README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,46 @@ client for Dgraph.
77

88
## Running
99

10-
### Start Dgraph server
10+
### Start dgraph alpha
1111

12-
You will need to install [Dgraph v1.0.6 or above][releases] and run it.
12+
You will need to install [Dgraph v21.3.2 or above][releases] and run it.
1313

1414
[releases]: https://github.com/dgraph-io/dgraph/releases
1515

1616
You can run the commands below to start a clean Dgraph server every time, for
1717
testing and exploration.
1818

19-
First, create two separate directories for `dgraph zero` and `dgraph server`.
19+
First, create two separate directories for `dgraph zero` and `dgraph alpha`.
2020

2121
```sh
22-
mkdir -p dgraphdata/zero dgraphdata/data
22+
mkdir -p local-dgraph-data/zero local-dgraph-data/data
2323
```
2424

2525
Then start `dgraph zero`:
2626

2727
```sh
28-
cd dgraphdata/zero
28+
cd local-dgraph-data/zero
2929
rm -r zw; dgraph zero
3030
```
3131

32-
Finally, start the `dgraph server`:
32+
Finally, start the `dgraph alpha`:
3333

3434
```sh
35-
cd dgraphdata/data
36-
rm -r p w; dgraph server --lru_mb=1024 --zero localhost:5080
35+
cd local-dgraph-data/data
36+
rm -r p w; dgraph alpha --zero localhost:5080 -o 100
3737
```
3838

39+
Notice that in the command above, we shifted the ports by 100 from the default ports of 7080 for
40+
internal traffic, 8080 for http, and 9080 for GRPC, which means the alpha server is binding to
41+
the port 7180 for internal traffic, 8180 for http, and 9180 for GRPC.
42+
3943
For more configuration options, and other details, refer to
4044
[docs.dgraph.io](https://docs.dgraph.io)
4145

4246
## Install dependencies
4347

4448
```sh
45-
yarn install
49+
npm install
4650
```
4751

4852
## Run the sample code

examples/simple/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "simple",
33
"dependencies": {
4-
"dgraph-js-http": "^0.1.0"
4+
"dgraph-js-http": "^21.3.1"
55
}
66
}

0 commit comments

Comments
 (0)