Skip to content

Commit bcd95f8

Browse files
authored
Add CodeQL GitHub Action (#280)
Motivation: Integrate CodeQL for automated code analysis to enhance security and code quality. Modifications: Add GitHub Action Result: Maintain high standards of code security and quality in the project.
1 parent b992f58 commit bcd95f8

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

.github/workflows/ci-codeql.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Copyright 2024 asyncer.io proejcts
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: "CodeQL"
16+
17+
on:
18+
push:
19+
branches: [ "trunk", "0.9.x" ]
20+
pull_request:
21+
branches: [ "trunk", "0.9.x" ]
22+
schedule:
23+
- cron: '24 3 * * 5'
24+
25+
jobs:
26+
analyze:
27+
name: Analyze (${{ matrix.language }})
28+
# Runner size impacts CodeQL analysis time. To learn more, please see:
29+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
30+
# - https://gh.io/supported-runners-and-hardware-resources
31+
# - https://gh.io/using-larger-runners (GitHub.com only)
32+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
33+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
34+
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
35+
permissions:
36+
# required for all workflows
37+
security-events: write
38+
39+
# required to fetch internal or private CodeQL packs
40+
packages: read
41+
42+
# only required for workflows in private repositories
43+
actions: read
44+
contents: read
45+
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
include:
50+
- language: java-kotlin
51+
build-mode: none # This mode only analyzes Java. Set this to 'autobuild' or 'manual' to analyze Kotlin too.
52+
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
53+
# Use `c-cpp` to analyze code written in C, C++ or both
54+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
55+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
56+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
57+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
58+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
59+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
60+
steps:
61+
- name: Checkout repository
62+
uses: actions/checkout@v4
63+
64+
# Initializes the CodeQL tools for scanning.
65+
- name: Initialize CodeQL
66+
uses: github/codeql-action/init@v3
67+
with:
68+
languages: ${{ matrix.language }}
69+
build-mode: ${{ matrix.build-mode }}
70+
# If you wish to specify custom queries, you can do so here or in a config file.
71+
# By default, queries listed here will override any specified in a config file.
72+
# Prefix the list here with "+" to use these queries and those in the config file.
73+
74+
# 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
75+
# queries: security-extended,security-and-quality
76+
77+
- name: Perform CodeQL Analysis
78+
uses: github/codeql-action/analyze@v3
79+
with:
80+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)