-
Notifications
You must be signed in to change notification settings - Fork 281
205 lines (198 loc) · 7.24 KB
/
Copy pathcode-health.yml
File metadata and controls
205 lines (198 loc) · 7.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
---
name: Code Health
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
jobs:
run-tests:
name: Run MongoDB tests
if: github.event_name == 'push' || (github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository)
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: ["22"]
include:
- os: ubuntu-latest
node-version: "24"
- os: ubuntu-latest
node-version: "26"
fail-fast: false
# Ubuntu + Node 22 is the one used for coverage; failures there must not fail the job or block merged coverage.
continue-on-error: ${{ matrix.os == 'ubuntu-latest' && (matrix.node-version == '24' || matrix.node-version == '26') }}
runs-on: ${{ matrix.os }}
steps:
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
if: matrix.os == 'ubuntu-latest'
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: docker/setup-docker-action@v5
if: matrix.os == 'ubuntu-latest'
name: Setup Docker Environment
with:
set-host: true
- uses: pnpm/action-setup@v5
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run tests
run: pnpm test
env:
SKIP_ATLAS_INTEGRATION_TESTS: "true"
SKIP_ATLAS_LOCAL_TESTS: "true"
MDB_MONGOT_PASSWORD: ${{ secrets.TEST_MDB_MONGOT_PASSWORD }}
MDB_VOYAGE_API_KEY: ${{ secrets.TEST_MDB_MCP_VOYAGE_API_KEY }}
- name: Upload test results
if: always() && matrix.os == 'ubuntu-latest' && matrix.node-version == '22'
uses: actions/upload-artifact@v7.0.1
with:
name: test-results
path: coverage/lcov.info
run-atlas-tests:
name: Run Atlas tests
if: github.event_name == 'push' || (github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository)
runs-on: ubuntu-latest
steps:
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: pnpm/action-setup@v5
- uses: actions/setup-node@v6
with:
node-version-file: package.json
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run tests
env:
MDB_MCP_API_CLIENT_ID: ${{ secrets.TEST_ATLAS_CLIENT_ID }}
MDB_MCP_API_CLIENT_SECRET: ${{ secrets.TEST_ATLAS_CLIENT_SECRET }}
MDB_MCP_API_BASE_URL: ${{ vars.TEST_ATLAS_BASE_URL }}
run: pnpm test tests/integration/tools/atlas/
- name: Upload test results
uses: actions/upload-artifact@v7.0.1
if: always()
with:
name: atlas-test-results
path: coverage/lcov.info
run-atlas-local-tests:
name: Run Atlas Local tests
if: github.event_name == 'push' || (github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository)
runs-on: ubuntu-latest
steps:
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: pnpm/action-setup@v5
- uses: actions/setup-node@v6
with:
node-version-file: package.json
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Pre-pull Atlas Local images
run: |
docker pull mongodb/mongodb-atlas-local:preview &
docker pull mongodb/mongodb-atlas-local:latest &
wait
- name: Run tests
run: pnpm test tests/integration/tools/atlas-local/
- name: Upload test results
uses: actions/upload-artifact@v7.0.1
if: always()
with:
name: atlas-local-test-results
path: coverage/lcov.info
run-browser-tests:
name: Run Browser tests
if: github.event_name == 'push' || (github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository)
runs-on: ubuntu-latest
steps:
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: pnpm/action-setup@v5
- uses: actions/setup-node@v6
with:
node-version-file: package.json
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install Playwright Chromium
run: pnpm --filter browser run install:browser
- name: Run browser tests
run: pnpm run test:browser
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7.0.1
with:
name: browser-test-results
path: coverage/tests/browser/lcov.info
coverage:
name: Report Coverage
if: github.event_name == 'push' || (github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository)
runs-on: ubuntu-latest
needs:
[run-tests, run-atlas-tests, run-atlas-local-tests, run-browser-tests]
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: pnpm/action-setup@v5
- uses: actions/setup-node@v6
with:
node-version-file: package.json
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Download test results
uses: actions/download-artifact@v8
with:
name: test-results
path: coverage/mongodb
- name: Download atlas test results
uses: actions/download-artifact@v8
with:
name: atlas-test-results
path: coverage/atlas
- name: Download atlas local test results
uses: actions/download-artifact@v8
with:
name: atlas-local-test-results
path: coverage/atlas-local
- name: Download browser test results
uses: actions/download-artifact@v8
with:
name: browser-test-results
path: coverage/browser
- name: Merge coverage reports
run: |
pnpm dlx lcov-result-merger@5.0.1 "coverage/*/lcov.info" "coverage/lcov.info"
- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v2.3.7
with:
file: coverage/lcov.info
run-git-secrets:
name: Run git secrets
if: github.event_name == 'push' || (github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository)
runs-on: ubuntu-latest
steps:
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Install dependencies
run: |
sudo apt-get install -y git-secrets
- name: Run git-secrets
run: git-secrets --register-aws && git-secrets --scan