1616 - cron : ' 00 12 * * 0' # every Sunday at 12:00 UTC
1717
1818concurrency :
19- group : ${{ github.workflow }}-${{ github.ref }}
19+ group : " ${{ github.workflow }}-${{ github.ref }}"
2020 cancel-in-progress : true
2121
2222jobs :
@@ -57,10 +57,25 @@ jobs:
5757 console.log(`Remapping language: ${key} to ${remap_languages[key.toLowerCase()]}`)
5858 key = remap_languages[key.toLowerCase()]
5959 }
60- if (supported_languages.includes(key.toLowerCase()) &&
61- !matrix['include'].includes({"language": key.toLowerCase()})) {
60+ if (supported_languages.includes(key.toLowerCase())) {
6261 console.log(`Found supported language: ${key}`)
63- matrix['include'].push({"language": key.toLowerCase()})
62+ let osList = ['ubuntu-latest'];
63+ if (key.toLowerCase() === 'swift') {
64+ osList = ['macos-latest'];
65+ } else if (key.toLowerCase() === 'cpp') {
66+ osList = ['macos-latest', 'ubuntu-latest', 'windows-latest'];
67+ }
68+ for (let os of osList) {
69+ // set name for matrix
70+ if (osList.length == 1) {
71+ name = key.toLowerCase()
72+ } else {
73+ name = `${key.toLowerCase()}, ${os}`
74+ }
75+
76+ // add to matrix
77+ matrix['include'].push({"language": key.toLowerCase(), "os": os, "name": name})
78+ }
6479 }
6580 }
6681
@@ -84,10 +99,15 @@ jobs:
8499 }
85100
86101 analyze :
87- name : Analyze
102+ name : Analyze (${{ matrix.name }})
88103 if : ${{ needs.languages.outputs.continue == 'true' }}
104+ defaults :
105+ run :
106+ shell : ${{ matrix.os == 'windows-latest' && 'msys2 {0}' || 'bash' }}
107+ env :
108+ GITHUB_CODEQL_BUILD : true
89109 needs : [languages]
90- runs-on : ${{ ( matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
110+ runs-on : ${{ matrix.os || 'ubuntu-latest' }}
91111 timeout-minutes : ${{ (matrix.language == 'swift' && 120) || 360 }}
92112 permissions :
93113 actions : read
@@ -100,6 +120,7 @@ jobs:
100120
101121 steps :
102122 - name : Maximize build space
123+ if : runner.os == 'Linux'
103124 uses : easimon/maximize-build-space@v8
104125 with :
105126 root-reserve-mb : 20480
@@ -114,6 +135,12 @@ jobs:
114135 with :
115136 submodules : recursive
116137
138+ - name : Setup msys2
139+ if : runner.os == 'Windows'
140+ uses : msys2/setup-msys2@v2
141+ with :
142+ update : true
143+
117144 # Initializes the CodeQL tools for scanning.
118145 - name : Initialize CodeQL
119146 uses : github/codeql-action/init@v3
@@ -129,16 +156,20 @@ jobs:
129156
130157 # Pre autobuild
131158 # create a file named .codeql-prebuild-${{ matrix.language }}.sh in the root of your repository
159+ # create a file named .codeql-build-${{ matrix.language }}.sh in the root of your repository
132160 - name : Prebuild
161+ id : prebuild
133162 run : |
134- # check if .qodeql-prebuild-${{ matrix.language }}.sh exists
135- if [ -f "./.codeql-prebuild-${{ matrix.language }}.sh" ]; then
136- echo "Running .codeql-prebuild-${{ matrix.language }}.sh"
137- ./.codeql-prebuild-${{ matrix.language }}.sh
163+ # check if prebuild script exists
164+ filename=".codeql-prebuild-${{ matrix.language }}-${{ runner.os }}.sh"
165+ if [ -f "./${filename}" ]; then
166+ echo "Running prebuild script: ${filename}"
167+ ./${filename}
138168 fi
139169
140170 # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
141171 - name : Autobuild
172+ if : steps.prebuild.outputs.skip_autobuild != 'true'
142173 uses : github/codeql-action/autobuild@v3
143174
144175 - name : Perform CodeQL Analysis
0 commit comments