-
Notifications
You must be signed in to change notification settings - Fork 14
188 lines (178 loc) · 7.06 KB
/
maven-matrix.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
name: Maven Matrix Build
on:
push:
branches:
- master
- release
paths-ignore:
- '*.md'
# pull_request to run the pipeline on PRs from external, because "push" does not create this pipeline on external PRs
pull_request:
paths-ignore:
- '*.md'
schedule:
# * is a special character in YAML, so you have to quote this string
- cron: '11 16 * * 4'
env:
MVN_CMD: "./mvnw --settings .cicd.settings.xml -e -B -V"
GPG_EXECUTABLE: gpg
jobs:
build-with-jdk:
strategy:
matrix:
java: [ 17, 21 ]
fail-fast: false
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ matrix.java }}
- name: Build and test with Maven
run: $MVN_CMD install
build-with-es:
strategy:
matrix:
elasticsearchVersion: [ "8.13.4", "8.12.2", "8.11.4", "8.10.4", "8.9.2", "8.8.2", "8.7.1", "8.6.2", "8.5.3", "8.4.3", "8.3.3", "8.2.3", "8.1.3", "8.0.1",
"7.17.21", "7.5.2" ]
fail-fast: false
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
- name: Build and test with Maven
run: $MVN_CMD install -DskipTests
- name: elasticsearch test version ${{ matrix.elasticsearchVersion }}
run: $MVN_CMD --file ./tests/pom.xml clean verify -Delasticsearch.version=${{ matrix.elasticsearchVersion }}
## on github actions Linux containers (LCOW) are not supported:
## https://stackoverflow.com/questions/66077884/testcontainers-in-windows-environment-on-github-actions-could-not-find-a-valid
## https://github.com/actions/runner-images/issues/252
## https://github.com/actions/runner-images/issues/2216
# build-with-windows:
# runs-on: windows-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Set up JDK 8
# uses: actions/setup-java@v4
# with:
# distribution: zulu
# ja# - name: Set up Docker
# uses: crazy-max/ghaction-setup-docker@v1
# with:
# version: 23.0.1va-version: 8
# - name: Build and test with Maven
# run: .\mvnw.cmd --settings .cicd.settings.xml -e -B -V install
# macos builds are very flaky :/
# build-with-macos:
# runs-on: macos-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Set up JDK 8
# uses: actions/setup-java@v4
# with:
# distribution: zulu
# java-version: 8
# - name: Install Docker
# # docker is not installed by default https://github.com/actions/runner-images/issues/17
# uses: docker-practice/actions-setup-docker@master
# timeout-minutes: 12
# - name: Build and test with Maven
# run: $MVN_CMD install
release-dry-run:
# this will just build like the real release job, but not do a release (dry run)
if: ${{ github.ref != 'refs/heads/release' }}
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Import GPG key to sign maven build artifacts
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_SECRET_KEYS }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Set up JDK 17
# with JDK 11 the maven-javadoc-plugin > 3.0.1 fails with "cannot find symbol org.elasticsearch.*"
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
- name: Release to maven central
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
run: $MVN_CMD deploy -DskipTests=true -Drelease -Dmaven.deploy.skip=true -DskipNexusStagingDeployMojo=true
- name: prepare release version
run: source prepare_release_version.sh
release:
# Release to maven central and create Github release
needs: [ build-with-jdk, build-with-es ]
if: ${{ github.repository == 'senacor/elasticsearch-evolution' && github.event_name == 'push' && github.ref == 'refs/heads/release' }}
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Import GPG key to sign maven build artifacts
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_SECRET_KEYS }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Set up JDK 17
# with JDK 11 the maven-javadoc-plugin > 3.0.1 fails with "cannot find symbol org.elasticsearch.*"
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
- name: Release to maven central
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
run: $MVN_CMD deploy -DskipTests=true -Drelease
- name: prepare release version
run: source prepare_release_version.sh
- name: Create Github Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ env.TRAVIS_TAG }}
release_name: ${{ env.PROJECT_VERSION }}
body: ""
draft: false
prerelease: ${{ env.IS_SNAPSHOT }}
- name: Upload Release Asset spring-boot-starter-elasticsearch-evolution
id: upload-release-asset-spring-boot-starter-elasticsearch-evolution
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./spring-boot-starter-elasticsearch-evolution/target/spring-boot-starter-elasticsearch-evolution-${{ env.PROJECT_VERSION }}.jar
asset_name: spring-boot-starter-elasticsearch-evolution-${{ env.PROJECT_VERSION }}.jar
asset_content_type: application/java-archive
- name: Upload Release Asset elasticsearch-evolution-core
id: upload-release-asset-elasticsearch-evolution-core
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./elasticsearch-evolution-core/target/elasticsearch-evolution-core-${{ env.PROJECT_VERSION }}.jar
asset_name: elasticsearch-evolution-core-${{ env.PROJECT_VERSION }}.jar
asset_content_type: application/java-archive