Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module test with specified dependencies #1

Merged
merged 15 commits into from
Jul 3, 2024
Merged
17 changes: 13 additions & 4 deletions .github/workflows/core.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
name: core release
name: nats-core release

on:
push:
paths:
- 'core/**'
- '.github/workflows/core.yml'
tags: [ 'core/*' ]
branches:
- '*'
jobs:
test:
name: ${{ matrix.config.kind }} ${{ matrix.config.os }}
name: test core with released dependencies
runs-on: ubuntu-latest-4-cores
environment: CI
strategy:
matrix:
deno-version: [1.44.4]
deno-version: [1.x.x]
permissions:
contents: read
id-token: write

steps:
- name: Git Checkout Core
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1

Expand All @@ -30,11 +31,19 @@ jobs:
with:
deno-version: ${{ matrix.deno-version }}

- name: Install nats-server
uses: aricart/[email protected]
with:
repo: nats-io/nats-server
name: nats-server
cache: true

- name: Lint Deno Module
working-directory: core
run: |
deno fmt --check
deno lint

- name: Test Deno Module
working-directory: core
env:
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/jetstream.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
name: core release
name: jetstream release

on:
push:
paths:
- 'jetstream/**'
- '.github/workflows/jetstream.yml'
tags: [ 'jetstream/*' ]
branches:
- '*'
jobs:
test:
name: ${{ matrix.config.kind }} ${{ matrix.config.os }}
name: test jetstream with released dependencies
runs-on: ubuntu-latest-4-cores
environment: CI
strategy:
matrix:
deno-version: [1.44.4]
deno-version: [1.x.x]

steps:
- name: Git Checkout JetStream
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1

Expand All @@ -27,6 +28,13 @@ jobs:
with:
deno-version: ${{ matrix.deno-version }}

- name: Install nats-server
uses: aricart/[email protected]
with:
repo: nats-io/nats-server
name: nats-server
cache: true

- name: Lint Deno Module
working-directory: jetstream
run: |
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/kv.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
name: core release
name: kv release

on:
push:
paths:
- 'kv/**'
- '.github/workflows/kv.yml'
tags: [ 'kv/*' ]
branches:
- '*'
jobs:
test:
name: ${{ matrix.config.kind }} ${{ matrix.config.os }}
name: test kv with released dependencies
runs-on: ubuntu-latest-4-cores
environment: CI
strategy:
matrix:
deno-version: [1.44.4]
deno-version: [1.x.x]

steps:
- name: Git Checkout Kv
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1

Expand All @@ -27,6 +28,13 @@ jobs:
with:
deno-version: ${{ matrix.deno-version }}

- name: Install nats-server
uses: aricart/[email protected]
with:
repo: nats-io/nats-server
name: nats-server
cache: true

- name: Lint Deno Module
working-directory: kv
run: |
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/obj.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
name: core release
name: obj release

on:
push:
paths:
- 'obj/**'
- '.github/workflows/obj.yml'
tags: [ 'obj/*' ]
branches:
- '*'
jobs:
test:
name: ${{ matrix.config.kind }} ${{ matrix.config.os }}
name: test obj with released dependencies
runs-on: ubuntu-latest-4-cores
environment: CI
strategy:
matrix:
deno-version: [1.44.4]
deno-version: [1.x.x]

steps:
- name: Git Checkout Obj
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1

Expand All @@ -27,6 +28,13 @@ jobs:
with:
deno-version: ${{ matrix.deno-version }}

- name: Install nats-server
uses: aricart/[email protected]
with:
repo: nats-io/nats-server
name: nats-server
cache: true

- name: Lint Deno Module
working-directory: obj
run: |
Expand Down
26 changes: 22 additions & 4 deletions .github/workflows/services.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
name: core release
name: services release

on:
push:
paths:
- 'services/**'
- '.github/workflows/services.yml'
tags: [ 'services/*' ]
branches:
- '*'
jobs:
test:
name: ${{ matrix.config.kind }} ${{ matrix.config.os }}
name: test services with released dependencies
runs-on: ubuntu-latest-4-cores
environment: CI
strategy:
matrix:
deno-version: [1.44.4]
deno-version: [1.x.x]

steps:
- name: Git Checkout Services
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1

Expand All @@ -27,6 +28,23 @@ jobs:
with:
deno-version: ${{ matrix.deno-version }}

- name: Install nats-server
uses: aricart/[email protected]
with:
repo: nats-io/nats-server
name: nats-server
cache: true

- name: Set NATS Server Version
run: echo "NATS_VERSION=v2.10.17" >> $GITHUB_ENV

- name: Get nats-server
run: |
wget "https://github.com/nats-io/nats-server/releases/download/$NATS_VERSION/nats-server-$NATS_VERSION-linux-amd64.zip" -O tmp.zip
unzip tmp.zip
mv nats-server-$NATS_VERSION-linux-amd64 nats-server
rm nats-server/README.md LICENSE

- name: Lint Deno Module
working-directory: services
run: |
Expand Down
56 changes: 28 additions & 28 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: NATS.deno
name: Test nats.js

on:
push:
Expand All @@ -8,19 +8,22 @@ on:
- '*'
pull_request:
branches: [main]
types: [opened]

jobs:
test:
name: ${{ matrix.config.kind }} ${{ matrix.config.os }}
runs-on: ubuntu-latest-4-cores
environment: CI
strategy:
matrix:
deno-version: [1.44.4]
deno-version: [ 1.44.4 ]
module: [ core, jetstream, kv, obj, services ]

name: test ${{matrix.module}} with local dependencies
runs-on: ubuntu-latest-4-cores
environment: CI

steps:
- name: Git Checkout Deno Module
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1

Expand All @@ -29,43 +32,40 @@ jobs:
with:
deno-version: ${{ matrix.deno-version }}

- name: Set NATS Server Version
run: echo "NATS_VERSION=v2.10.17" >> $GITHUB_ENV

# this here because dns seems to be wedged on gha
# - name: Add hosts to /etc/hosts
# run: |
# sudo echo "145.40.102.131 demo.nats.io" | sudo tee -a /etc/hosts

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

- name: Lint Deno Module
run: |
deno fmt --check
deno lint

- name: Test Deno Module
- name: Test ${{matrix.module}} Module
env:
TMPDIR: ${{ runner.temp }}
CI: true
NGS_CI_USER: ${{ secrets.NGS_CI_USER }}
run: |
deno task test

- name: Build nats.js
run: deno bundle --unstable transport-deno/src/connect.ts nats.js
deno task test-${{ matrix.module }}

- name: Generate lcov
run: deno coverage --unstable --lcov ./coverage > cov.lcov

- name: Upload coverage
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: ./cov.lcov
# - name: Build nats.js
# run: deno bundle --unstable transport-deno/src/connect.ts nats.js
#
# - name: Generate lcov
# run: deno coverage --unstable --lcov ./coverage > cov.lcov
#
# - name: Upload coverage
# uses: coverallsapp/[email protected]
# with:
# github-token: ${{ secrets.github_token }}
# path-to-lcov: ./cov.lcov

17 changes: 5 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,16 @@
build: test

lint:
deno lint --ignore=docs/,debug/
deno lint

test: clean
deno test --allow-all --parallel --reload --quiet --coverage=coverage core/tests/ jetstream/tests kv/tests/ obj/tests/ services/tests/
deno test --allow-all --parallel --reload --quiet --unsafely-ignore-certificate-errors --coverage=coverage core/unsafe_tests/


testw: clean
deno test --allow-all --unstable --reload --parallel --watch --fail-fast tests/ jetstream/ kv/tests/ obj/tests/ services/tests/
deno task test

cover:
deno coverage --unstable ./coverage --lcov > ./coverage/out.lcov
genhtml -o ./coverage/html ./coverage/out.lcov
open ./coverage/html/index.html
deno task cover

clean:
rm -rf ./coverage
deno task clean

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


fmt:
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
deno fmt
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
![Test NATS.deno](https://github.com/nats-io/nats.deno/workflows/NATS.deno/badge.svg)
[![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)


> [!CAUTION]
> This project is still working in progress and not yet released. Currently supported Javascript are
> [!CAUTION] This project is still working in progress and not yet released.
> Currently supported Javascript are
>
> - [nats.deno](https://github.com/nats-io/nats.deno)
> - [nats.js](https://github.com/nats-io/nats.js)
> - [nats.ws](https://github.com/nats-io/nats.ws)



Welcome to the new NATS.js repository! Beginning with the v3 release of the
JavaScript clients, the NATS.js repository reorganizes the NATS JavaScript
client libraries into a formal mono-repo.
Expand Down
3 changes: 2 additions & 1 deletion core/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
]
},
"tasks": {
"clean": "rm -rf ./lib ./cjs ./esm"
"clean": "rm -rf ./lib ./cjs ./esm",
"test": "deno test -A --parallel --reload --quiet tests/ --import-map=./import_map.json"
},
"imports": {
"@nats-io/nkeys": "jsr:@nats-io/[email protected]",
Expand Down
Loading