Repository navigation
112 lines (96 loc) · 4.49 KB
/
Copy pathcodeql-analysis.yml
File metadata and controls
112 lines (96 loc) · 4.49 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
name: "CodeQL"
on:
workflow_call:
inputs:
languages:
type: string
default: '["java", "javascript", "python"]'
workflow_dispatch:
permissions:
contents: read
pull-requests: read
jobs:
analyze:
env:
# Preserve the master scan identity when invoked by a reusable-workflow caller.
CODEQL_ACTION_ANALYSIS_KEY: .github/workflows/codeql-analysis.yml:analyze
MAVEN_OPTS: -Xmx3g -XX:MaxMetaspaceSize=768m
NODE_OPTIONS: --max-old-space-size=4096
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
max-parallel: 1
matrix:
language: ${{ fromJSON(inputs.languages || '["java", "javascript", "python"]') }}
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Setup Java and Maven
if: matrix.language == 'java'
uses: ./.github/actions/setup-java-env
with:
distribution: zulu
java-version: '17'
# Prepare dependency sources outside the workspace before CodeQL tracing.
- name: Install locked candidate SDK
if: matrix.language == 'java'
uses: ./.github/actions/setup-candidate-sdk
- name: Use pinned Hubble Node.js
if: matrix.language == 'java' || matrix.language == 'javascript'
uses: actions/setup-node@v6
with:
node-version-file: hugegraph-hubble/hubble-fe/.node-version
- name: Activate pinned pnpm
id: pnpm
if: matrix.language == 'java' || matrix.language == 'javascript'
working-directory: hugegraph-hubble/hubble-fe
run: |
corepack enable
pnpm --version
echo "store=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
echo "version=$(node -p 'require("./package.json").packageManager')" >> "$GITHUB_OUTPUT"
echo "node=$(node --version)" >> "$GITHUB_OUTPUT"
- name: Cache pnpm downloads
if: matrix.language == 'java' || matrix.language == 'javascript'
uses: actions/cache@v6
with:
path: ${{ steps.pnpm.outputs.store }}
key: ${{ runner.os }}-${{ runner.arch }}-${{ steps.pnpm.outputs.node }}-${{ steps.pnpm.outputs.version }}-${{ hashFiles('hugegraph-hubble/hubble-fe/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-${{ steps.pnpm.outputs.node }}-${{ steps.pnpm.outputs.version }}-
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# 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
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- if: matrix.language == 'python' || matrix.language == 'javascript'
name: Autobuild
uses: github/codeql-action/autobuild@v4
- if: matrix.language == 'java'
name: Build Java
run: |
mvn clean package -f "pom.xml" -B -V -e -Dfindbugs.skip -Dcheckstyle.skip -Dpmd.skip=true -Dspotbugs.skip -Denforcer.skip -Dmaven.javadoc.skip -DskipTests -Dmaven.test.skip.exec -Dlicense.skip=true -Drat.skip=true -Dspotless.check.skip=true
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: .github/workflows/codeql-analysis.yml:analyze/language:${{ matrix.language }}