-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (79 loc) · 2.73 KB
/
maven-releasePlan1brnch.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
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Backend CI (Prototype)
# This workflow is triggered when there are push changes to the Java source code
on:
push:
branches:
- releasePlan1
paths:
- '**.java'
# Set the default directory to the back-end code at the backend folder
defaults:
run:
working-directory: src/backend/prototypeIOT
# Workflow Jobs
jobs:
# Boolean flag output of file changes under the prototypeIOT folder
DirectoryCheck:
name: Check files
outputs:
executeCI: ${{ steps.javaChanges.outputs.executeCI }}
# Test on latest Ubuntu container
runs-on: ubuntu-latest
# Perform the following
steps:
# Checkout the git
- uses: actions/checkout@v2
with:
fetch-depth: 2
# Change if there any changes to the PrototypeIOT folder
- name: Check for changes under PrototypeIOT
id: javaChanges
run: |
git diff --name-only HEAD^ HEAD > files.txt
while IFS= read -r file
do
echo $file
if [[ $file != src/backend/prototypeIOT/* ]]; then
echo "::set-output name=executeCI::false"
break
else
echo "::set-output name=executeCI::true"
fi
done < files.txt
# JavaCI Workflow
JavaCIWorkflow:
name: JavaCI testing
needs: DirectoryCheck
if: needs.DirectoryCheck.outputs.executeCI == 'true'
runs-on: ubuntu-latest
env:
working-directory: src/backend/prototypeIOT
steps:
# Checkout the git
- uses: actions/checkout@v2
# Setup the JDK dev environment with JDK 17
- name: Set up JDK 1.17
uses: actions/setup-java@v2
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
cache: maven # Cache maven packages for future builds
# Test the application using maven
#- name: Run JUnit testing with Maven
# run: mvn -B test --file pom.xml
# working-directory: ${{env.working-directory}}
# Test the application using the Codecoverage maven profile
- name: Run JUnit test (with coverage profile)
run: mvn -B verify -P coverage --no-transfer-progress
# Perform code coverage analysis with Codecov
- name: Upload code coverage report to Codecov
uses: codecov/codecov-action@v1
with:
file: ./**/target/site/jacoco/jacoco.xml
name: codecov
# Build the application package using maven
- name: Build with Maven
run: mvn -B package --file pom.xml
working-directory: ${{env.working-directory}}