-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (48 loc) · 2.21 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v3
- name: Git branch name
id: git-branch-name
uses: EthanSK/git-branch-name-action@v1
- name: Echo the branch name
run: echo "Branch name ${GIT_BRANCH_NAME}"
- name: Create Maven settings
uses: whelk-io/maven-settings-xml-action@v20
with:
plugin_repositories: '[{ "id": "hello2morrow-repository", "url": "https://maven.hello2morrow.com/repository" }]'
# Build and test
- name: Build
run: mvn clean package
# Create Sonargraph XML report
- name: Sonargraph Report
run: mvn compile com.hello2morrow:sonargraph-maven-plugin:12.2.0:dynamic-report -Dsonargraph.autoUpdate=true -Dsonargraph.activationCode=1E05-733B-3BCD-E9A7 -Dsonargraph.reportFormat=xml -Dsonargraph.reportFileName=${{env.GIT_BRANCH_NAME}}
- name: List reports
run: ls -l target/sonargraph
- name: Download metric extractor
run: wget https://github.com/sonargraph/metric-extractor/releases/download/1.0/MetricExtractor-1.0-jar-with-dependencies.jar
- name: Extract metrics from XML report
run: java -jar MetricExtractor-1.0-jar-with-dependencies.jar target/sonargraph/${{env.GIT_BRANCH_NAME}}.xml
- name: Publish json metrics file
uses: actions/upload-artifact@v3
with:
name: ${{env.GIT_BRANCH_NAME}}-metrics.json
path: target/sonargraph/${{env.GIT_BRANCH_NAME}}.json