forked from usdot-jpo-ode/jpo-security-svcs
-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (85 loc) · 3.01 KB
/
ci.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
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
name: CI
on:
pull_request:
types: [opened, reopened, synchronize]
push:
branches: [develop, master]
jobs:
jpo-security-svcs:
runs-on: ubuntu-latest
container:
image: openjdk:21-jdk-slim-buster
options: --user root
steps:
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@v4
- name: Set up Maven
uses: stCarolas/setup-maven@v4.5
with:
maven-version: 3.8.2
- name: Build
run: |
cd $GITHUB_WORKSPACE
ls -ls && pwd
mvn -e -X clean org.jacoco:jacoco-maven-plugin:prepare-agent package
mvn -e -X clean org.jacoco:jacoco-maven-plugin:report package
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: jpo-security-svcs
path: /__w/jpo-security-svcs/jpo-security-svcs/target
if-no-files-found: error
tmca-tester:
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@v4
- name: build tmca-tester
uses: actions/setup-node@v4
with:
node-version: '18.x'
- run: |
cd $GITHUB_WORKSPACE/tmca-tester
npm install --force
node ./tmca-tester.js
sonar:
needs: [jpo-security-svcs, tmca-tester]
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download code coverage results
uses: actions/download-artifact@v4
with:
name: jpo-security-svcs
path: home/runner/work/jpo-security-svcs/jpo-security-svcs/target
- name: Find jacoco.xml
shell: bash
run: |
find "$GITHUB_WORKSPACE" -name "jacoco.xml"
- name: Setup SonarScanner
uses: warchant/setup-sonar-scanner@v7
with:
version: 5.0.1.3006
- name: Generate sonar properties file
run: |
cat <<EOF > /tmp/sonar-scanner.properties
sonar.host.url=https://sonarcloud.io
sonar.coverage.jacoco.xmlReportPaths=$GITHUB_WORKSPACE/tmca-tester/target/site/jacoco/jacoco.xml
sonar.java.binaries=home/runner/work/jpo-security-svcs/jpo-security-svcs/target
sonar.projectBaseDir=$GITHUB_WORKSPACE
sonar.projectKey=usdot-jpo-ode_jpo-security-svcs
sonar.organization=usdot-jpo-ode
jpo-security-svcs.sonar.projectBaseDir = home/runner/work/jpo-security-svcs/jpo-security-svcs
jpo-security-svcs.sonar.sources = src
tmca-tester.sonar.projectBaseDir=$GITHUB_WORKSPACE /tmca-tester
tmca-tester.sonar.sources=.
EOF
- name: Run SonarScanner
uses: usdot-fhwa-stol/actions/sonar-scanner@main
with:
sonar-properties-path: /tmp/sonar-scanner.properties
sonar-token: ${{ secrets.SONAR_TOKEN }}
working-dir: $GITHUB_WORKSPACE