This GitHub Action starts a MongoDB server with the default port 27017. You can customize the port using the mongodb-port input.
The version of the MongoDb server must be specified using the mongodb-version input. The used version must exist in the published mongocamp/mongodb Docker hub tags. Default value is latest, other possible choices are 4.4.14, or 5.0.9.
name: Run tests
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
mongodb-version: ['4.4.14', '5.0.9']
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Start MongoDB
uses: MongoCamp/[email protected]
with:
mongodb-version: ${{ matrix.mongodb-version }}
- run: curl http://localhost:27017The following sample starts a MongoDB server on port 4711:
name: Run tests
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
mongodb-version: ['4.4.14', '5.0.9']
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Start MongoDB
uses: MongoCamp/[email protected]
with:
mongodb-version: ${{ matrix.mongodb-version }}
mongodb-port: 4711
- run: curl http://localhost:4711The following sample uses the replica set name your-replica-set:
name: Run tests
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
mongodb-version: ['4.4.14', '5.0.9']
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Start MongoDB
uses: MongoCamp/[email protected]
with:
mongodb-version: ${{ matrix.mongodb-version }}
mongodb-replica-set: your-replica-set
- run: curl http://localhost:27017The following sample uses the username user and the password your-pwd:
name: Run tests
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
mongodb-version: ['4.4.14', '5.0.9']
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Start MongoDB
uses: MongoCamp/[email protected]
with:
mongodb-version: ${{ matrix.mongodb-version }}
mongodb-username: user
mongodb-pwd: your-pwd
- run: curl http://localhost:27017