|
9 | 9 | # the `language` matrix defined below to confirm you have the correct set of |
10 | 10 | # supported CodeQL languages. |
11 | 11 | # |
12 | | -name: "CodeQL" |
| 12 | +name: "CodeQL Advanced" |
13 | 13 |
|
14 | 14 | on: |
15 | 15 | push: |
16 | 16 | branches: [ dev, main ] |
17 | 17 | pull_request: |
18 | | - # The branches below must be a subset of the branches above |
19 | 18 | branches: [ dev ] |
20 | 19 | schedule: |
21 | | - - cron: '18 1 * * 0' |
| 20 | + - cron: '0 2 * * 1' # 2AM Monday |
| 21 | + |
| 22 | +env: |
| 23 | + PYTHON_VER: '3.11' |
| 24 | + PYTORCH_VER: '2.8.0' |
| 25 | + BUILD_MONAI: 1 |
| 26 | + PIP_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu" # forces CPU PyTorch installation, should be faster |
22 | 27 |
|
23 | 28 | jobs: |
24 | 29 | analyze: |
25 | | - name: Analyze |
| 30 | + name: Analyze (${{ matrix.language }}) |
| 31 | + # Runner size impacts CodeQL analysis time. To learn more, please see: |
| 32 | + # - https://gh.io/recommended-hardware-resources-for-running-codeql |
| 33 | + # - https://gh.io/supported-runners-and-hardware-resources |
| 34 | + # - https://gh.io/using-larger-runners (GitHub.com only) |
| 35 | + # Consider using larger runners or machines with greater resources for possible analysis time improvements. |
26 | 36 | runs-on: ubuntu-latest |
27 | 37 | permissions: |
| 38 | + # required for all workflows |
| 39 | + security-events: write |
| 40 | + |
| 41 | + # required to fetch internal or private CodeQL packs |
| 42 | + packages: read |
| 43 | + |
| 44 | + # only required for workflows in private repositories |
28 | 45 | actions: read |
29 | 46 | contents: read |
30 | | - security-events: write |
31 | 47 |
|
32 | 48 | strategy: |
33 | 49 | fail-fast: false |
34 | 50 | matrix: |
35 | | - language: [ 'cpp', 'python' ] |
36 | | - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] |
37 | | - # Learn more about CodeQL language support at https://git.io/codeql-language-support |
38 | | - |
| 51 | + include: |
| 52 | + - language: actions |
| 53 | + build-mode: none |
| 54 | + - language: c-cpp |
| 55 | + build-mode: none # TODO: get Cpp building working, autobuild doesn't work and manual fails for inexplicable reasons. |
| 56 | + - language: python |
| 57 | + build-mode: none |
| 58 | + # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift' |
| 59 | + # Use `c-cpp` to analyze code written in C, C++ or both |
| 60 | + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both |
| 61 | + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both |
| 62 | + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, |
| 63 | + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. |
| 64 | + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how |
| 65 | + # 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 |
39 | 66 | steps: |
40 | 67 | - name: Checkout repository |
41 | 68 | uses: actions/checkout@v7 |
42 | 69 |
|
| 70 | + # Add any setup steps before running the `github/codeql-action/init` action. |
| 71 | + # This includes steps like installing compilers or runtimes (`actions/setup-node` |
| 72 | + # or others). This is typically only required for manual builds. |
| 73 | + # - name: Setup runtime (example) |
| 74 | + # uses: actions/setup-example@v1 |
| 75 | + |
43 | 76 | # Initializes the CodeQL tools for scanning. |
44 | 77 | - name: Initialize CodeQL |
45 | 78 | uses: github/codeql-action/init@v4 |
46 | 79 | with: |
47 | 80 | languages: ${{ matrix.language }} |
| 81 | + build-mode: ${{ matrix.build-mode }} |
48 | 82 | # If you wish to specify custom queries, you can do so here or in a config file. |
49 | 83 | # By default, queries listed here will override any specified in a config file. |
50 | 84 | # Prefix the list here with "+" to use these queries and those in the config file. |
51 | | - # queries: ./path/to/local/query, your-org/your-repo/queries@main |
52 | 85 |
|
53 | | - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). |
54 | | - # If this step fails, then you should remove it and run the build manually (see below) |
55 | | - # - name: Autobuild |
56 | | - # uses: github/codeql-action/autobuild@v2 |
| 86 | + # 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 |
| 87 | + # queries: security-extended,security-and-quality |
57 | 88 |
|
| 89 | + # If the analyze step fails for one of the languages you are analyzing with |
| 90 | + # "We were unable to automatically build your code", modify the matrix above |
| 91 | + # to set the build mode to "manual" for that language. Then modify this step |
| 92 | + # to build your code. |
58 | 93 | # ℹ️ Command-line programs to run using the OS shell. |
59 | | - # 📚 https://git.io/JvXDl |
60 | | - |
61 | | - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines |
62 | | - # and modify them (or add more) to build your code if your project |
63 | | - # uses a compiled language |
| 94 | + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun |
| 95 | + - name: Set up Python ${{ env.PYTHON_VER }} |
| 96 | + if: matrix.language == 'c-cpp' && matrix.build-mode == 'manual' |
| 97 | + uses: actions/setup-python@v6 |
| 98 | + with: |
| 99 | + python-version: ${{ env.PYTHON_VER }} |
| 100 | + cache: 'pip' |
64 | 101 |
|
65 | | - - name: Build |
| 102 | + - name: Run manual build steps |
| 103 | + if: matrix.language == 'c-cpp' && matrix.build-mode == 'manual' |
| 104 | + shell: bash |
66 | 105 | run: | |
67 | 106 | rm -rf /opt/hostedtoolcache/{node,go,Ruby,Java*} |
68 | 107 | ls -al /opt/hostedtoolcache |
69 | | - rm -rf /usr/share/dotnet/ |
| 108 | + sudo rm -rf /usr/share/dotnet/ |
70 | 109 | python -m pip install -U pip wheel wheel-stub |
71 | | - python -m pip install .[all,testing] |
72 | | - BUILD_MONAI=1 ./runtests.sh --build |
| 110 | + python -m pip install torch==${PYTORCH_VER} torchvision |
| 111 | + python -m pip install --user --upgrade pip wheel |
| 112 | + python monai/config/print_dependencies.py build-system | xargs pip install --no-build-isolation |
| 113 | + python -m pip install --no-build-isolation . |
73 | 114 |
|
74 | 115 | - name: Perform CodeQL Analysis |
75 | 116 | uses: github/codeql-action/analyze@v4 |
| 117 | + with: |
| 118 | + category: "/language:${{matrix.language}}" |
0 commit comments