-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (50 loc) · 1.91 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
54
55
56
57
58
59
60
61
62
name: Build + Test + Sonar
on: [push, workflow_dispatch]
permissions:
contents: read
jobs:
build_and_test:
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.ZOWE_ROBOT_TOKEN }}
- uses: ./.github/actions/setup
- name: Build with Gradle
run: ./gradlew build
- name: Prepare lib Artifact
id: artifact
shell: bash
run: |
cd ${{ github.workspace }}/build/libs
FILENAME=`ls | grep -vE '(-javadoc|-sources)\.jar$'`
echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
echo "zip artifact name:"
echo "$FILENAME"
- name: Publish built lib to artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.artifact.outputs.filename }}
path: ./build/libs/*
- name: Test with Gradle
run: ./gradlew test
- name: Publish tests result to artifacts
uses: actions/upload-artifact@v4
with:
name: tests-report-${{ steps.artifact.outputs.filename }}
path: ${{ github.workspace }}/build/reports/*
- name: Publish results to SonarCloud
run: >
./gradlew --info sonar -Dresults="build/reports/tests/test,build/test-results"
-Psonar.host.url=$SONAR_HOST_URL -Dsonar.token=$SONAR_TOKEN
-Partifactory_user=$ARTIFACTORY_USERNAME -Partifactory_password=$ARTIFACTORY_PASSWORD
-Dsonar.coverage.jacoco.xmlReportPaths="build/reports/jacoco.xml"
env:
ARTIFACTORY_USE RNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/teardown