-
Notifications
You must be signed in to change notification settings - Fork 1.1k
96 lines (84 loc) · 3.42 KB
/
Copy pathcodeql.yml
File metadata and controls
96 lines (84 loc) · 3.42 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
name: CodeQL
on:
pull_request:
branches:
- main
- release/*
- cloudfoundry
- gh-pages
push:
branches:
- main
- release/*
- cloudfoundry
- gh-pages
schedule:
- cron: "29 13 * * 2" # weekly at 13:29 UTC on Tuesday
permissions:
contents: read
jobs:
analyze:
name: Analyze (${{ matrix.language }})
permissions:
contents: read
actions: read # for github/codeql-action/init to get workflow details
security-events: write # for github/codeql-action/analyze to upload SARIF results
strategy:
fail-fast: false
matrix:
include:
- language: actions
- language: java
runs-on: ${{ github.repository == 'open-telemetry/opentelemetry-java-instrumentation' && 'oracle-vm-8cpu-32gb-x86-64' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
# don't need to free disk space (which takes time) since running on larger machine
- name: Set up JDK 11
uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
with:
distribution: temurin
java-version: 11
- name: Set up JDK for running Gradle
uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
with:
distribution: temurin
java-version-file: .java-version
- name: Increase gradle daemon heap size
run: |
# increasing more than other workflows since this is running on a large runner
# and so it uses more parallelism which uses more memory
sed -i "s/org.gradle.jvmargs=/org.gradle.jvmargs=-Xmx8g /" gradle.properties
# This workflow analyzes release branches but does not build or publish release artifacts.
- name: Set up Gradle # zizmor: ignore[cache-poisoning]
if: matrix.language == 'java'
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
with:
cache-read-only: ${{ github.event_name == 'pull_request' }}
- name: Initialize CodeQL
uses: github/codeql-action/init@99df26d4f13ea111d4ec1a7dddef6063f76b97e9 # v4.37.0
with:
languages: ${{ matrix.language }}
# using "linked" helps to keep up with the linked Kotlin support
# see https://github.com/github/codeql-action/issues/1555#issuecomment-1452228433
tools: linked
- name: Assemble
if: matrix.language == 'java'
# --no-build-cache is required for codeql to analyze all modules
# --no-daemon is required for codeql to observe the compilation
# (see https://docs.github.com/en/code-security/codeql-cli/getting-started-with-the-codeql-cli/preparing-your-code-for-codeql-analysis#specifying-build-commands)
run: >
./gradlew assemble -x javadoc
--no-build-cache --no-daemon
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@99df26d4f13ea111d4ec1a7dddef6063f76b97e9 # v4.37.0
with:
category: "/language:${{matrix.language}}"
workflow-notification:
permissions:
issues: write
needs:
- analyze
if: always() && github.event_name == 'schedule'
uses: open-telemetry/shared-workflows/.github/workflows/workflow-failure-issue.yml@62d5939b47144252763c5ff9fffe8c20d76cd806 # v0.4.0
with:
success: ${{ needs.analyze.result == 'success' }}