|
1 | | -# For most projects, this workflow file will not need changing; you simply need |
2 | | -# to commit it to your repository. |
| 1 | +#/ |
| 2 | +# @license Apache-2.0 |
3 | 3 | # |
4 | | -# You may wish to alter this file to override the set of languages analyzed, |
5 | | -# or to provide custom queries or build logic. |
| 4 | +# Copyright (c) 2023 The Stdlib Authors. |
6 | 5 | # |
7 | | -# ******** NOTE ******** |
8 | | -# We have attempted to detect the languages in your repository. Please check |
9 | | -# the `language` matrix defined below to confirm you have the correct set of |
10 | | -# supported CodeQL languages. |
| 6 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +# you may not use this file except in compliance with the License. |
| 8 | +# You may obtain a copy of the License at |
11 | 9 | # |
12 | | -name: "CodeQL" |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, software |
| 13 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +# See the License for the specific language governing permissions and |
| 16 | +# limitations under the License. |
| 17 | +#/ |
| 18 | + |
| 19 | +name: CodeQL |
13 | 20 |
|
| 21 | +# Workflow triggers: |
14 | 22 | on: |
15 | | - push: |
16 | | - branches: [ "develop", "master" ] |
17 | | - pull_request: |
18 | | - branches: [ "develop", "master" ] |
| 23 | + # push: |
| 24 | + # branches: [ "develop", "master" ] |
| 25 | + # pull_request: |
| 26 | + # branches: [ "develop", "master" ] |
19 | 27 | schedule: |
20 | | - - cron: '16 2 * * 3' |
| 28 | + # Run the workflow once a week (Sunday at midnight): |
| 29 | + - cron: '0 0 * * 0' |
21 | 30 |
|
| 31 | +# Workflow jobs: |
22 | 32 | jobs: |
| 33 | + |
| 34 | + # Define a job for performing CodeQL analysis... |
23 | 35 | analyze: |
24 | | - name: Analyze |
25 | | - # Runner size impacts CodeQL analysis time. To learn more, please see: |
26 | | - # - https://gh.io/recommended-hardware-resources-for-running-codeql |
27 | | - # - https://gh.io/supported-runners-and-hardware-resources |
28 | | - # - https://gh.io/using-larger-runners |
29 | | - # Consider using larger runners for possible analysis time improvements. |
30 | | - runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} |
31 | | - timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} |
| 36 | + |
| 37 | + # Define a display name: |
| 38 | + name: 'Analyze' |
| 39 | + |
| 40 | + # Define the type of virtual host machine. |
| 41 | + # |
| 42 | + # ## Notes |
| 43 | + # |
| 44 | + # - Runner size impacts CodeQL analysis time. To learn more, please see: |
| 45 | + # - https://gh.io/recommended-hardware-resources-for-running-codeql |
| 46 | + # - https://gh.io/supported-runners-and-hardware-resources |
| 47 | + # - https://gh.io/using-larger-runners |
| 48 | + # |
| 49 | + # - For analysis time improvements, consider using larger runners. |
| 50 | + runs-on: ubuntu-latest |
| 51 | + |
| 52 | + # Limit how long the job can run: |
| 53 | + timeout-minutes: 360 |
| 54 | + |
| 55 | + # Restrict the type of data which is accessible to this job: |
32 | 56 | permissions: |
33 | 57 | actions: read |
34 | 58 | contents: read |
35 | 59 | security-events: write |
36 | 60 |
|
| 61 | + # Define the build matrix strategy... |
37 | 62 | strategy: |
| 63 | + |
| 64 | + # Specify whether to cancel all in-progress jobs if any matrix job fails: |
38 | 65 | fail-fast: false |
| 66 | + |
| 67 | + # Define the build matrix: |
39 | 68 | matrix: |
40 | | - language: [ 'c-cpp', 'javascript-typescript', 'python' ] |
41 | | - # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ] |
42 | | - # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both |
43 | | - # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both |
44 | | - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support |
45 | 69 |
|
| 70 | + # CodeQL supports the following languages: |
| 71 | + # |
| 72 | + # [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ] |
| 73 | + # |
| 74 | + # Use only 'java-kotlin' to analyze code written in Java, Kotlin, or both. |
| 75 | + # |
| 76 | + # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript, or both. |
| 77 | + language: [ 'javascript-typescript', 'python' ] |
| 78 | + |
| 79 | + # Define the sequence of job steps: |
46 | 80 | steps: |
47 | | - - name: Checkout repository |
48 | | - uses: actions/checkout@v3 |
49 | 81 |
|
50 | | - # Initializes the CodeQL tools for scanning. |
51 | | - - name: Initialize CodeQL |
| 82 | + # Checkout the repository: |
| 83 | + - name: 'Checkout repository' |
| 84 | + # Pin action to full length commit SHA corresponding to v4.1.0 |
| 85 | + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 |
| 86 | + with: |
| 87 | + # Specify whether to remove untracked files before checking out the repository: |
| 88 | + clean: false |
| 89 | + |
| 90 | + # Limit clone depth to the most recent 100 commits: |
| 91 | + fetch-depth: 100 |
| 92 | + |
| 93 | + # Specify whether to download Git-LFS files: |
| 94 | + lfs: false |
| 95 | + timeout-minutes: 10 |
| 96 | + |
| 97 | + # Initialize CodeQL tools for scanning: |
| 98 | + - name: 'Initialize CodeQL' |
| 99 | + |
| 100 | + # FIXME: pin action to full length commit SHA |
52 | 101 | uses: github/codeql-action/init@v2 |
53 | 102 | with: |
54 | 103 | languages: ${{ matrix.language }} |
55 | | - # If you wish to specify custom queries, you can do so here or in a config file. |
56 | | - # By default, queries listed here will override any specified in a config file. |
57 | | - # Prefix the list here with "+" to use these queries and those in the config file. |
58 | | - |
59 | | - # 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 |
60 | | - # queries: security-extended,security-and-quality |
61 | 104 |
|
| 105 | + # Install compilers: |
| 106 | + - name: 'Install compilers' |
| 107 | + run: | |
| 108 | + sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test" |
| 109 | + sudo -E apt-get update -q |
| 110 | + sudo -E apt-get -yq --no-install-suggests --no-install-recommends --allow-downgrades --allow-remove-essential --allow-change-held-packages install binutils gcc-9 gcc-9-multilib g++-9 g++-9-multilib gfortran-9 gfortran-9-multilib |
| 111 | + mkdir -p $HOME/bin |
| 112 | + echo "$HOME/bin" >> $GITHUB_PATH |
| 113 | + ln -s /usr/bin/gcc-9 $HOME/bin/gcc |
| 114 | + ln -s /usr/bin/g++-9 $HOME/bin/g++ |
| 115 | + ln -s /usr/bin/gfortran-9 $HOME/bin/gfortran |
| 116 | + timeout-minutes: 10 |
62 | 117 |
|
63 | | - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). |
64 | | - # If this step fails, then you should remove it and run the build manually (see below) |
65 | | - - name: Autobuild |
66 | | - uses: github/codeql-action/autobuild@v2 |
| 118 | + # Install Node.js: |
| 119 | + - name: 'Install Node.js' |
| 120 | + # Pin action to full length commit SHA corresponding to v3.8.1 |
| 121 | + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d |
| 122 | + with: |
| 123 | + node-version: '20' # 'lts/*' |
| 124 | + timeout-minutes: 5 |
67 | 125 |
|
68 | | - # ℹ️ Command-line programs to run using the OS shell. |
69 | | - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun |
| 126 | + # Print debug info: |
| 127 | + - name: 'Print debug info' |
| 128 | + run: | |
| 129 | + echo 'PATH:' |
| 130 | + echo $PATH |
| 131 | + echo '' |
| 132 | + echo 'gcc:' |
| 133 | + gcc --version |
| 134 | + echo '' |
| 135 | + echo 'g++:' |
| 136 | + g++ --version |
| 137 | + echo '' |
| 138 | + echo 'gfortran:' |
| 139 | + gfortran --version |
| 140 | + echo '' |
| 141 | + echo 'Git:' |
| 142 | + git --version |
| 143 | + echo '' |
| 144 | + echo 'Node.js:' |
| 145 | + file $(which node) |
| 146 | + node --version |
| 147 | + node -p 'process.platform + "@" + process.arch' |
| 148 | + echo '' |
| 149 | + echo 'npm:' |
| 150 | + npm --version |
| 151 | + npm config get registry |
| 152 | + timeout-minutes: 2 |
70 | 153 |
|
71 | | - # If the Autobuild fails above, remove it and uncomment the following three lines. |
72 | | - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. |
| 154 | + # Install dependencies (accounting for possible network failures, etc, when installing node module dependencies): |
| 155 | + - name: 'Install dependencies' |
| 156 | + run: | |
| 157 | + make install-node-modules || make install-node-modules || make install-node-modules |
| 158 | + timeout-minutes: 15 |
73 | 159 |
|
74 | | - # - run: | |
75 | | - # echo "Run, Build Application using script" |
| 160 | + # Build native add-ons: |
| 161 | + # - name: 'Build native add-ons' |
| 162 | + # run: | |
76 | 163 | # ./location_of_script_within_repo/buildscript.sh |
77 | 164 |
|
78 | | - - name: Perform CodeQL Analysis |
| 165 | + # Perform CodeQL analysis: |
| 166 | + - name: 'Perform CodeQL Analysis' |
| 167 | + |
| 168 | + # FIXME: pin action to full length commit SHA |
79 | 169 | uses: github/codeql-action/analyze@v2 |
80 | 170 | with: |
81 | 171 | category: "/language:${{matrix.language}}" |
0 commit comments