-
Notifications
You must be signed in to change notification settings - Fork 59
114 lines (112 loc) · 3.93 KB
/
ci-pr.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: CI PRs
on:
pull_request:
branches:
- 'main'
- '1.1.x'
- '1.0.x'
paths-ignore:
- '.github/**'
jobs:
prerequisites:
name: Pre-requisites for building
runs-on: ubuntu-latest
if: github.repository == 'spring-projects/spring-pulsar'
outputs:
runjobs: ${{ steps.continue.outputs.runjobs }}
project_version: ${{ steps.continue.outputs.project_version }}
boot_version: ${{ steps.continue.outputs.boot_version }}
steps:
- uses: actions/checkout@v4
- id: continue
name: Determine if should continue
run: |
# Run jobs if in upstream repository
echo "runjobs=true" >>$GITHUB_OUTPUT
# Extract version from gradle.properties
version=$(cat gradle.properties | grep "version=" | awk -F'=' '{print $2}')
echo "project_version=$version" >>$GITHUB_OUTPUT
bootVersion=$(cat gradle/libs.versions.toml | grep "spring-boot = \"" | cut -d '"' -f2)
echo "boot_version=$bootVersion" >>$GITHUB_OUTPUT
build_and_verify:
name: Build and Verify
needs: [prerequisites]
runs-on: ubuntu-latest
if: needs.prerequisites.outputs.runjobs
steps:
- uses: actions/checkout@v4
- uses: spring-io/spring-gradle-build-action@v2
- name: Check format (short circuit)
run: |
./gradlew checkFormat
- name: Build and run unit tests
run: |
./gradlew clean build -x integrationTest --continue --scan
- name: Upload Test Results
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-results
path: '*/build/reports/tests/**/*.*'
retention-days: 3
- name: Create Aggregated Jacoco Report
run: |
./gradlew aggregateJacocoTestReport --info
- name: Verify Code Coverage
run: |
./gradlew jacocoTestCoverageVerification --info
- name: Upload Aggregated Jacoco Report
if: failure() || contains(github.event.pull_request.labels.*.name, 'ci/upload-jacoco')
uses: actions/upload-artifact@v4
with:
name: jacoco-results
path: 'build/reports/jacoco/**/*.*'
retention-days: 3
integration_tests:
needs: [prerequisites, build_and_verify]
runs-on: ubuntu-latest
if: needs.prerequisites.outputs.runjobs
steps:
- uses: actions/checkout@v4
- uses: spring-io/spring-gradle-build-action@v2
- name: Run integration tests
run: |
./gradlew integrationTest --rerun-tasks -DdownloadRabbitConnector=true --scan
- name: Capture Test Results
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-results
path: '*/build/reports/tests/**/*.*'
retention-days: 3
check_samples:
needs: [prerequisites, build_and_verify]
strategy:
matrix:
springBootVersion: [ "${{ needs.prerequisites.outputs.boot_version }}" ]
runs-on: ubuntu-latest
if: needs.prerequisites.outputs.runjobs
steps:
- uses: actions/checkout@v4
- uses: spring-io/spring-gradle-build-action@v2
- name: Run all sample app tests
env:
LOCAL_REPOSITORY_PATH: ${{ github.workspace }}/build/publications/repos
VERSION: ${{ needs.prerequisites.outputs.project_version }}
BOOT_VERSION: ${{ matrix.springBootVersion }}
run: |
./gradlew publishMavenJavaPublicationToLocalRepository
./gradlew \
--init-script ./spring-pulsar-sample-apps/sample-apps-check-ci.gradle \
-PlocalRepositoryPath="$LOCAL_REPOSITORY_PATH" \
-PspringPulsarVersion="$VERSION" \
-PspringBootVersion="$BOOT_VERSION" \
-PsampleTests \
:runAllSampleTests
done:
runs-on: ubuntu-latest
needs: [ build_and_verify, check_samples ]
steps:
- name: 'Done'
shell: bash
run: echo "::info ::Done"