-
Notifications
You must be signed in to change notification settings - Fork 281
157 lines (151 loc) · 5.3 KB
/
Copy pathcode-health.yml
File metadata and controls
157 lines (151 loc) · 5.3 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
---
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]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
if: matrix.os == 'ubuntu-latest'
- uses: actions/checkout@v5
with:
persist-credentials: false
- uses: docker/setup-docker-action@v4
if: matrix.os == 'ubuntu-latest'
name: Setup Docker Environment
with:
set-host: true
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
with:
node-version-file: package.json
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run tests
run: pnpm test
env:
SKIP_ATLAS_TESTS: "true"
SKIP_ATLAS_LOCAL_TESTS: "true"
- name: Upload test results
if: always() && matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v5
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@v5
with:
persist-credentials: false
- uses: pnpm/action-setup@v4
- 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@v5
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@v5
with:
persist-credentials: false
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
with:
node-version-file: package.json
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run tests
run: pnpm test tests/integration/tools/atlas-local/
- name: Upload test results
uses: actions/upload-artifact@v5
if: always()
with:
name: atlas-local-test-results
path: coverage/lcov.info
coverage:
name: Report Coverage
if: always() && (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]
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- uses: pnpm/action-setup@v4
- 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@v6
with:
name: test-results
path: coverage/mongodb
- name: Download atlas test results
uses: actions/download-artifact@v6
with:
name: atlas-test-results
path: coverage/atlas
- name: Download atlas local test results
uses: actions/download-artifact@v6
with:
name: atlas-local-test-results
path: coverage/atlas-local
- 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.6
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@v5
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