Skip to content

Commit

Permalink
add CodeQL checks (#3075)
Browse files Browse the repository at this point in the history
It can scan the codes and report as follows:


![image](https://github.com/deepmodeling/deepmd-kit/assets/9496702/77b518b9-56f5-414a-b116-68da3aa9d67a)

---------

Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz authored Dec 21, 2023
1 parent 2b52187 commit 0032f5d
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "CodeQL"

on:
push:
pull_request:
schedule:
- cron: '45 2 * * 2'

jobs:
analyze:
name: Analyze
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'c-cpp', 'javascript-typescript', 'python' ]

steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
if: matrix.language == 'c-cpp'
- name: "Setup dependencies"
if: matrix.language == 'c-cpp'
run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \
&& sudo dpkg -i cuda-keyring_1.0-1_all.deb \
&& sudo apt-get update \
&& sudo apt-get -y install cuda-cudart-dev-12-2 cuda-nvcc-12-2
python -m pip install tensorflow
env:
DEBIAN_FRONTEND: noninteractive
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: security-extended,security-and-quality
- name: "Run, Build Application using script"
run: source/install/build_cc.sh
env:
DP_VARIANT: cuda
DOWNLOAD_TENSORFLOW: "FALSE"
if: matrix.language == 'c-cpp'

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"

0 comments on commit 0032f5d

Please sign in to comment.