Skip to content

add a ci/cd pipeline to run tests #1

add a ci/cd pipeline to run tests

add a ci/cd pipeline to run tests #1

Workflow file for this run

name: CI Tests
on:
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
services:
mongodb:
image: mongo:7
env:
MONGO_INITDB_DATABASE: test
ports:
- 27017:27017
options: >-
--health-cmd "mongosh --eval 'db.runCommand({ping: 1})'"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Wait for MongoDB
run: |
until mongosh --host localhost:27017 --eval "print('MongoDB is ready')" >/dev/null 2>&1; do
echo "Waiting for MongoDB..."
sleep 2
done
- name: Run tests
run: npm run test