From 3c6c5e0f1f06c3b370f01715b8837f47e7d43dea Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 19 Dec 2023 17:56:30 -0500 Subject: [PATCH 1/3] Create codeql.yml Signed-off-by: Jinzhe Zeng --- .github/workflows/codeql.yml | 63 ++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000000..0a1b4a2cdb --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,63 @@ +name: "CodeQL" + +on: + push: + branches: [ "devel" ] + pull_request: + branches: [ "devel" ] + 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 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + 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. + + # 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 + # queries: security-extended,security-and-quality + + # ℹī¸ 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. + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + cache: 'pip' + if: matrix.language == 'c-cpp' + - name: "Run, Build Application using script" + run: | + python -m pip install tensorflow + source/install/build_cc.sh + env: + DOWNLOAD_TENSORFLOW: "FALSE" + if: matrix.language == 'c-cpp' + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" From 05224a15dfc7e9e0e5eb9697801b586ae24e5d8a Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 19 Dec 2023 18:35:43 -0500 Subject: [PATCH 2/3] add more queries; build cuda Signed-off-by: Jinzhe Zeng --- .github/workflows/codeql.yml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 0a1b4a2cdb..7211466ecd 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -32,18 +32,7 @@ jobs: uses: github/codeql-action/init@v3 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. - - # 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 - # queries: security-extended,security-and-quality - - # ℹī¸ 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. + queries: security-extended,security-and-quality - uses: actions/setup-python@v5 with: python-version: '3.11' @@ -51,10 +40,16 @@ jobs: if: matrix.language == 'c-cpp' - name: "Run, Build Application using script" 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 source/install/build_cc.sh env: + DP_VARIANT: cuda DOWNLOAD_TENSORFLOW: "FALSE" + DEBIAN_FRONTEND: noninteractive if: matrix.language == 'c-cpp' - name: Perform CodeQL Analysis From d4e629f1062b4923649e4c43ef2a6fdf0b16a747 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Tue, 19 Dec 2023 18:47:19 -0500 Subject: [PATCH 3/3] run on all branches Signed-off-by: Jinzhe Zeng --- .github/workflows/codeql.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 7211466ecd..a9a162432c 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -2,9 +2,7 @@ name: "CodeQL" on: push: - branches: [ "devel" ] pull_request: - branches: [ "devel" ] schedule: - cron: '45 2 * * 2' @@ -26,30 +24,32 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - # 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 - uses: actions/setup-python@v5 with: python-version: '3.11' cache: 'pip' if: matrix.language == 'c-cpp' - - name: "Run, Build Application using script" + - 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 - source/install/build_cc.sh + 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" - DEBIAN_FRONTEND: noninteractive if: matrix.language == 'c-cpp' - name: Perform CodeQL Analysis