Skip to content

Commit ac39904

Browse files
latest1
1 parent 6821f62 commit ac39904

File tree

1 file changed

+143
-47
lines changed

1 file changed

+143
-47
lines changed

.github/workflows/codeql.yml

Lines changed: 143 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,158 @@
1-
name: "CodeQL"
1+
# Warning: This file is generated automatically, and should not be modified.
2+
# Instead, please modify the template in the pr-checks directory and run:
3+
# (cd pr-checks; pip install [email protected] && python3 sync.py)
4+
# to regenerate this file.
25

6+
name: CodeQL
7+
env:
8+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9+
GO111MODULE: auto
310
on:
411
push:
5-
branches: [ "main" ]
12+
branches:
13+
- main
14+
- releases/v*
615
pull_request:
7-
branches: [ "main" ]
8-
16+
types:
17+
- opened
18+
- synchronize
19+
- reopened
20+
- ready_for_review
21+
schedule:
22+
- cron: '0 5 * * *'
23+
workflow_dispatch: {}
924
jobs:
10-
analyze:
11-
name: Analyze
12-
runs-on: ${{ matrix.language == 'swift' && 'macos-latest' || 'ubuntu-latest' }}
13-
timeout-minutes: ${{ matrix.language == 'swift' && 120 || 360 }}
14-
permissions:
15-
actions: read
16-
contents: read
17-
security-events: write
18-
25+
multi-language-autodetect:
1926
strategy:
2027
fail-fast: false
2128
matrix:
22-
language: [ 'csharp', 'javascript-typescript' ]
23-
dot-version: ['3.1.x']
24-
29+
include:
30+
- os: macos-latest
31+
version: stable-v2.15.5
32+
- os: ubuntu-latest
33+
version: stable-v2.15.5
34+
- os: macos-latest
35+
version: stable-v2.16.6
36+
- os: ubuntu-latest
37+
version: stable-v2.16.6
38+
- os: macos-latest
39+
version: stable-v2.17.6
40+
- os: ubuntu-latest
41+
version: stable-v2.17.6
42+
- os: macos-latest
43+
version: stable-v2.18.4
44+
- os: ubuntu-latest
45+
version: stable-v2.18.4
46+
- os: macos-latest
47+
version: stable-v2.19.4
48+
- os: ubuntu-latest
49+
version: stable-v2.19.4
50+
- os: macos-latest
51+
version: default
52+
- os: ubuntu-latest
53+
version: default
54+
- os: macos-latest
55+
version: linked
56+
- os: ubuntu-latest
57+
version: linked
58+
- os: macos-latest
59+
version: nightly-latest
60+
- os: ubuntu-latest
61+
version: nightly-latest
62+
name: Multi-language repository
63+
permissions:
64+
contents: read
65+
security-events: write
66+
timeout-minutes: 45
67+
runs-on: ${{ matrix.os }}
2568
steps:
26-
- name: Checkout repository
27-
uses: actions/checkout@v3
28-
29-
- name: Install libssl-dev
30-
run: sudo apt-get install -y libssl-dev
31-
32-
- name: Install dependencies
33-
run: |
34-
sudo apt-get update
35-
sudo apt-get install -y libicu-dev libssl-dev ca-certificates openssl
69+
- name: Setup Python on macOS
70+
uses: actions/setup-python@v5
71+
if: runner.os == 'macOS' && matrix.version == 'stable-v2.14.6'
72+
with:
73+
python-version: '3.11'
74+
- name: Check out repository
75+
uses: actions/checkout@v4
76+
- name: Prepare test
77+
id: prepare-test
78+
uses: ./.github/actions/prepare-test
79+
with:
80+
version: ${{ matrix.version }}
81+
use-all-platform-bundle: 'false'
82+
setup-kotlin: 'true'
83+
- uses: actions/setup-go@v5
84+
with:
85+
go-version: '>=1.21.0'
3686

37-
- name: Set System.Globalization.Invariant to true
38-
run: echo "DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1" >> $GITHUB_ENV
87+
- uses: ./../action/init
88+
id: init
89+
with:
90+
db-location: ${{ runner.temp }}/customDbLocation
91+
languages: ${{ runner.os == 'Linux' && 'cpp,csharp,go,java,javascript,python,ruby'
92+
|| '' }}
93+
tools: ${{ steps.prepare-test.outputs.tools-url }}
3994

40-
- name: Setup dotnet ${{ matrix.dot-version }}
41-
uses: actions/setup-dotnet@v3
42-
with:
43-
dotnet-version: ${{ matrix.dot-version }}
95+
- uses: ./../action/.github/actions/setup-swift
96+
if: runner.os == 'macOS'
97+
with:
98+
codeql-path: ${{ steps.init.outputs.codeql-path }}
4499

45-
- name: Display dotnet version
46-
run: dotnet --version
100+
- name: Build code
101+
shell: bash
102+
run: ./build.sh
47103

48-
- name: Initialize CodeQL
49-
uses: github/codeql-action/init@v2
50-
with:
51-
languages: ${{ matrix.language }}
104+
- uses: ./../action/analyze
105+
id: analysis
106+
with:
107+
upload-database: false
52108

53-
- name: Build the C# project
54-
if: matrix.language == 'csharp'
55-
run: |
56-
dotnet restore
57-
dotnet build --configuration Release
109+
- name: Check language autodetect for all languages excluding Swift
110+
shell: bash
111+
run: |
112+
CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }}
113+
if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
114+
echo "Did not create a database for CPP, or created it in the wrong location."
115+
exit 1
116+
fi
117+
CSHARP_DB=${{ fromJson(steps.analysis.outputs.db-locations).csharp }}
118+
if [[ ! -d $CSHARP_DB ]] || [[ ! $CSHARP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
119+
echo "Did not create a database for C Sharp, or created it in the wrong location."
120+
exit 1
121+
fi
122+
GO_DB=${{ fromJson(steps.analysis.outputs.db-locations).go }}
123+
if [[ ! -d $GO_DB ]] || [[ ! $GO_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
124+
echo "Did not create a database for Go, or created it in the wrong location."
125+
exit 1
126+
fi
127+
JAVA_DB=${{ fromJson(steps.analysis.outputs.db-locations).java }}
128+
if [[ ! -d $JAVA_DB ]] || [[ ! $JAVA_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
129+
echo "Did not create a database for Java, or created it in the wrong location."
130+
exit 1
131+
fi
132+
JAVASCRIPT_DB=${{ fromJson(steps.analysis.outputs.db-locations).javascript }}
133+
if [[ ! -d $JAVASCRIPT_DB ]] || [[ ! $JAVASCRIPT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
134+
echo "Did not create a database for Javascript, or created it in the wrong location."
135+
exit 1
136+
fi
137+
PYTHON_DB=${{ fromJson(steps.analysis.outputs.db-locations).python }}
138+
if [[ ! -d $PYTHON_DB ]] || [[ ! $PYTHON_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
139+
echo "Did not create a database for Python, or created it in the wrong location."
140+
exit 1
141+
fi
142+
RUBY_DB=${{ fromJson(steps.analysis.outputs.db-locations).ruby }}
143+
if [[ ! -d $RUBY_DB ]] || [[ ! $RUBY_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
144+
echo "Did not create a database for Ruby, or created it in the wrong location."
145+
exit 1
146+
fi
58147
59-
- name: Perform CodeQL Analysis
60-
uses: github/codeql-action/analyze@v2
61-
with:
62-
category: "/language:${{matrix.language}}"
148+
- name: Check language autodetect for Swift on macOS
149+
if: runner.os == 'macOS'
150+
shell: bash
151+
run: |
152+
SWIFT_DB=${{ fromJson(steps.analysis.outputs.db-locations).swift }}
153+
if [[ ! -d $SWIFT_DB ]] || [[ ! $SWIFT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
154+
echo "Did not create a database for Swift, or created it in the wrong location."
155+
exit 1
156+
fi
157+
env:
158+
CODEQL_ACTION_TEST_MODE: true

0 commit comments

Comments
 (0)