Skip to content

Commit 04dfeca

Browse files
authored
Merge pull request #52 from mongodb-js/add-code-ql
Add CodeQL Analysis
2 parents 0852816 + 3fee6c8 commit 04dfeca

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

.github/workflows/codeql.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
2+
# For most projects, this workflow file will not need changing; you simply need
3+
# to commit it to your repository.
4+
#
5+
# You may wish to alter this file to override the set of languages analyzed,
6+
# or to provide custom queries or build logic.
7+
#
8+
# ******** NOTE ********
9+
# We have attempted to detect the languages in your repository. Please check
10+
# the `language` matrix defined below to confirm you have the correct set of
11+
# supported CodeQL languages.
12+
#
13+
name: "CodeQL"
14+
15+
on:
16+
push:
17+
branches: [ "main" ]
18+
pull_request:
19+
# The branches below must be a subset of the branches above
20+
branches: [ "main" ]
21+
schedule:
22+
- cron: '30 14 * * 4'
23+
24+
jobs:
25+
analyze:
26+
name: Analyze
27+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
28+
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
29+
permissions:
30+
actions: read
31+
contents: read
32+
security-events: write
33+
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
language:
38+
- 'javascript'
39+
# TODO: https://jira.mongodb.org/browse/COMPASS-7540, enable the cpp analysis.
40+
# - 'cpp'
41+
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@v3
45+
46+
- name: Use Node.js v18.x
47+
if: matrix.language == 'cpp'
48+
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
49+
with:
50+
node-version: 18.x
51+
52+
- name: Use Node.js v18.x
53+
if: matrix.language == 'cpp'
54+
run: |
55+
npm install
56+
npm run build
57+
58+
# Initializes the CodeQL tools for scanning.
59+
- name: Initialize CodeQL
60+
uses: github/codeql-action/init@v2
61+
with:
62+
languages: ${{ matrix.language }}
63+
# If you wish to specify custom queries, you can do so here or in a config file.
64+
# By default, queries listed here will override any specified in a config file.
65+
# Prefix the list here with "+" to use these queries and those in the config file.
66+
67+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
68+
# queries: security-extended,security-and-quality
69+
config: |
70+
paths-ignore:
71+
- '**/*.test.js'
72+
- '**/*.spec.js'
73+
- '**/*.test.ts'
74+
- '**/*.spec.ts'
75+
- '**/*.test.tsx'
76+
- '**/*.spec.tsx'
77+
78+
- name: Build cpp
79+
if: matrix.language == 'cpp'
80+
run: |
81+
node bin/boxednode.js -s test/resources/example.js -t example
82+
83+
- name: Perform CodeQL Analysis
84+
uses: github/codeql-action/analyze@v2
85+
with:
86+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)