Skip to content

DigiPie/mongo-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mongo-action

GitHub Actions status GitHub Releases

mongo-action is a Github Action that creates a Docker container using the official mongo image from Dockerhub. 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.

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.

Example usage with mongosh

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 for how you could use mongo-action with Mocha and Chai to perform automated API testing for a NodeJS-ExpressJS-Mongoose app.