|
| 1 | +# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | +# |
| 16 | +name: "CodeQL" |
| 17 | + |
| 18 | +on: [push, pull_request] |
| 19 | + |
| 20 | +jobs: |
| 21 | + analyze: |
| 22 | + name: Analyze |
| 23 | + runs-on: ${{ (matrix.language == 'c-cpp' && 'ubuntu-20.04-64core') || 'ubuntu-latest' }} |
| 24 | + timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} |
| 25 | + permissions: |
| 26 | + actions: read |
| 27 | + contents: read |
| 28 | + security-events: write |
| 29 | + |
| 30 | + strategy: |
| 31 | + fail-fast: false |
| 32 | + matrix: |
| 33 | + language: [ 'c-cpp', 'javascript-typescript', 'python' ] |
| 34 | + |
| 35 | + steps: |
| 36 | + - name: Checkout repository |
| 37 | + uses: actions/checkout@v3 |
| 38 | + with: |
| 39 | + lfs: true |
| 40 | + submodules: 'recursive' |
| 41 | + |
| 42 | + - if: matrix.language == 'c-cpp' |
| 43 | + name: Setup environment |
| 44 | + run: | |
| 45 | + sudo apt update -y && sudo apt install -y --no-install-recommends \ |
| 46 | + git git-lfs gcc-11 g++-11 ninja-build ccache libgtest-dev libgmock-dev \ |
| 47 | + shellcheck curl doxygen python3 python3-pip python3-dev python3-distutils |
| 48 | +
|
| 49 | + - if: matrix.language == 'c-cpp' |
| 50 | + name: Install Python Dependencies |
| 51 | + run: | |
| 52 | + python3 -m pip install sphinx-rtd-theme sphinx==4.5.0 breathe exhale \ |
| 53 | + recommonmark graphviz numpy==1.24.1 |
| 54 | +
|
| 55 | + - if: matrix.language == 'c-cpp' |
| 56 | + name: Install CUDA Toolkit |
| 57 | + |
| 58 | + id: cuda-toolkit |
| 59 | + with: |
| 60 | + cuda: '11.7.1' |
| 61 | + linux-local-args: '["--toolkit"]' |
| 62 | + |
| 63 | + - if: matrix.language == 'c-cpp' |
| 64 | + name: Verify CUDA installation |
| 65 | + run: | |
| 66 | + echo "Installed CUDA version is: ${{ steps.cuda-toolkit.outputs.cuda }}" |
| 67 | + echo "CUDA install location: ${{ steps.cuda-toolkit.outputs.CUDA_PATH }}" |
| 68 | + sudo ln -s ${{ steps.cuda-toolkit.outputs.CUDA_PATH }}/lib64/libcudart.so \ |
| 69 | + /usr/lib/x86_64-linux-gnu/libcuda.so |
| 70 | + nvcc -V |
| 71 | +
|
| 72 | + - name: Initialize CodeQL |
| 73 | + uses: github/codeql-action/init@v2 |
| 74 | + with: |
| 75 | + languages: ${{ matrix.language }} |
| 76 | + queries: +security-and-quality |
| 77 | + |
| 78 | + - if: matrix.language != 'c-cpp' |
| 79 | + name: Autobuild |
| 80 | + uses: github/codeql-action/autobuild@v2 |
| 81 | + |
| 82 | + - if: matrix.language == 'c-cpp' |
| 83 | + name: Build CMake project |
| 84 | + run: | |
| 85 | + echo "Running CMake project build script" |
| 86 | + ./ci/build.sh debug build "-DBUILD_SAMPLES=OFF -DBUILD_TESTS=OFF -DBUILD_PYTHON=0" $* |
| 87 | +
|
| 88 | + - name: Perform CodeQL Analysis |
| 89 | + uses: github/codeql-action/analyze@v2 |
| 90 | + with: |
| 91 | + category: "/language:${{matrix.language}}" |
0 commit comments