-
Notifications
You must be signed in to change notification settings - Fork 6
96 lines (80 loc) · 3.24 KB
/
run-express-tests.yml
File metadata and controls
96 lines (80 loc) · 3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Run Express Tests
on:
pull_request:
branches:
- development
paths:
- 'mflix/server/js-express/**'
push:
branches:
- development
paths:
- 'mflix/server/js-express/**'
jobs:
test:
name: Run Express Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Install Atlas CLI
run: |
curl https://fastdl.mongodb.org/mongocli/mongodb-atlas-cli_1.47.0_linux_x86_64.deb --output atlas-cli.deb
sudo apt install ./atlas-cli.deb
- name: Set up a local deployment using Atlas CLI
run: |
atlas deployments setup myLocalRs1 --type local --port 27017 --force
- name: Install MongoDB Database Tools to load sample data
run: |
curl https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.13.0.deb --output mdb-db-tools.deb
sudo apt install ./mdb-db-tools.deb
- name: Download sample data
run: curl https://atlas-education.s3.amazonaws.com/sampledata.archive -o sampledata.archive
- name: Add sample data to database
run: mongorestore --archive=sampledata.archive --port=27017
- name: Install MongoDB Shell (mongosh)
run: |
curl https://downloads.mongodb.com/compass/mongosh-2.3.8-linux-x64.tgz -o mongosh.tgz
tar -xzf mongosh.tgz
sudo cp mongosh-2.3.8-linux-x64/bin/* /usr/local/bin/
- name: Create indexes for aggregation performance
run: |
mongosh "mongodb://localhost:27017/sample_mflix?directConnection=true" --eval "db.comments.createIndex({ movie_id: 1 })"
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
working-directory: mflix/server/js-express
run: npm install
- name: Run unit tests
working-directory: mflix/server/js-express
run: npm run test:unit -- --json --outputFile=test-results-unit.json
env:
MONGODB_URI: mongodb://localhost:27017/sample_mflix?directConnection=true
- name: Run integration tests
working-directory: mflix/server/js-express
continue-on-error: true
run: npm run test:integration -- --json --outputFile=test-results-integration.json
env:
MONGODB_URI: mongodb://localhost:27017/sample_mflix?directConnection=true
ENABLE_SEARCH_TESTS: true
# Note: Vector search tests will be skipped without VOYAGE_API_KEY
# Run these tests locally with a valid API key
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: |
mflix/server/js-express/coverage/
mflix/server/js-express/test-results-unit.json
mflix/server/js-express/test-results-integration.json
retention-days: 30
- name: Generate Test Summary
if: always()
run: |
chmod +x .github/scripts/generate-test-summary-jest.sh
.github/scripts/generate-test-summary-jest.sh \
mflix/server/js-express/test-results-unit.json \
mflix/server/js-express/test-results-integration.json