-
Notifications
You must be signed in to change notification settings - Fork 53
67 lines (60 loc) · 2.5 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
name: jbehave-junit-runner CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 8, 11, 17, 20 ]
name: Java ${{ matrix.java }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Build with Maven
run: mvn clean verify
- name: Publish test coverage data to Coveralls
if: matrix.java == '17'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
BRANCH_NAME_OR_REF: ${{ github.head_ref || github.ref }}
run: |
if [[ -n $COVERALLS_REPO_TOKEN ]]; then
mvn coveralls:report -DrepoToken=${COVERALLS_REPO_TOKEN} -D branch=${BRANCH_NAME_OR_REF} -DpullRequest=${{github.event.pull_request.number}};
else
echo No COVERALLS_REPO_TOKEN, the test coverage publishing to Coveralls is skipped;
fi;
- name: Analyze with Codacy
if: matrix.java == '11'
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
CODACY_API_TOKEN: ${{ secrets.CODACY_API_TOKEN }}
run: |
if [[ -n $CODACY_PROJECT_TOKEN && -n $CODACY_API_TOKEN ]]; then
mvn com.gavinmogan:codacy-maven-plugin:coverage -DcoverageReportFile=target/site/jacoco/jacoco.xml -DprojectToken=${CODACY_PROJECT_TOKEN} -DapiToken=${CODACY_API_TOKEN} -Dcommit=${GITHUB_SHA};
else
echo No CODACY_PROJECT_TOKEN and/or CODACY_API_TOKEN, the publishing to Codacy is skipped;
fi;
- name: Anazlyze with SonarCloud
if: matrix.java == '17'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
if [[ -n $GITHUB_TOKEN && -n $SONAR_TOKEN ]]; then
mvn sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=valfirst-github -Dsonar.projectKey=com.github.valfirst:jbehave-junit-runner -Dsonar.token=${SONAR_TOKEN} -Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} -Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }} -Dsonar.pullrequest.key=${{github.event.pull_request.number}};
else
echo No GITHUB_TOKEN and/or SONAR_TOKEN, the publishing to SonarCloud is skipped;
fi;