Skip to content

Commit 6feef45

Browse files
authored
Merge pull request #39 from mongodb/development
Workflow updates
2 parents d14404f + 71cef38 commit 6feef45

4 files changed

Lines changed: 103 additions & 42 deletions

File tree

.github/workflows/new-issue-notify.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,33 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Send Slack Notification for New Issue
14+
env:
15+
ISSUE_TITLE: ${{ github.event.issue.title }}
16+
ISSUE_USER: ${{ github.event.issue.user.login }}
17+
ISSUE_URL: ${{ github.event.issue.html_url }}
18+
REPO_NAME: ${{ github.repository }}
19+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
1420
run: |
15-
MESSAGE_TEXT="*📢 New Issue Opened in ${{ github.repository }} 📢*\n\n*Issue Title:* ${{ github.event.issue.title }}\n*Opened By:* ${{ github.event.issue.user.login }}\n\n*View Issue:* ${{ github.event.issue.html_url }}"
21+
# Build message text using jq to safely handle user input
22+
MESSAGE_TEXT=$(jq -n \
23+
--arg repo "$REPO_NAME" \
24+
--arg title "$ISSUE_TITLE" \
25+
--arg user "$ISSUE_USER" \
26+
--arg url "$ISSUE_URL" \
27+
'*📢 New Issue Opened in \($repo) 📢*\n\n*Issue Title:* \($title)\n*Opened By:* \($user)\n\n*View Issue:* \($url)')
1628
29+
# Build Slack payload
1730
SLACK_PAYLOAD=$(jq -n \
18-
--arg text "${MESSAGE_TEXT}" \
31+
--arg text "$MESSAGE_TEXT" \
1932
'{
2033
"channel": "#docs-devdocs-notifications",
2134
"username": "Issue Notifier",
2235
"icon_emoji": ":mega:",
2336
"text": $text
2437
}')
2538
39+
# Send to Slack
2640
curl -X POST \
2741
-H 'Content-type: application/json' \
2842
--data "$SLACK_PAYLOAD" \
29-
${{ secrets.SLACK_WEBHOOK }}
43+
"$SLACK_WEBHOOK"

.github/workflows/run-express-tests.yml

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Run Express Tests
22

33
on:
4-
pull_request_target:
4+
pull_request:
55
branches:
66
- development
77
paths:
@@ -16,38 +16,54 @@ jobs:
1616
test:
1717
name: Run Express Tests
1818
runs-on: ubuntu-latest
19-
# Require manual approval for fork PRs
20-
environment: testing
21-
22-
defaults:
23-
run:
24-
working-directory: server/js-express
2519

2620
steps:
2721
- name: Checkout code
2822
uses: actions/checkout@v5
29-
with:
30-
ref: ${{ github.event.pull_request.head.sha }}
23+
24+
- name: Install Atlas CLI
25+
run: |
26+
curl https://fastdl.mongodb.org/mongocli/mongodb-atlas-cli_1.47.0_linux_x86_64.deb --output atlas-cli.deb
27+
sudo apt install ./atlas-cli.deb
28+
29+
- name: Set up a local deployment using Atlas CLI
30+
run: |
31+
atlas deployments setup myLocalRs1 --type local --port 27017 --force
32+
33+
- name: Install MongoDB Database Tools to load sample data
34+
run: |
35+
curl https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.13.0.deb --output mdb-db-tools.deb
36+
sudo apt install ./mdb-db-tools.deb
37+
38+
- name: Download sample data
39+
run: curl https://atlas-education.s3.amazonaws.com/sampledata.archive -o sampledata.archive
40+
41+
- name: Add sample data to database
42+
run: mongorestore --archive=sampledata.archive --port=27017
3143

3244
- name: Set up Node.js
3345
uses: actions/setup-node@v4
3446
with:
3547
node-version: '20'
3648

3749
- name: Install dependencies
50+
working-directory: server/js-express
3851
run: npm install
3952

4053
- name: Run unit tests
54+
working-directory: server/js-express
4155
run: npm run test:unit -- --json --outputFile=test-results-unit.json || true
4256
env:
43-
MONGODB_URI: ${{ secrets.MFLIX_URI }}
57+
MONGODB_URI: mongodb://localhost:27017/sample_mflix
4458

4559
- name: Run integration tests
60+
working-directory: server/js-express
4661
run: npm run test:integration -- --json --outputFile=test-results-integration.json || true
4762
env:
48-
MONGODB_URI: ${{ secrets.MFLIX_URI }}
63+
MONGODB_URI: mongodb://localhost:27017/sample_mflix
4964
ENABLE_SEARCH_TESTS: true
50-
VOYAGE_API_KEY: ${{ secrets.VOYAGE_AI }}
65+
# Note: Vector search tests will be skipped without VOYAGE_API_KEY
66+
# Run these tests locally with a valid API key
5167

5268
- name: Upload test results
5369
uses: actions/upload-artifact@v4
@@ -62,7 +78,6 @@ jobs:
6278

6379
- name: Generate Test Summary
6480
if: always()
65-
working-directory: .
6681
run: |
6782
chmod +x .github/scripts/generate-test-summary-jest.sh
6883
.github/scripts/generate-test-summary-jest.sh \
Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Run Java Spring Boot Tests
22

33
on:
4-
pull_request_target:
4+
pull_request:
55
branches:
66
- development
77
paths:
@@ -16,22 +16,30 @@ jobs:
1616
test:
1717
name: Run Java Spring Boot Tests
1818
runs-on: ubuntu-latest
19-
# Require manual approval for fork PRs
20-
environment: testing
21-
22-
defaults:
23-
run:
24-
working-directory: mflix/server/java-spring
25-
26-
env:
27-
MONGODB_URI: ${{ secrets.MFLIX_URI }}
28-
ENABLE_SEARCH_TESTS: true
2919

3020
steps:
3121
- name: Checkout code
3222
uses: actions/checkout@v5
33-
with:
34-
ref: ${{ github.event.pull_request.head.sha }}
23+
24+
- name: Install Atlas CLI
25+
run: |
26+
curl https://fastdl.mongodb.org/mongocli/mongodb-atlas-cli_1.47.0_linux_x86_64.deb --output atlas-cli.deb
27+
sudo apt install ./atlas-cli.deb
28+
29+
- name: Set up a local deployment using Atlas CLI
30+
run: |
31+
atlas deployments setup myLocalRs1 --type local --port 27017 --force
32+
33+
- name: Install MongoDB Database Tools to load sample data
34+
run: |
35+
curl https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.13.0.deb --output mdb-db-tools.deb
36+
sudo apt install ./mdb-db-tools.deb
37+
38+
- name: Download sample data
39+
run: curl https://atlas-education.s3.amazonaws.com/sampledata.archive -o sampledata.archive
40+
41+
- name: Add sample data to database
42+
run: mongorestore --archive=sampledata.archive --port=27017
3543

3644
- name: Set up JDK 21
3745
uses: actions/setup-java@v5
@@ -41,14 +49,24 @@ jobs:
4149
cache: 'maven'
4250

4351
- name: Make mvnw executable
52+
working-directory: mflix/server/java-spring
4453
run: chmod +x mvnw
4554

4655
- name: Run unit tests
56+
working-directory: mflix/server/java-spring
4757
run: ./mvnw test
58+
env:
59+
MONGODB_URI: mongodb://localhost:27017/sample_mflix
4860

4961
- name: Run integration tests
62+
working-directory: mflix/server/java-spring
5063
run: ./mvnw test -Dtest=MongoDBSearchIntegrationTest
5164
continue-on-error: true
65+
env:
66+
MONGODB_URI: mongodb://localhost:27017/sample_mflix
67+
ENABLE_SEARCH_TESTS: true
68+
# Note: Vector search tests will be skipped without VOYAGE_API_KEY
69+
# Run these tests locally with a valid API key
5270

5371
- name: Upload test results
5472
uses: actions/upload-artifact@v4
@@ -60,7 +78,6 @@ jobs:
6078

6179
- name: Generate Test Summary
6280
if: always()
63-
working-directory: .
6481
run: |
6582
chmod +x .github/scripts/generate-test-summary-surefire.sh
6683
.github/scripts/generate-test-summary-surefire.sh mflix/server/java-spring/target/surefire-reports

.github/workflows/run-python-tests.yml

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Run Python Tests
22

33
on:
4-
pull_request_target:
4+
pull_request:
55
branches:
66
- development
77
paths:
@@ -16,40 +16,56 @@ jobs:
1616
test:
1717
name: Run Python Tests
1818
runs-on: ubuntu-latest
19-
# Require manual approval for fork PRs
20-
environment: testing
21-
22-
defaults:
23-
run:
24-
working-directory: mflix/server/python-fastapi
2519

2620
steps:
2721
- name: Checkout code
2822
uses: actions/checkout@v5
29-
with:
30-
ref: ${{ github.event.pull_request.head.sha }}
23+
24+
- name: Install Atlas CLI
25+
run: |
26+
curl https://fastdl.mongodb.org/mongocli/mongodb-atlas-cli_1.47.0_linux_x86_64.deb --output atlas-cli.deb
27+
sudo apt install ./atlas-cli.deb
28+
29+
- name: Set up a local deployment using Atlas CLI
30+
run: |
31+
atlas deployments setup myLocalRs1 --type local --port 27017 --force
32+
33+
- name: Install MongoDB Database Tools to load sample data
34+
run: |
35+
curl https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.13.0.deb --output mdb-db-tools.deb
36+
sudo apt install ./mdb-db-tools.deb
37+
38+
- name: Download sample data
39+
run: curl https://atlas-education.s3.amazonaws.com/sampledata.archive -o sampledata.archive
40+
41+
- name: Add sample data to database
42+
run: mongorestore --archive=sampledata.archive --port=27017
3143

3244
- name: Set up Python
3345
uses: actions/setup-python@v5
3446
with:
3547
python-version: '3.13'
3648
cache: 'pip'
49+
cache-dependency-path: mflix/server/python-fastapi/requirements.txt
3750

3851
- name: Install dependencies
52+
working-directory: mflix/server/python-fastapi
3953
run: |
4054
python -m pip install --upgrade pip
4155
pip install -r requirements.txt
4256
4357
- name: Run unit tests
58+
working-directory: mflix/server/python-fastapi
4459
run: pytest -m unit --verbose --tb=short --junit-xml=test-results-unit.xml
4560
env:
46-
MONGO_URI: ${{ secrets.MFLIX_URI }}
61+
MONGO_URI: mongodb://localhost:27017
4762
MONGO_DB: sample_mflix
4863

4964
- name: Run integration tests
65+
working-directory: mflix/server/python-fastapi
5066
run: pytest -m integration --verbose --tb=short --junit-xml=test-results-integration.xml || true
5167
env:
52-
MONGO_URI: ${{ secrets.MFLIX_URI }}
68+
MONGO_URI: mongodb://localhost:27017
5369
MONGO_DB: sample_mflix
5470

5571
- name: Upload test results
@@ -65,7 +81,6 @@ jobs:
6581

6682
- name: Generate Test Summary
6783
if: always()
68-
working-directory: .
6984
run: |
7085
chmod +x .github/scripts/generate-test-summary-pytest.sh
7186
.github/scripts/generate-test-summary-pytest.sh \

0 commit comments

Comments
 (0)