Skip to content

Commit

Permalink
Update zeromq and fix workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
iaj2 committed Dec 5, 2023
1 parent 0308665 commit 6816a65
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 72 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/js-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,14 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "16.20.0"
node-version: "20.10.0"
cache: "npm"

- name: Install npm@9.8.0
run: npm i -g npm@9.8.0
- name: Install npm@10.2.3
run: npm i -g npm@10.2.3

- name: Install dependencies
run: npm ci --prefer-offline

- name: Reinstall zeromq because of Debian bug
run: |
npm uninstall zeromq
npm install zeromq@6.0.0-beta.17 --zmq-shared

- name: Test with jest
run: |
Expand Down
29 changes: 4 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,12 @@
JavaScript RPC Client for EdgePi RPC Server

## Installing as an NPM module
If you are not on a debian system, you can simply run the following npm command on any machine:
```
npm install @edgepi-cloud/edgepi-rpc
```
## Installing as an NPM module on Debian systems

There is currently an issue regularly installing zeromq as a dependency on debian systems. The culprit is the following error:
```
symbol lookup error: /**/node_modules/zeromq/build/Release/zeromq.node: undefined symbol: sodium_init
```
To get around this issue, you must first install the zeromq library (libzmq)
```
sudo apt update
sudo apt install libzmq3-dev
```
You will then need to npm install the zeromq dependency specifying that you want to build with with installed
library from the previous step. First ensure you have necessary build dependancies
```
sudo apt-get update && sudo apt-get install -y build-essential cmake
```
Then npm install zeromq with the shared library.
```
npm install zeromq@6.0.0-beta.17 --zmq-shared
```
Now you can simply install edgepi-rpc with the organization's scope from npm
```
npm install @edgepi-cloud/edgepi-rpc
## Install build dependencies

```
If you run into any issues with zeromq after installing the edgepi-rpc package, try reinstalling zeromq
ensuring that it was built against the shared library. For further help installing zeromq, checkout their [github](https://github.com/zeromq/zeromq.js/).
sudo apt update && sudo apt install cmake
```
19 changes: 0 additions & 19 deletions __mocks__/zeromq.js

This file was deleted.

3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node'
testEnvironment: 'node',
maxWorkers: 1 // Forces tests to run sequentially instead of in parallel. Issue: https://github.com/EdgePi-Cloud/edgepi-rpc-client-js/issues/46
}
30 changes: 15 additions & 15 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@edgepi-cloud/edgepi-rpc",
"version": "1.0.10",
"version": "1.0.11",
"author": "Isaac James",
"main": "./lib/index.js",
"license": "MIT",
Expand All @@ -17,7 +17,7 @@
"@types/node": "^20.4.2",
"protobufjs": "^7.2.4",
"protobufjs-cli": "^1.1.1",
"zeromq": "^6.0.0-beta.17"
"zeromq": "^6.0.0-beta.19"
},
"devDependencies": {
"@types/jest": "^29.5.3",
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/AdcService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('AdcService', ()=> {
let adc: AdcService

beforeAll(async() =>{
adc = new AdcService('tcp://192.168.1.216:5555');
adc = new AdcService('tcp://localhost:5555');
// set rtds off
await adc.setRtd(false, ADCNum.ADC_1)
await adc.setRtd(false, ADCNum.ADC_2)
Expand Down
11 changes: 11 additions & 0 deletions tests/integration/bug-fixes.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const zmq = require('zeromq');

jest.unmock('zeromq')

describe('zeromq bug fix', () => {
test('should create zmq.Context without libsodium error', () => {
expect(() => {
let a = new zmq.Context();
}).not.toThrow();
});
});
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@
"outDir": "./lib"
},
"include": [
"./src"]
"./src",
"./jest.config.js"
]
}

0 comments on commit 6816a65

Please sign in to comment.