Skip to content

Commit 73d896b

Browse files
authored
module test with specified dependencies (#1)
[CI] made branch tests work in a matrix for speedier runs and recovery [CI] added ci tests for modules that have edited source run against their released dependencies to flush out any dependency mismatches [FIX] fmt and linting issues [CI] changed to use action that installs nats-server in path, launcher now only looks for binary in path [CI] updated makefile to use deno tasks
1 parent 8726c71 commit 73d896b

31 files changed

+253
-140
lines changed

Diff for: .github/workflows/core.yml

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1-
name: core release
1+
name: nats-core release
22

33
on:
44
push:
55
paths:
66
- 'core/**'
7+
- '.github/workflows/core.yml'
78
tags: [ 'core/*' ]
89
branches:
910
- '*'
1011
jobs:
1112
test:
12-
name: ${{ matrix.config.kind }} ${{ matrix.config.os }}
13+
name: test core with released dependencies
1314
runs-on: ubuntu-latest-4-cores
1415
environment: CI
1516
strategy:
1617
matrix:
17-
deno-version: [1.44.4]
18+
deno-version: [1.x.x]
1819
permissions:
1920
contents: read
2021
id-token: write
2122

2223
steps:
2324
- name: Git Checkout Core
24-
uses: actions/checkout@v3
25+
uses: actions/checkout@v4
2526
with:
2627
fetch-depth: 1
2728

@@ -30,11 +31,19 @@ jobs:
3031
with:
3132
deno-version: ${{ matrix.deno-version }}
3233

34+
- name: Install nats-server
35+
uses: aricart/[email protected]
36+
with:
37+
repo: nats-io/nats-server
38+
name: nats-server
39+
cache: true
40+
3341
- name: Lint Deno Module
3442
working-directory: core
3543
run: |
3644
deno fmt --check
3745
deno lint
46+
3847
- name: Test Deno Module
3948
working-directory: core
4049
env:

Diff for: .github/workflows/jetstream.yml

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1-
name: core release
1+
name: jetstream release
22

33
on:
44
push:
55
paths:
66
- 'jetstream/**'
7+
- '.github/workflows/jetstream.yml'
78
tags: [ 'jetstream/*' ]
89
branches:
910
- '*'
1011
jobs:
1112
test:
12-
name: ${{ matrix.config.kind }} ${{ matrix.config.os }}
13+
name: test jetstream with released dependencies
1314
runs-on: ubuntu-latest-4-cores
1415
environment: CI
1516
strategy:
1617
matrix:
17-
deno-version: [1.44.4]
18+
deno-version: [1.x.x]
1819

1920
steps:
2021
- name: Git Checkout JetStream
21-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
2223
with:
2324
fetch-depth: 1
2425

@@ -27,6 +28,13 @@ jobs:
2728
with:
2829
deno-version: ${{ matrix.deno-version }}
2930

31+
- name: Install nats-server
32+
uses: aricart/[email protected]
33+
with:
34+
repo: nats-io/nats-server
35+
name: nats-server
36+
cache: true
37+
3038
- name: Lint Deno Module
3139
working-directory: jetstream
3240
run: |

Diff for: .github/workflows/kv.yml

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1-
name: core release
1+
name: kv release
22

33
on:
44
push:
55
paths:
66
- 'kv/**'
7+
- '.github/workflows/kv.yml'
78
tags: [ 'kv/*' ]
89
branches:
910
- '*'
1011
jobs:
1112
test:
12-
name: ${{ matrix.config.kind }} ${{ matrix.config.os }}
13+
name: test kv with released dependencies
1314
runs-on: ubuntu-latest-4-cores
1415
environment: CI
1516
strategy:
1617
matrix:
17-
deno-version: [1.44.4]
18+
deno-version: [1.x.x]
1819

1920
steps:
2021
- name: Git Checkout Kv
21-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
2223
with:
2324
fetch-depth: 1
2425

@@ -27,6 +28,13 @@ jobs:
2728
with:
2829
deno-version: ${{ matrix.deno-version }}
2930

31+
- name: Install nats-server
32+
uses: aricart/[email protected]
33+
with:
34+
repo: nats-io/nats-server
35+
name: nats-server
36+
cache: true
37+
3038
- name: Lint Deno Module
3139
working-directory: kv
3240
run: |

Diff for: .github/workflows/obj.yml

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1-
name: core release
1+
name: obj release
22

33
on:
44
push:
55
paths:
66
- 'obj/**'
7+
- '.github/workflows/obj.yml'
78
tags: [ 'obj/*' ]
89
branches:
910
- '*'
1011
jobs:
1112
test:
12-
name: ${{ matrix.config.kind }} ${{ matrix.config.os }}
13+
name: test obj with released dependencies
1314
runs-on: ubuntu-latest-4-cores
1415
environment: CI
1516
strategy:
1617
matrix:
17-
deno-version: [1.44.4]
18+
deno-version: [1.x.x]
1819

1920
steps:
2021
- name: Git Checkout Obj
21-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
2223
with:
2324
fetch-depth: 1
2425

@@ -27,6 +28,13 @@ jobs:
2728
with:
2829
deno-version: ${{ matrix.deno-version }}
2930

31+
- name: Install nats-server
32+
uses: aricart/[email protected]
33+
with:
34+
repo: nats-io/nats-server
35+
name: nats-server
36+
cache: true
37+
3038
- name: Lint Deno Module
3139
working-directory: obj
3240
run: |

Diff for: .github/workflows/services.yml

+22-4
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1-
name: core release
1+
name: services release
22

33
on:
44
push:
55
paths:
66
- 'services/**'
7+
- '.github/workflows/services.yml'
78
tags: [ 'services/*' ]
89
branches:
910
- '*'
1011
jobs:
1112
test:
12-
name: ${{ matrix.config.kind }} ${{ matrix.config.os }}
13+
name: test services with released dependencies
1314
runs-on: ubuntu-latest-4-cores
1415
environment: CI
1516
strategy:
1617
matrix:
17-
deno-version: [1.44.4]
18+
deno-version: [1.x.x]
1819

1920
steps:
2021
- name: Git Checkout Services
21-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
2223
with:
2324
fetch-depth: 1
2425

@@ -27,6 +28,23 @@ jobs:
2728
with:
2829
deno-version: ${{ matrix.deno-version }}
2930

31+
- name: Install nats-server
32+
uses: aricart/[email protected]
33+
with:
34+
repo: nats-io/nats-server
35+
name: nats-server
36+
cache: true
37+
38+
- name: Set NATS Server Version
39+
run: echo "NATS_VERSION=v2.10.17" >> $GITHUB_ENV
40+
41+
- name: Get nats-server
42+
run: |
43+
wget "https://github.com/nats-io/nats-server/releases/download/$NATS_VERSION/nats-server-$NATS_VERSION-linux-amd64.zip" -O tmp.zip
44+
unzip tmp.zip
45+
mv nats-server-$NATS_VERSION-linux-amd64 nats-server
46+
rm nats-server/README.md LICENSE
47+
3048
- name: Lint Deno Module
3149
working-directory: services
3250
run: |

Diff for: .github/workflows/test.yml

+28-28
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: NATS.deno
1+
name: Test nats.js
22

33
on:
44
push:
@@ -8,19 +8,22 @@ on:
88
- '*'
99
pull_request:
1010
branches: [main]
11+
types: [opened]
1112

1213
jobs:
1314
test:
14-
name: ${{ matrix.config.kind }} ${{ matrix.config.os }}
15-
runs-on: ubuntu-latest-4-cores
16-
environment: CI
1715
strategy:
1816
matrix:
19-
deno-version: [1.44.4]
17+
deno-version: [ 1.44.4 ]
18+
module: [ core, jetstream, kv, obj, services ]
19+
20+
name: test ${{matrix.module}} with local dependencies
21+
runs-on: ubuntu-latest-4-cores
22+
environment: CI
2023

2124
steps:
2225
- name: Git Checkout Deno Module
23-
uses: actions/checkout@v3
26+
uses: actions/checkout@v4
2427
with:
2528
fetch-depth: 1
2629

@@ -29,43 +32,40 @@ jobs:
2932
with:
3033
deno-version: ${{ matrix.deno-version }}
3134

32-
- name: Set NATS Server Version
33-
run: echo "NATS_VERSION=v2.10.17" >> $GITHUB_ENV
34-
3535
# this here because dns seems to be wedged on gha
3636
# - name: Add hosts to /etc/hosts
3737
# run: |
3838
# sudo echo "145.40.102.131 demo.nats.io" | sudo tee -a /etc/hosts
3939

40-
- name: Get nats-server
41-
run: |
42-
wget "https://github.com/nats-io/nats-server/releases/download/$NATS_VERSION/nats-server-$NATS_VERSION-linux-amd64.zip" -O tmp.zip
43-
unzip tmp.zip
44-
mv nats-server-$NATS_VERSION-linux-amd64 nats-server
45-
rm nats-server/README.md LICENSE
40+
- name: Install nats-server
41+
uses: aricart/[email protected]
42+
with:
43+
repo: nats-io/nats-server
44+
name: nats-server
45+
cache: true
4646

4747
- name: Lint Deno Module
4848
run: |
4949
deno fmt --check
5050
deno lint
5151
52-
- name: Test Deno Module
52+
- name: Test ${{matrix.module}} Module
5353
env:
5454
TMPDIR: ${{ runner.temp }}
5555
CI: true
5656
NGS_CI_USER: ${{ secrets.NGS_CI_USER }}
5757
run: |
58-
deno task test
59-
60-
- name: Build nats.js
61-
run: deno bundle --unstable transport-deno/src/connect.ts nats.js
58+
deno task test-${{ matrix.module }}
6259
63-
- name: Generate lcov
64-
run: deno coverage --unstable --lcov ./coverage > cov.lcov
65-
66-
- name: Upload coverage
67-
uses: coverallsapp/[email protected]
68-
with:
69-
github-token: ${{ secrets.github_token }}
70-
path-to-lcov: ./cov.lcov
60+
# - name: Build nats.js
61+
# run: deno bundle --unstable transport-deno/src/connect.ts nats.js
62+
#
63+
# - name: Generate lcov
64+
# run: deno coverage --unstable --lcov ./coverage > cov.lcov
65+
#
66+
# - name: Upload coverage
67+
# uses: coverallsapp/[email protected]
68+
# with:
69+
# github-token: ${{ secrets.github_token }}
70+
# path-to-lcov: ./cov.lcov
7171

Diff for: Makefile

+5-12
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,16 @@
33
build: test
44

55
lint:
6-
deno lint --ignore=docs/,debug/
6+
deno lint
77

88
test: clean
9-
deno test --allow-all --parallel --reload --quiet --coverage=coverage core/tests/ jetstream/tests kv/tests/ obj/tests/ services/tests/
10-
deno test --allow-all --parallel --reload --quiet --unsafely-ignore-certificate-errors --coverage=coverage core/unsafe_tests/
11-
12-
13-
testw: clean
14-
deno test --allow-all --unstable --reload --parallel --watch --fail-fast tests/ jetstream/ kv/tests/ obj/tests/ services/tests/
9+
deno task test
1510

1611
cover:
17-
deno coverage --unstable ./coverage --lcov > ./coverage/out.lcov
18-
genhtml -o ./coverage/html ./coverage/out.lcov
19-
open ./coverage/html/index.html
12+
deno task cover
2013

2114
clean:
22-
rm -rf ./coverage
15+
deno task clean
2316

2417
bundle:
2518
deno bundle --log-level info --unstable src/mod.ts ./nats.js
@@ -30,4 +23,4 @@ bundle:
3023

3124

3225
fmt:
33-
deno fmt transport-deno/ doc/ bin/ core/ examples/ tests/ debug/ unsafe_tests/ jetstream/ kv/ obj/ services/ test_helpers/ jetstream.md README.md migration.md services.md
26+
deno fmt

Diff for: README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44
![Test NATS.deno](https://github.com/nats-io/nats.deno/workflows/NATS.deno/badge.svg)
55
[![Coverage Status](https://coveralls.io/repos/github/nats-io/nats.deno/badge.svg?branch=main)](https://coveralls.io/github/nats-io/nats.deno?branch=main)
66

7-
8-
> [!CAUTION]
9-
> This project is still working in progress and not yet released. Currently supported Javascript are
7+
> [!CAUTION] This project is still working in progress and not yet released.
8+
> Currently supported Javascript are
9+
>
1010
> - [nats.deno](https://github.com/nats-io/nats.deno)
1111
> - [nats.js](https://github.com/nats-io/nats.js)
1212
> - [nats.ws](https://github.com/nats-io/nats.ws)
1313
14-
15-
1614
Welcome to the new NATS.js repository! Beginning with the v3 release of the
1715
JavaScript clients, the NATS.js repository reorganizes the NATS JavaScript
1816
client libraries into a formal mono-repo.

Diff for: core/deno.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
]
1313
},
1414
"tasks": {
15-
"clean": "rm -rf ./lib ./cjs ./esm"
15+
"clean": "rm -rf ./lib ./cjs ./esm",
16+
"test": "deno test -A --parallel --reload --quiet tests/ --import-map=./import_map.json"
1617
},
1718
"imports": {
1819
"@nats-io/nkeys": "jsr:@nats-io/[email protected]",

0 commit comments

Comments
 (0)