-
Notifications
You must be signed in to change notification settings - Fork 3
122 lines (103 loc) · 3.76 KB
/
analyze.yaml
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# This workflow containts jobs for analyzing code
name: Code Analysis
on: push
# All jobs are run in parallel
jobs:
sonarcloud:
name: SonarCloud Analyze
runs-on: ubuntu-latest
# for local run -- $ act -j build -P ubuntu-latest=nektos/act-environments-ubuntu:18.04
steps:
# Clone repository with all branches and tags into GitHub virtual machine
- uses: actions/checkout@v4
with:
fetch-depth: 0
# see https://github.com/actions/setup-java
# Download and Install specific JDK version
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
# for act caching download https://static.azul.com/zulu/bin/zulu11.43.21-ca-jdk11.0.9-linux_x64.tar.gz
# to root workdir an uncomment
# jdkFile: zulu11.43.21-ca-jdk11.0.9-linux_x64.tar.gz
# Load packages from cache if present
# see https://github.com/actions/cache
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
# Build project, run tests and send to SonarCloud for analysis
- name: Analyze with SonarCloud
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
mvn -B verify -Dmaven.javadoc.skip --no-transfer-progress sonar:sonar \
-Dsonar.projectKey=kghackers_kgparser \
-Dsonar.organization=kghackers \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.login=$SONAR_TOKEN
# Send notification about job outcome into KG Parser CI/CD telegram group
- name: Notify Telegram
uses: yanzay/[email protected]
if: always()
with:
chat: ${{ secrets.TGBOT_CHAT }}
token: ${{ secrets.TGBOT_TOKEN }}
status: ${{ job.status }}
# CodeQL analyzes JS code in repository
codeql_js:
name: CodeQL Analyze JS
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
config-file: ./.github/codeql/js-config.yml
languages: javascript
queries: security-and-quality
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
# CodeQL analyzes Java code in repository
codeql_java:
name: CodeQL Analyze Java
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# exclude html directory from java analysis
- name: Remove HTML directory
run: rm -rf html
# Download and Install specific JDK version
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
# for act caching download https://static.azul.com/zulu/bin/zulu11.43.21-ca-jdk11.0.9-linux_x64.tar.gz
# to root workdir uncomment
# jdkFile: zulu11.43.21-ca-jdk11.0.9-linux_x64.tar.gz
# Load packages from cache if present
# see https://github.com/actions/cache
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: java
queries: security-and-quality
# Automatically builds project with maven
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3