-
Notifications
You must be signed in to change notification settings - Fork 78
145 lines (122 loc) · 4 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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Build
on:
push:
branches:
- "*"
pull_request:
branches:
- main
env:
JAVA_VERSION: 21
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build with Gradle
run: ./gradlew build publishToMavenLocal --build-cache
- name: Build custom rules example
run: ./gradlew build -p plsql-custom-rules
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: '**/build/'
retention-days: 1
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: gradle-cache
path: '~/.gradle/cache/'
retention-days: 1
integration-tests:
name: IT
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sqVersion:
- LATEST_RELEASE[9.9]
- LATEST_RELEASE[10.5]
- 10.6-SNAPSHOT
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: '~/.gradle/cache/'
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: gradle-cache
- if: ${{ !contains(matrix.sqVersion, 'SNAPSHOT') }}
name: Run integration test
run: ./gradlew integrationTest -Dsonar.runtimeVersion=${{ matrix.sqVersion }}
#
- if: ${{ contains(matrix.sqVersion, 'SNAPSHOT') }}
name: Run integration test
run: |
curl -s -L "https://nexus.felipezorzo.com.br/service/rest/v1/search/assets/download?repository=maven-snapshots&maven.groupId=org.sonarsource.sonarqube&maven.artifactId=sonar-application&maven.extension=zip&sort=version&maven.baseVersion=${{ matrix.sqVersion }}" \
-u "$AUTH_REPOSITORY" \
-o sonar-zpa-plugin/sonar-application-${{ matrix.sqVersion }}.zip
./gradlew integrationTest -Dsonar.zipFile=sonar-application-${{ matrix.sqVersion }}.zip
env:
AUTH_REPOSITORY: ${{ secrets.AUTH_REPOSITORY }}
release:
name: Release
needs: integration-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- if: github.ref == 'refs/heads/main'
name: Run SonarQube Scanner
run: ./gradlew sonar --info
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
- if: github.ref == 'refs/heads/main'
name: Release artifacts
run: ./gradlew publish jreleaserFullRelease
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_SECRET_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_KEY_PASSWORD }}
dependency-submission:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v3