Maven Matrix Build #1040
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: [ 8, 11, 17, 18, 19, 20 ] | |
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@v3 | |
with: | |
distribution: zulu | |
java-version: ${{ matrix.java }} | |
- name: Build and test with Maven | |
run: $MVN_CMD install | |
build-with-es: | |
strategy: | |
matrix: | |
elasticsearchVersion: [ "8.6.2", "8.5.3", "8.4.3", "8.3.3", "8.2.3", "8.1.3", "8.0.1", "7.17.9", "7.16.3", "7.15.2", "7.14.2", | |
"7.13.4", "7.12.1", "7.11.2", "7.10.2", "7.9.3", "7.8.1", "7.7.1", "7.6.2", "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@v3 | |
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@v3 | |
# 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 | |
build-with-macos: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v3 | |
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@v5 | |
with: | |
gpg_private_key: ${{ secrets.GPG_SECRET_KEYS }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- name: Set up JDK 8 | |
# with JDK 11 the maven-javadoc-plugin > 3.0.1 fails with "cannot find symbol org.elasticsearch.*" | |
uses: actions/setup-java@v3 | |
with: | |
distribution: zulu | |
java-version: 8 | |
- 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, build-with-macos ] | |
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@v5 | |
with: | |
gpg_private_key: ${{ secrets.GPG_SECRET_KEYS }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- name: Set up JDK 8 | |
# with JDK 11 the maven-javadoc-plugin > 3.0.1 fails with "cannot find symbol org.elasticsearch.*" | |
uses: actions/setup-java@v3 | |
with: | |
distribution: zulu | |
java-version: 8 | |
- 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 |