-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (33 loc) · 1.15 KB
/
github-actions-build.yml
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
name: Java CI
# Trigger workflow on push or pull_request
# Note - the first pull_request from a forked repo will need to be given approval to run
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Cache Maven Repo
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build Test and Verify
run: mvn -B -U clean install -Dmaven.javadoc.skip=true -Pdisplay-versions
- name: SonarCloud Scan
run: |
if ["$SONAR_TOKEN" == ""]; then
echo "Sonar secure variables NOT available"
else
echo "Sonar secure variables ARE available"
mvn -B sonar:sonar -Dsonar.projectKey="bordertech-webfriends" -Dsonar.organization="bordertech-github" -Dsonar.host.url="https://sonarcloud.io"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}