Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [22.x]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to be more permissive with version, following what rhea supports

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright, i will put the same versions as in rhea workflow https://github.com/amqp/rhea/blob/main/.github/workflows/node.js.yml#L18

# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

services:
rabbitmq:
image: rabbitmq:4.1.0-management
options: --hostname test-node --name test-node
env:
RABBITMQ_HOSTNAME: "test-node"
RABBITMQ_DEFAULT_USER: "test-user"
RABBITMQ_DEFAULT_PASS: "test-password"
volumes:
# these directories will be empty until checkout, but they will be
# populated by the time we restart the service
- ${{ github.workspace }}/conf:/etc/rabbitmq
ports:
- 5672:5672
- 15672:15672

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
# - name: Generate certificates
# env:
# CN: test-node
# run: |
# git clone https://github.com/rabbitmq/tls-gen tls-gen
# cd tls-gen/basic
# make
# cd ../..
# cp -a tls-gen/basic/result certs/
# sudo chown -R 999:999 certs
# sudo mv certs/server_test-node_certificate.pem certs/server_rabbitmq_certificate.pem
# sudo mv certs/server_test-node_key.pem certs/server_rabbitmq_key.pem
- name: Restart RabbitMQ
run: |
docker restart test-node
sleep 2
docker exec test-node rabbitmqctl await_startup
- run: npm ci
- run: npm run check
- run: npm run build --if-present
- run: |
docker exec test-node rabbitmqctl add_user 'O=client,CN=test-node' ''
docker exec test-node rabbitmqctl clear_password 'O=client,CN=test-node'
docker exec test-node rabbitmqctl set_permissions 'O=client,CN=test-node' '.*' '.*' '.*'
- run: npm test
env:
RABBITMQ_USER: "test-user"
RABBITMQ_PASSWORD: "test-password"
# - run: cd example && npm install && npm start
# env:
# RABBITMQ_USER: "test-user"
# RABBITMQ_PASSWORD: "test-password"
# - run: cd performance_test && npm install && npm run perftest 100000
# env:
# RABBITMQ_USER: "test-user"
# RABBITMQ_PASSWORD: "test-password"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/
node_modules/
.envrc
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": false,
"arrowParens": "always",
"singleQuote": false,
"printWidth": 120,
"trailingComma": "es5"
}
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 22.15.0
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": ["<node_internals>/**"],
"program": "${file}",
"preLaunchTask": "tsc: build - tsconfig.json",
"outFiles": ["${workspaceFolder}/dist/**/*.js"]
}
]
}
1 change: 1 addition & 0 deletions conf/enabled_plugins
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[rabbitmq_management].
5 changes: 5 additions & 0 deletions conf/rabbitmq.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
loopback_users = none
loopback_users.guest = false
listeners.tcp.default = 5672
log.file.level = debug
log.console = true
13 changes: 13 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"language": "en",
"words": [
"ackmode",
"ampq",
"amqpvalue",
"perftest",
"prefetch",
"RABBITMQ",
"rabbitmqctl",
"Sasl"
]
}
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
services:
rabbitmq-rhea:
image: rabbitmq:4.1.0-management
container_name: rabbitmq-rhea
restart: unless-stopped
hostname: "rabbitmq"
ports:
- "15672:15672"
- "5672:5672"
environment:
RABBITMQ_DEFAULT_USER: "rabbit"
RABBITMQ_DEFAULT_PASS: "rabbit"
volumes:
- ./conf/:/etc/rabbitmq/
10 changes: 10 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import js from "@eslint/js"
import globals from "globals"
import tseslint from "typescript-eslint"
import { defineConfig } from "eslint/config"

export default defineConfig([
{ files: ["**/*.{js,mjs,cjs,ts}"], plugins: { js }, extends: ["js/recommended"] },
{ files: ["**/*.{js,mjs,cjs,ts}"], languageOptions: { globals: globals.browser } },
tseslint.configs.recommended,
])
Loading
Loading