Skip to content

Commit

Permalink
Merge pull request #3 from nicocoul/dev
Browse files Browse the repository at this point in the history
add ci
  • Loading branch information
nicocoul committed Nov 25, 2021
2 parents b033eeb + f077e85 commit c370742
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 60 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Test

on:
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 16.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: npm install
- name: Test
run: |
npm run test:coverage --if-present
npm run lint --if-present
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.npmignore
.gitignore
.eslintrc
.eslintrc.js
.git/
.lock-*
node_modules/
Expand All @@ -14,4 +14,4 @@ cli/
coverage/
img/
mrd/
*.tpl
.github/
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Ya Rfc (Remote Function Execution) is a [rpc](https://en.wikipedia.org/wiki/Remote_procedure_call) library for Node js.
# ya-rfc [![npm version](https://badge.fury.io/js/ya-rfc.svg)](http://badge.fury.io/js/ya-rfc) [![license](https://img.shields.io/npm/l/ya-rfc.svg)](http://badge.fury.io/js/ya-rfc) [![test](https://github.com/nicocoul/ya-rfc/actions/workflows/test.yml/badge.svg)](https://github.com/nicocoul/ya-rfc/actions/workflows/test.yml) [![Coverage](https://coveralls.io/repos/github/nicocoul/ya-rfc/badge.svg?branch=main)](https://coveralls.io/github/nicocoul/ya-rfc?branch=main) [![Activity](https://img.shields.io/github/commit-activity/m/nicocoul/ya-rfc)](https://github.com/badges/shields/pulse)
Ya Rfc (Remote Function Call) is a [rpc](https://en.wikipedia.org/wiki/Remote_procedure_call) library for Node js.

Integrates well with [ya-pubsub](https://www.npmjs.com/package/ya-pubsub).

Expand Down
29 changes: 0 additions & 29 deletions README.md.tpl

This file was deleted.

30 changes: 30 additions & 0 deletions cli/README.md.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# ya-rfc [![npm version](https://badge.fury.io/js/ya-rfc.svg)](http://badge.fury.io/js/ya-rfc) [![license](https://img.shields.io/npm/l/ya-rfc.svg)](http://badge.fury.io/js/ya-rfc) [![test](https://github.com/nicocoul/ya-rfc/actions/workflows/test.yml/badge.svg)](https://github.com/nicocoul/ya-rfc/actions/workflows/test.yml) [![Coverage](https://coveralls.io/repos/github/nicocoul/ya-rfc/badge.svg?branch=main)](https://coveralls.io/github/nicocoul/ya-rfc?branch=main) [![Activity](https://img.shields.io/github/commit-activity/m/nicocoul/ya-rfc)](https://github.com/badges/shields/pulse)
Ya Rfc (Remote Function Call) is a [rpc](https://en.wikipedia.org/wiki/Remote_procedure_call) library for Node js.

Integrates well with [ya-pubsub](https://www.npmjs.com/package/ya-pubsub).

### Key Features
* asynchronous
* embeddable
* designed for micro-services

### Execution Flow
![basic execution flow](https://github.com/nicocoul/ya-rfc/blob/dev/img/basicExecFlow.png)

### Basic Example
Given a module accessible by the RFC server
```javascript
{{{examples.procedures}}}
```
function 'count' can be executed remotely over tcp
```javascript
{{{examples.tcp}}}
```
or over websockets
```javascript
{{{examples.ws}}}
```

## Versioning

Yaps-node uses [Semantic Versioning](http://semver.org/) for predictable versioning.
2 changes: 1 addition & 1 deletion cli/render-readme.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ fs.readdirSync(mrdPath).forEach(entry => {
convert(path.join(mrdPath, entry), path.join(imgPath, `${path.parse(entry).name}.png`))
})

const template = fs.readFileSync(path.join(__dirname, '..', 'README.md.tpl'), { encoding: 'utf8' })
const template = fs.readFileSync(path.join(__dirname, 'README.md.tpl'), { encoding: 'utf8' })
const result = mustache.render(template, { examples })
fs.writeFileSync(path.join(__dirname, '..', 'README.md'), result, { encoding: 'utf8' })
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ya-rfc",
"version": "0.1.8",
"version": "0.1.9",
"description": "",
"main": "index.js",
"author": "Nicolas Coulon <coulon_nicolas@hotmail.com> (https://github.com/nicocoul)",
Expand Down
2 changes: 1 addition & 1 deletion tests/brokers/rpc.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const rpcBroker = require('../../lib/brokers/rpc')
const rpcServer = require('../../lib/clients/rpc-server')

function newRpcServer (channel) {
return rpcServer.create(channel, path.join(__dirname, 'fixtures', 'rpc-module'))
return rpcServer.create(channel, path.join(__dirname, '..', 'fixtures', 'rpc-module'))
}

describe('Rpc broker', () => {
Expand Down
11 changes: 0 additions & 11 deletions tests/clients/fixtures/rpc-module.js

This file was deleted.

2 changes: 1 addition & 1 deletion tests/clients/rpc-server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { COMMANDS } = yac.constants
const rpc = require('../../lib/clients/rpc-server')
const logger = yac.logger(__filename)

const modulePath = path.join(__dirname, 'fixtures', 'rpc-module')
const modulePath = path.join(__dirname, '..', 'fixtures', 'rpc-module')

describe('Rcp server', () => {
test('executes a function that returns a value', async () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/clients/rpc-worker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const path = require('path')

function createWorker () {
const result = fork(path.join(__dirname, '..', '..', 'lib', 'clients', 'rpc-worker.js'))
result.send({ modulePath: path.join(__dirname, 'fixtures', 'rpc-module') })
result.send({ modulePath: path.join(__dirname, '..', 'fixtures', 'rpc-module') })
return result
}

Expand Down
11 changes: 0 additions & 11 deletions tests/e2e/fixtures/rpc-module.js

This file was deleted.

2 changes: 1 addition & 1 deletion tests/e2e/rpc-tcp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const netChannel = yac.channels.net

function newServer (port) {
const channel = netChannel('localhost', port)
return rpcServer.create(channel, path.join(__dirname, 'fixtures', 'rpc-module'))
return rpcServer.create(channel, path.join(__dirname, '..', 'fixtures', 'rpc-module'))
}

function newClient (port) {
Expand Down
File renamed without changes.

0 comments on commit c370742

Please sign in to comment.