https://github.com/digipie/mongo-action
Github action to create a Docker container from the official mongo image.
https://github.com/digipie/mongo-action
chai expressjs github-actions mocha mongo mongo-action mongodb mongoose nodejs test-automation
Last synced: 7 months ago
JSON representation
Github action to create a Docker container from the official mongo image.
- Host: GitHub
- URL: https://github.com/digipie/mongo-action
- Owner: DigiPie
- License: mit
- Created: 2020-03-05T13:05:12.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-13T16:17:55.000Z (almost 3 years ago)
- Last Synced: 2025-05-08T22:14:31.089Z (7 months ago)
- Topics: chai, expressjs, github-actions, mocha, mongo, mongo-action, mongodb, mongoose, nodejs, test-automation
- Language: JavaScript
- Homepage:
- Size: 42 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mongo-action
[](https://github.com/DigiPie/mongo-action/actions) [](https://github.com/DigiPie/mongo-action/releases)
**mongo-action** is a Github Action that creates a Docker container using the official mongo image from [Dockerhub](https://hub.docker.com/_/mongo).
The MongoDB server port will be published/exposed to the host running the Github Workflow.
## Inputs
### `image_version`
**Optional.** The mongo Docker image version to use. Defaults to `latest`. Refer to the official [Dockerhub image page](https://hub.docker.com/_/mongo).
### `port`
**Optional.** The port where the mongo service will be published at (i.e. `docker run -p ${port}:27017`). Defaults to `27017`. Refer to the official [docker run page](https://docs.docker.com/engine/reference/commandline/run/#publish).
## Example usage with mongosh
```yaml
name: mongo-action CI
on: [push]
jobs:
test_mongo_action:
runs-on: ubuntu-latest
name: Test mongo-action
steps:
- name: Create mongo Docker container
uses: DigiPie/mongo-action@v2.0.1
with:
image_version: latest
port: 27017
- name: Install mongosh command
run: |
sudo apt-get update
sudo apt-get install -y wget gnupg
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
sudo apt-get update
sudo apt-get install -y mongodb-mongosh
- name: Test mongo connection
run: "sudo mongosh localhost:27017"
```
## Example usage with NodeJS-ExpressJS
Refer to [DigiPie/mocha-chai-mongoose](https://github.com/DigiPie/mocha-chai-mongoose) for how you could use **mongo-action** with **Mocha** and **Chai** to perform automated API testing for a **NodeJS-ExpressJS-Mongoose** app.