Skip to content

Commit 41d8620

Browse files
committed
Setting up test scripts in CI/CD
1 parent 669295b commit 41d8620

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,45 @@ on:
55
branches: [main]
66
pull_request:
77
branches: [main]
8-
98
jobs:
109
lint-secrets-tests:
1110
runs-on: ubuntu-latest
11+
services:
12+
mongo:
13+
image: mongo:6
14+
ports:
15+
- 27017:27017
16+
options: >-
17+
--health-cmd "mongosh --eval 'db.adminCommand(\"ping\")'"
18+
--health-interval 10s
19+
--health-timeout 5s
20+
--health-retries 5
1221
1322
steps:
14-
# 1. Checkout the repository
1523
- name: Checkout Code
1624
uses: actions/checkout@v3
1725

18-
# 2. Setup Node.js
1926
- name: Setup Node.js
2027
uses: actions/setup-node@v3
2128
with:
2229
node-version: 18
2330

24-
# 3. Install dependencies
2531
- name: Install Dependencies
2632
run: npm install
2733
working-directory: ./app
2834

29-
# 4. Run ESLint
3035
- name: Run Linter
3136
run: npm run lint
3237
working-directory: ./app
3338

34-
# 5. Secret scan (Gitleaks)
3539
- name: Run Secret Scan (Gitleaks)
3640
run: |
3741
curl -sL https://github.com/zricethezav/gitleaks/releases/download/v8.16.1/gitleaks_8.16.1_linux_x64.tar.gz | tar xz
3842
./gitleaks detect --redact --exit-code=1
3943
40-
# 6. Run tests (with env vars from GitHub secrets)
41-
- name: Run Tests
44+
- name: Run Tests (Local Mongo)
4245
env:
43-
MONGO_URI: ${{ secrets.MONGO_URI }}
46+
MONGO_URI: mongodb://localhost:27017/ci_testdb
4447
JWT_SECRET: ${{ secrets.JWT_SECRET }}
4548
JWT_REFRESH_SECRET: ${{ secrets.JWT_REFRESH_SECRET }}
4649
NODE_ENV: test

0 commit comments

Comments
 (0)