-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (51 loc) · 2.03 KB
/
12-backend-jacoco.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
# 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: "12-backend-jacoco: Java Test Coverage (Jacoco)"
on:
workflow_dispatch:
pull_request:
paths: [src/**, pom.xml, lombok.config]
push:
branches: [ main ]
paths: [src/**, pom.xml, lombok.config]
jobs:
build-jacoco-report:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3.5.2
- name: Set up Java (version from .java-version file)
uses: actions/setup-java@v3
with:
distribution: semeru # See: https://github.com/actions/setup-java#supported-distributions
java-version-file: ./.java-version
- name: Build with Maven
env:
TEST_PROPERTIES: ${{ secrets.TEST_PROPERTIES }}
run: mvn -B test jacoco:report verify
- name: Get PR number
id: get-pr-num
run: |
echo "GITHUB_EVENT_PATH=${GITHUB_EVENT_PATH}"
pr_number=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
echo "pr_number=${pr_number}"
echo "pr_number=${pr_number}" >> "$GITHUB_ENV"
- name: Set path for github pages deploy when there is a PR num
if: ${{ env.pr_number != 'null' }}
run: |
prefix="prs/${pr_number}/"
echo "prefix=${prefix}"
echo "prefix=${prefix}" >> "$GITHUB_ENV"
- name: Set path for github pages deploy when there is NOT a PR num
if: ${{ env.pr_number == 'null' }}
run: |
prefix=""
echo "prefix=${prefix}"
echo "prefix=${prefix}" >> "$GITHUB_ENV"
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: target/site/jacoco # The folder where mvn puts the files
clean: true # Automatically remove deleted files from the deploy branch
target-folder: ${{env.prefix}}jacoco # The folder that we serve our files from