Skip to content

Merge pull request #83 from store-craft/ci_tests_for_s3 #36

Merge pull request #83 from store-craft/ci_tests_for_s3

Merge pull request #83 from store-craft/ci_tests_for_s3 #36

name: MongoDB
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
test-mongodb:
name: Test MongoDB
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x]
# services:
# mongodb:
# image: mongo
# env:
# MONGO_INITDB_ROOT_USERNAME: root
# MONGO_INITDB_ROOT_PASSWORD: password
# MONGO_INITDB_DATABASE: test
# options: >-
# --health-cmd "echo 'db.runCommand("ping").ok' | mongosh mongodb://localhost:27017 --quiet"
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5
# ports:
# - 27017:27017
steps:
- name: Start mongo
id: start-mongo
run: >-
docker run --rm -d -p 27017:27017
-e MONGO_INITDB_DATABASE=test
--name mongo mongo:latest --replSet rs_test --bind_ip_all
- name: Initialize MongoDB Replica Set
run: |
sleep 5 # Give mongo a chance to start up
docker run --rm mongo:latest mongosh --host 172.17.0.1 --eval 'rs.initiate({_id: "rs_test", members: [{_id: 0, host: "172.17.0.1:27017"}]})'
- name: Check out repository code
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
working-directory: ./packages/databases/database-mongodb
run: npm ci
- name: Test
run: npm test
working-directory: ./packages/databases/database-mongodb
env:
# The hostname used to communicate with the mysql service container
MONGODB_NAME: test
MONGODB_URL: mongodb://localhost:27017