Skip to content

Commit f790074

Browse files
committed
Add Github CI and switch to Bitnami RabbitMQ container
Signed-off-by: Lance Drane <dranelt@ornl.gov>
1 parent e0b33c8 commit f790074

File tree

3 files changed

+87
-19
lines changed

3 files changed

+87
-19
lines changed

.github/workflows/ci.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
branches:
10+
- main
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
lint:
18+
name: Ruff linting, formating, MyPy
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Setup PDM
23+
uses: pdm-project/setup-pdm@v4
24+
with:
25+
python-version: "3.8"
26+
cache: true
27+
- name: Install dependencies
28+
run: pdm sync --dev -G:all
29+
- name: Lint
30+
run: |
31+
pdm run ruff format --check
32+
pdm ruff check
33+
pdm run lint-mypy
34+
35+
test:
36+
name: Test with coverage
37+
strategy:
38+
matrix:
39+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
40+
os:
41+
- ubuntu-latest
42+
# TODO - can't use service containers outside of Ubuntu
43+
#- macos-latest
44+
#- windows-latest
45+
runs-on: ${{ matrix.os }}
46+
services:
47+
rabbitmq:
48+
image: "bitnami/rabbitmq:3.13.3"
49+
env:
50+
# space-delimited list of plugins
51+
RABBITMQ_PLUGINS: "rabbitmq_mqtt"
52+
RABBITMQ_USERNAME: "intersect_username"
53+
RABBITMQ_PASSWORD: "intersect_password"
54+
ports:
55+
- "1883:1883" # MQTT port
56+
- "5672:5672" # AMQP port
57+
minio:
58+
image: "quay.io/minio/minio:latest"
59+
env:
60+
MINIO_ROOT_USER: AKIAIOSFODNN7EXAMPLE
61+
MINIO_ROOT_PASSWORD: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
62+
ports:
63+
- "9000:9000" # main MINIO API port
64+
- "9001:9001" # web UI
65+
options: 'server /mydata --console-address ":9001"'
66+
steps:
67+
- uses: actions/checkout@v4
68+
- name: Setup PDM
69+
uses: pdm-project/setup-pdm@v4
70+
with:
71+
python-version: ${{ matrix.python-version }}
72+
cache: true
73+
- name: Install dependencies
74+
run: pdm sync --dev -G:all
75+
- name: Test
76+
run: pdm run test-all

docker-compose.yml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
11
# Simple docker-compose file which sets up all needed backing services
22
# Note that for the broker, the default credentials are ` intersect_username / intersect_password `
33

4-
version: "3"
5-
6-
x-broker-variables: &broker-variables
7-
BROKER_HOST: broker
8-
BROKER_PORT: 1883
9-
BROKER_USERNAME: intersect_username
10-
BROKER_PASSWORD: intersect_password
11-
12-
x-minio-variables: &minio-variables
13-
MINIO_HOST: minio
14-
MINIO_PORT: 9000
15-
MINIO_ACCESS_KEY: AKIAIOSFODNN7EXAMPLE
16-
MINIO_SECRET_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
17-
184
services:
195
broker:
20-
image: code.ornl.gov:4567/intersect/sdk/broker/main:latest
6+
image: "bitnami/rabbitmq:3.13.3"
217
ports:
228
- "1883:1883" # MQTT port
239
- "5672:5672" # AMQP port
2410
- "15672:15672" # Web UI
11+
environment:
12+
# full list of env variables available at https://github.com/bitnami/containers/blob/main/bitnami/rabbitmq/README.md
13+
RABBITMQ_PLUGINS: "rabbitmq_mqtt"
14+
RABBITMQ_USERNAME: "intersect_username"
15+
RABBITMQ_PASSWORD: "intersect_password"
16+
RABBITMQ_MANAGEMENT_ALLOW_WEB_ACCESS: "yes"
2517
healthcheck:
26-
test: rabbitmq-diagnostics -q ping
18+
test: rabbitmq-diagnostics -q ping && rabbitmq-diagnostics -q check_running && rabbitmq-diagnostics -q check_local_alarms
2719
interval: 10s
2820
retries: 5
2921
start_period: 10s

docs/installation.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ Docker
5656
Backing Services (Brokers, Data planes)
5757
---------------------------------------
5858

59-
A Docker Compose configuration for SDK development is included below. Note that the broker configuration requires access to the INTERSECT Gitlab, and is available at https://code.ornl.gov/intersect/sdk/broker.
59+
A Docker Compose configuration for SDK development is included below.
6060

61-
Note that this broker image, and any data plane images, are meant for testing and should not be included in production.
61+
Note that this configuration is meant for testing, and should not be included in production.
6262

6363
.. literalinclude:: ../docker-compose.yml
6464

@@ -70,7 +70,7 @@ From the repository root, run the backing services using the Docker commands sho
7070
# if you are copypasting from this website instead of running from the repository root, you should make sure you copy the contents into docker-compose.yml.
7171
docker compose up -d
7272
73-
To see the broker's management UI, you can navigate to ``localhost:15672`` in your browser. The login credentials will be those found in the broker's `definitions file <https://code.ornl.gov/intersect/sdk/broker/-/blob/0.2.0/definitions.json>`_.
73+
To see the broker's management UI, you can navigate to ``localhost:15672`` in your browser. The login credentials mirror `RABBITMQ_USERNAME` and `RABBITMQ_PASSWORD` from the docker-compose file.
7474

7575
To cleanup:
7676

0 commit comments

Comments
 (0)