Test JDK version as part of PR builder [DI-317] [5.4.z] #754
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: Build PR | |
on: | |
workflow_dispatch: | |
pull_request: | |
env: | |
test_container_name_oss: hazelcast-oss-test | |
test_container_name_ee: hazelcast-ee-test | |
docker_log_file_oss: docker-hazelcast-oss-test.log | |
docker_log_file_ee: docker-hazelcast-ee-test.log | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
name: Prepare environment | |
outputs: | |
HZ_VERSION_OSS: ${{ steps.get_oss_vars.outputs.HZ_VERSION_OSS }} | |
HZ_VERSION_EE: ${{ steps.get_ee_vars.outputs.HZ_VERSION_EE }} | |
HAZELCAST_EE_ZIP_URL: ${{ steps.get_ee_vars.outputs.HAZELCAST_EE_ZIP_URL }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Forbid .github/release_type file | |
run: | | |
if [ -f ".github/release_type" ]; then | |
echo "Error: .github/release_type file is not allowed in the PRs. It's used only during release creation" | |
exit 1 | |
fi | |
- name: Install xmllint | |
uses: ./.github/actions/install-xmllint | |
- name: Test scripts | |
run: | | |
.github/scripts/test_scripts.sh | |
- name: Setup OSS variables | |
id: get_oss_vars | |
run: | | |
HZ_VERSION_OSS=$(awk -F '=' '/^ARG HZ_VERSION=/ {print $2}' hazelcast-oss/Dockerfile) | |
echo "HZ_VERSION_OSS=$HZ_VERSION_OSS" >> $GITHUB_OUTPUT | |
- name: Setup EE variables | |
id: get_ee_vars | |
run: | | |
HZ_VERSION_EE=$(awk -F '=' '/^ARG HZ_VERSION=/ {print $2}' hazelcast-enterprise/Dockerfile) | |
. .github/scripts/ee-build.functions.sh | |
echo "HZ_VERSION_EE=$HZ_VERSION_EE" >> $GITHUB_OUTPUT | |
echo "HAZELCAST_EE_ZIP_URL=$(get_hz_dist_zip "" ${HZ_VERSION_EE})" >> $GITHUB_OUTPUT | |
build-pr: | |
runs-on: ubuntu-latest | |
name: Build with default JDK | |
needs: [ prepare ] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v3 | |
- name: Build OSS image | |
run: | | |
DOCKER_PATH=hazelcast-oss | |
HZ_VERSION="${{ needs.prepare.outputs.HZ_VERSION_OSS }}" | |
# duplicated block as GH doesn't support passing sensitive data between jobs | |
. .github/scripts/oss-build.functions.sh | |
export HZ_SNAPSHOT_INTERNAL_PASSWORD=${{ secrets.HZ_SNAPSHOT_INTERNAL_PASSWORD }} | |
export HZ_SNAPSHOT_INTERNAL_USERNAME=${{ secrets.HZ_SNAPSHOT_INTERNAL_USERNAME }} | |
HAZELCAST_OSS_ZIP_URL=$(get_hz_dist_zip "" "${HZ_VERSION}") | |
curl --fail --silent --show-error --location "$HAZELCAST_OSS_ZIP_URL" --output $DOCKER_PATH/hazelcast-distribution.zip; | |
docker buildx build --load \ | |
--build-arg HZ_VERSION=${HZ_VERSION} \ | |
--tag hazelcast-oss:test \ | |
${DOCKER_PATH} | |
- name: Run smoke test against OSS image | |
timeout-minutes: 2 | |
run: | | |
. .github/scripts/docker.functions.sh | |
.github/scripts/simple-smoke-test.sh hazelcast-oss:test ${{ env.test_container_name_oss }} oss ${{ needs.prepare.outputs.HZ_VERSION_OSS }} "$(get_default_jdk hazelcast-oss)" | |
- name: Build Test EE image | |
run: | | |
DOCKER_PATH=hazelcast-enterprise | |
HZ_VERSION="${{ needs.prepare.outputs.HZ_VERSION_EE }}" | |
curl --fail --silent --show-error --location "${{ needs.prepare.outputs.HAZELCAST_EE_ZIP_URL }}" --output $DOCKER_PATH/hazelcast-enterprise-distribution.zip; | |
docker buildx build --load \ | |
--build-arg HZ_VERSION=${HZ_VERSION} \ | |
--tag hazelcast-ee:test \ | |
${DOCKER_PATH} | |
- name: Run smoke test against EE image | |
timeout-minutes: 2 | |
run: | | |
. .github/scripts/docker.functions.sh | |
export HZ_LICENSEKEY=${{ secrets.HZ_ENTERPRISE_LICENSE }} | |
.github/scripts/simple-smoke-test.sh hazelcast-ee:test ${{ env.test_container_name_ee }} ee ${{ needs.prepare.outputs.HZ_VERSION_EE }} "$(get_default_jdk hazelcast-enterprise)" | |
- name: Get docker logs | |
if: ${{ always() }} | |
run: | | |
docker logs ${{ env.test_container_name_oss }} > ${{ env.docker_log_file_oss }} | |
docker logs ${{ env.test_container_name_ee }} > ${{ env.docker_log_file_ee }} | |
- name: Store docker logs as artifact | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docker-logs | |
path: | | |
${{ env.docker_log_file_oss }} | |
${{ env.docker_log_file_ee }} | |
jdks: | |
uses: ./.github/workflows/get-supported-jdks.yaml | |
build-pr-custom-jdk: | |
runs-on: ubuntu-latest | |
needs: [ jdks, prepare ] | |
name: Build with jdk-${{ matrix.jdk }} | |
strategy: | |
fail-fast: false | |
matrix: | |
jdk: ${{ fromJSON(needs.jdks.outputs.jdks) }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install xmllint | |
uses: ./.github/actions/install-xmllint | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v3 | |
- name: Build OSS image | |
run: | | |
DOCKER_PATH=hazelcast-oss | |
HZ_VERSION="${{ needs.prepare.outputs.HZ_VERSION_OSS }}" | |
# duplicated block as GH doesn't support passing sensitive data between jobs | |
. .github/scripts/oss-build.functions.sh | |
export HZ_SNAPSHOT_INTERNAL_PASSWORD=${{ secrets.HZ_SNAPSHOT_INTERNAL_PASSWORD }} | |
export HZ_SNAPSHOT_INTERNAL_USERNAME=${{ secrets.HZ_SNAPSHOT_INTERNAL_USERNAME }} | |
HAZELCAST_OSS_ZIP_URL=$(get_hz_dist_zip "" "${HZ_VERSION}") | |
curl --fail --silent --show-error --location "$HAZELCAST_OSS_ZIP_URL" --output $DOCKER_PATH/hazelcast-distribution.zip; | |
docker buildx build --load \ | |
--build-arg JDK_VERSION=${{ matrix.jdk }} \ | |
--build-arg HZ_VERSION=${HZ_VERSION} \ | |
--tag hazelcast-oss:test \ | |
${DOCKER_PATH} | |
- name: Run smoke test against OSS image | |
timeout-minutes: 2 | |
run: | | |
.github/scripts/simple-smoke-test.sh hazelcast-oss:test ${{ env.test_container_name_oss }} oss ${{ needs.prepare.outputs.HZ_VERSION_OSS }} ${{ matrix.jdk }} | |
- name: Build Test EE image | |
run: | | |
DOCKER_PATH=hazelcast-enterprise | |
HZ_VERSION="${{ needs.prepare.outputs.HZ_VERSION_EE }}" | |
curl --fail --silent --show-error --location "${{ needs.prepare.outputs.HAZELCAST_EE_ZIP_URL }}" --output $DOCKER_PATH/hazelcast-enterprise-distribution.zip; | |
docker buildx build --load \ | |
--build-arg JDK_VERSION=${{ matrix.jdk }} \ | |
--build-arg HZ_VERSION=${HZ_VERSION} \ | |
--tag hazelcast-ee:test \ | |
${DOCKER_PATH} | |
- name: Run smoke test against EE image | |
timeout-minutes: 2 | |
run: | | |
export HZ_LICENSEKEY=${{ secrets.HZ_ENTERPRISE_LICENSE }} | |
.github/scripts/simple-smoke-test.sh hazelcast-ee:test ${{ env.test_container_name_ee }} ee ${{ needs.prepare.outputs.HZ_VERSION_EE }} ${{ matrix.jdk }} | |
- name: Get docker logs | |
if: ${{ always() }} | |
run: | | |
docker logs ${{ env.test_container_name_oss }} > ${{ env.docker_log_file_oss }} | |
docker logs ${{ env.test_container_name_ee }} > ${{ env.docker_log_file_ee }} | |
- name: Store docker logs as artifact | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docker-logs-jdk${{ matrix.jdk }} | |
path: | | |
${{ env.docker_log_file_oss }} | |
${{ env.docker_log_file_ee }} | |