Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mongoimport command not found #41

Closed
wifidabba opened this issue Dec 17, 2022 · 2 comments
Closed

mongoimport command not found #41

wifidabba opened this issue Dec 17, 2022 · 2 comments
Assignees

Comments

@wifidabba
Copy link

Hi pals, the following is my GitHub action, the problem is MongoDB is not getting recognised or having some issue wile running the jobs.

Even mongoimport is not recognised because mongo is not getting detected. Give me the following error

mongoimport: command not found

name: API Continous Integration

# Controls when the action will run. Triggers the workflow on push or pull request
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  continous_integration:
    runs-on: ubuntu-latest
    strategy:
      #We can run on multiple versions of dependencies with the help of 'matrix'
      matrix:
        node-version: [18.x]
        mongodb-version: ["6.0"]

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      #Checkout project code
      - name: Git Checkout
        uses: actions/checkout@v3

      #Install Node.js
      - name: Install NodeJs ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}

      #MongoDB server
      - name: Start MongoDB ${{ matrix.mongodb-version }}
        uses: supercharge/[email protected]
        with:
          mongodb-version: ${{ matrix.mongodb-version }}
          mongodb-username: ${{ secrets.DB_MONGODB_USERNAME }}
          mongodb-password: ${{ secrets.DB_MONGODB_PASSWORD }}
          mongodb-db: ${{ secrets.DB_MONGODB_DATABASE }}
          mongodb-port: ${{ secrets.DB_MONGODB_PORT }}

      #Load mongodb collections
      - name: Add data to countries Collection
        run: mongoimport --host=127.0.0.1 --db=${{ secrets.DB_MONGODB_DATABASE }} --port=${{ secrets.DB_MONGODB_PORT }} --username=${{ secrets.DB_MONGODB_USERNAME }} --password=${{ secrets.DB_MONGODB_PASSWORD }} --collection=countries --file=src/database/raw/countries.json

      #Clean install package and any packages that it depends on
      - name: Install dependencies
        run: npm ci

      #Run the integration tests
      - name: Run tests
        run: npm test
@wifidabba
Copy link
Author

If I use ubuntu-20.04 I am able to make it work. Also I know that mongoimport is removed in Ubuntu 22.x, but tried multiple other options but not working with ubuntu-latest

@marcuspoehls
Copy link
Member

@wifidabba Hey Karam, the Ubuntu 22.04 runners for GitHub Actions don’t have MongoDB installed by default. The 20.04 runners have MongoDB installed.

Please have a look at this related issue: #39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants