-
Notifications
You must be signed in to change notification settings - Fork 4
108 lines (92 loc) · 3.41 KB
/
Copy pathcodeql.yml
File metadata and controls
108 lines (92 loc) · 3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: CodeQL
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '24 4 * * 1'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
permissions:
security-events: write
packages: read
actions: read
contents: read
strategy:
fail-fast: false
matrix:
include:
- language: rust
build-mode: none
- language: java-kotlin
build-mode: manual
- language: javascript-typescript
build-mode: none
- language: python
build-mode: none
- language: go
build-mode: manual
- language: actions
build-mode: none
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Load build configs
id: configs
uses: ./.github/actions/load-configs
- name: Setup JVM toolchain
if: matrix.language == 'java-kotlin'
uses: ./.github/actions/setup-jvm-toolchain
with:
java-version: ${{ steps.configs.outputs.java-version }}
java-distribution: ${{ steps.configs.outputs.java-distribution }}
kotlin-version: ${{ steps.configs.outputs.kotlin-version }}
ktlint-version: ${{ steps.configs.outputs.ktlint-version }}
- name: Setup Go
if: matrix.language == 'go'
uses: actions/setup-go@v6
with:
go-version: ${{ steps.configs.outputs.go-version }}
cache: false
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
config-file: ./.github/codeql/codeql-config.yml
- name: Compile Kotlin bindings for CodeQL extraction
if: matrix.language == 'java-kotlin'
shell: bash
env:
JNA_VERSION: ${{ steps.configs.outputs.jna-version }}
GSON_VERSION: ${{ steps.configs.outputs.gson-version }}
run: |
set -euo pipefail
JAR="$GITHUB_WORKSPACE/src/bindings-jvm/generated/cloudformation-validate.jar"
LIBS="$RUNNER_TEMP/jvm-libs"
SRC="$RUNNER_TEMP/jvm-src"
mkdir -p "$LIBS" "$SRC"
echo "Extracting Kotlin sources from $(basename "$JAR")..."
unzip -q -o "$JAR" '*.kt' -d "$SRC"
echo "Fetching compile-time dependencies (JNA ${JNA_VERSION}, Gson ${GSON_VERSION})..."
curl -sfL "https://repo1.maven.org/maven2/net/java/dev/jna/jna/${JNA_VERSION}/jna-${JNA_VERSION}.jar" -o "$LIBS/jna.jar"
curl -sfL "https://repo1.maven.org/maven2/com/google/code/gson/gson/${GSON_VERSION}/gson-${GSON_VERSION}.jar" -o "$LIBS/gson.jar"
echo "Compiling Kotlin sources under the CodeQL tracer..."
find "$SRC" -name '*.kt' -type f -print0 \
| xargs -0 kotlinc -classpath "$LIBS/jna.jar:$LIBS/gson.jar" -d "$RUNNER_TEMP/jvm-classes" -nowarn
- name: Compile Go bindings for CodeQL extraction
if: matrix.language == 'go'
working-directory: ${{ env.WORKING_DIR }}/bindings-go/go
run: go build ./...
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{ matrix.language }}"