Skip to content

Commit 81f1134

Browse files
authored
Merge pull request #2193 from lowcoder-org/codex/codeql-pr-checks
Fix CodeQL Java build and add pull-request scans
2 parents 5991162 + 809f319 commit 81f1134

1 file changed

Lines changed: 38 additions & 61 deletions

File tree

‎.github/workflows/codeql.yml‎

Lines changed: 38 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
1-
# For most projects, this workflow file will not need changing; you simply need
2-
# to commit it to your repository.
3-
#
4-
# You may wish to alter this file to override the set of languages analyzed,
5-
# or to provide custom queries or build logic.
6-
#
7-
# ******** NOTE ********
8-
# We have attempted to detect the languages in your repository. Please check
9-
# the `language` matrix defined below to confirm you have the correct set of
10-
# supported CodeQL languages.
11-
#
121
name: "CodeQL"
132

143
on:
154
push:
165
branches: [ "main" ]
6+
pull_request:
7+
types: [opened, synchronize, reopened, ready_for_review]
178
schedule:
189
- cron: '20 15 * * 5'
1910

2011
jobs:
2112
analyze:
22-
name: Analyze
13+
name: Analyze (${{ matrix.language }})
2314
runs-on: ubuntu-latest
2415
permissions:
2516
actions: read
@@ -29,54 +20,40 @@ jobs:
2920
strategy:
3021
fail-fast: false
3122
matrix:
32-
language: [ 'java', 'javascript' ]
33-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
34-
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
23+
include:
24+
- language: java
25+
build-mode: manual
26+
- language: javascript
27+
build-mode: none
3528

3629
steps:
37-
- name: Setup Java JDK
38-
uses: actions/setup-java@v1
39-
with:
40-
java-version: 17
41-
42-
- name: Checkout repository
43-
uses: actions/checkout@v3
44-
45-
# Initializes the CodeQL tools for scanning.
46-
- name: Initialize CodeQL
47-
uses: github/codeql-action/init@v2
48-
with:
49-
config-file: ./.github/codeql/codeql-config.yaml
50-
languages: ${{ matrix.language }}
51-
# If you wish to specify custom queries, you can do so here or in a config file.
52-
# By default, queries listed here will override any specified in a config file.
53-
# Prefix the list here with "+" to use these queries and those in the config file.
54-
55-
# 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
56-
# queries: security-extended,security-and-quality
57-
58-
- if: matrix.language == 'java'
59-
name: Build Java
60-
run: |
61-
mvn clean compile -DskipTests -f ./server/api-service/pom.xml
62-
63-
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
64-
# If this step fails, then you should remove it and run the build manually (see below)
65-
# - if: matrix.language != 'java'
66-
# name: Autobuild
67-
# uses: github/codeql-action/autobuild@v2
68-
69-
# ℹ️ Command-line programs to run using the OS shell.
70-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
71-
72-
# If the Autobuild fails above, remove it and uncomment the following three lines.
73-
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
74-
75-
# - run: |
76-
# echo "Run, Build Application using script"
77-
# ./location_of_script_within_repo/buildscript.sh
78-
79-
- name: Perform CodeQL Analysis
80-
uses: github/codeql-action/analyze@v2
81-
with:
82-
category: "/language:${{matrix.language}}"
30+
- name: Checkout repository
31+
uses: actions/checkout@v6
32+
with:
33+
persist-credentials: false
34+
35+
- name: Setup Java JDK
36+
if: matrix.language == 'java'
37+
uses: actions/setup-java@v5
38+
with:
39+
distribution: temurin
40+
java-version: 17
41+
42+
- name: Initialize CodeQL
43+
uses: github/codeql-action/init@v4
44+
with:
45+
config-file: ./.github/codeql/codeql-config.yaml
46+
languages: ${{ matrix.language }}
47+
build-mode: ${{ matrix.build-mode }}
48+
49+
- name: Build Java
50+
if: matrix.language == 'java'
51+
run: |
52+
# Downstream modules need the SDK's shared test-helper JAR, attached
53+
# during package. Skip test execution, but keep test compilation.
54+
mvn --batch-mode --no-transfer-progress clean package -DskipTests -f ./server/api-service/pom.xml
55+
56+
- name: Perform CodeQL Analysis
57+
uses: github/codeql-action/analyze@v4
58+
with:
59+
category: "/language:${{ matrix.language }}"

0 commit comments

Comments
 (0)