Skip to content

Commit a4d44d4

Browse files
authored
Add codeql to workflows (#1)
* Add codeql to workflows * Add minimum java 16 version to build.gradle.kts * Fix codeql workflow
1 parent 76c0514 commit a4d44d4

File tree

3 files changed

+89
-1
lines changed

3 files changed

+89
-1
lines changed

.github/workflows/codeql.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "main" ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "main" ]
20+
schedule:
21+
- cron: '43 14 * * 6'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v3
35+
36+
# Initializes the CodeQL tools for scanning.
37+
- name: Initialize CodeQL
38+
uses: github/codeql-action/init@v2
39+
with:
40+
languages: java
41+
# If you wish to specify custom queries, you can do so here or in a config file.
42+
# By default, queries listed here will override any specified in a config file.
43+
# Prefix the list here with "+" to use these queries and those in the config file.
44+
45+
# 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
46+
# queries: security-extended,security-and-quality
47+
48+
- uses: actions/setup-java@v3
49+
with:
50+
java-version: '16'
51+
distribution: 'temurin'
52+
cache: gradle
53+
- name: Validate Gradle wrapper
54+
uses: gradle/wrapper-validation-action@v1.0.6
55+
56+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
57+
# If this step fails, then you should remove it and run the build manually (see below)
58+
- name: Autobuild
59+
uses: github/codeql-action/autobuild@v2
60+
61+
# ℹ️ Command-line programs to run using the OS shell.
62+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
63+
64+
# If the Autobuild fails above, remove it and uncomment the following three lines.
65+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
66+
67+
# - uses: actions/setup-java@v3
68+
# with:
69+
# java-version: '16'
70+
# distribution: 'temurin'
71+
# cache: gradle
72+
# - name: Validate Gradle wrapper
73+
# uses: gradle/wrapper-validation-action@v1.0.6
74+
# - name: Build with Gradle
75+
# uses: gradle/gradle-build-action
76+
# with:
77+
# arguments: build
78+
79+
- name: Perform CodeQL Analysis
80+
uses: github/codeql-action/analyze@v2
81+
with:
82+
category: "/language:java"

.github/workflows/main.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v2
10-
- uses: actions/setup-java@v2
10+
- uses: actions/setup-java@v3
1111
with:
1212
java-version: '16'
1313
distribution: 'temurin'
1414
cache: gradle
15+
- name: Validate Gradle wrapper
16+
uses: gradle/wrapper-validation-action
17+

build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ dependencies {
3131
}
3232

3333
java {
34+
sourceCompatibility = JavaVersion.VERSION_16
35+
targetCompatibility = JavaVersion.VERSION_16
36+
3437
withSourcesJar()
3538
withJavadocJar()
3639
}

0 commit comments

Comments
 (0)