Skip to content

Commit d722884

Browse files
authored
Create build.yml for Github Action
1 parent 8f6b34d commit d722884

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/build.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
9+
jobs:
10+
build:
11+
name: Build
12+
runs-on: ubuntu-latest
13+
permissions: read-all
14+
steps:
15+
- uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
18+
- name: Set up JDK 17
19+
uses: actions/setup-java@v1
20+
with:
21+
java-version: 17
22+
- name: Cache SonarQube packages
23+
uses: actions/cache@v1
24+
with:
25+
path: ~/.sonar/cache
26+
key: ${{ runner.os }}-sonar
27+
restore-keys: ${{ runner.os }}-sonar
28+
- name: Cache Maven packages
29+
uses: actions/cache@v1
30+
with:
31+
path: ~/.m2
32+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
33+
restore-keys: ${{ runner.os }}-m2
34+
- name: Build and analyze
35+
env:
36+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
37+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
38+
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=JavaVulnerableLab -Dsonar.projectName='JavaVulnerableLab'

0 commit comments

Comments
 (0)