Skip to content

Improve tests [DI-337] #1335

Improve tests [DI-337]

Improve tests [DI-337] #1335

name: Publish Hazelcast OS & EE packages
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
types: [ opened, synchronize, edited ]
workflow_dispatch:
inputs:
HZ_VERSION:
description: 'Version of Hazelcast to build the packages from, this is the Maven version - e.g.: 5.0.2 or 5.1-SNAPSHOT'
required: true
PACKAGE_TYPES:
description: 'Packages to build'
required: true
default: 'all'
type: choice
options:
- all
- deb
- rpm
- homebrew
RELEASE_TYPE:
description: 'Which editions should be built'
required: true
default: 'EE'
type: choice
options:
- ALL
- OSS
- EE
env:
EVENT_NAME: ${{ github.event_name }}
RELEASE_TYPE_FILE: .github/release_type
concurrency:
group: '${{ github.workflow }}-${{ github.base_ref || github.ref_name}}'
jobs:
prepare:
runs-on: ubuntu-latest
env:
RELEASE_TYPE: ${{ inputs.RELEASE_TYPE || 'EE' }}
PACKAGE_TYPES: ${{ inputs.PACKAGE_TYPES || 'all' }}
HZ_VERSION: ${{ github.event.inputs.HZ_VERSION }}
outputs:
hz_version: ${{ steps.hz_version_step.outputs.hz_version }}
should_build_oss: ${{ steps.which_editions.outputs.should_build_oss }}
should_build_ee: ${{ steps.which_editions.outputs.should_build_ee }}
should_build_deb: ${{ env.PACKAGE_TYPES == 'all' || env.PACKAGE_TYPES == 'deb' }}
should_build_rpm: ${{ env.PACKAGE_TYPES == 'all' || env.PACKAGE_TYPES == 'rpm' }}
should_build_homebrew: ${{ env.PACKAGE_TYPES == 'all' || env.PACKAGE_TYPES == 'homebrew' }}
use_test_repo: ${{ env.EVENT_NAME == 'pull_request' }}
steps:
- name: Checkout hazelcast-packaging repo
uses: actions/checkout@v4
- name: Load env vars from .env file
run: cat .env >> $GITHUB_ENV
- name: Test scripts
run: |
./test_scripts.sh
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRIBUTION }}
- name: Set HZ_VERSION
id: hz_version_step
run: |
if [ -z "${{ env.HZ_VERSION }}" ]; then
HZ_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
fi
echo "hz_version=$HZ_VERSION" >> $GITHUB_OUTPUT
- name: Forbid ${{ env.RELEASE_TYPE_FILE }} file in the PRs
if: github.event_name == 'pull_request'
run: |
if [ -f "${{ env.RELEASE_TYPE_FILE }}" ]; then
echo "Error: ${{ env.RELEASE_TYPE_FILE }} file is not allowed in the PRs. It's used only during release creation"
exit 1
fi
- name: Read release type from the file
run: |
if [ -f ${{ env.RELEASE_TYPE_FILE }} ]; then
echo "RELEASE_TYPE=$(cat ${{ env.RELEASE_TYPE_FILE }})" >> $GITHUB_ENV
else
echo "File '${{ env.RELEASE_TYPE_FILE }}' does not exist."
fi
- name: Check which editions should be built
id: which_editions
run: |
. .github/workflows/build.functions.sh
release_type=${{ env.RELEASE_TYPE }}
triggered_by=${{ github.event_name }}
should_build_oss=$(should_build_oss "$triggered_by" "$release_type")
should_build_ee=$(should_build_ee "$triggered_by" "$release_type")
echo "should_build_ee=${should_build_ee}" >> $GITHUB_OUTPUT
echo "should_build_oss=${should_build_oss}" >> $GITHUB_OUTPUT
deb-ee:
if: needs.prepare.outputs.should_build_deb == 'true' && needs.prepare.outputs.should_build_ee == 'yes'
needs: [prepare]
uses: ./.github/workflows/publish-deb-package.yml
secrets: inherit
with:
HZ_VERSION: ${{ needs.prepare.outputs.hz_version }}
HZ_DISTRIBUTION: hazelcast-enterprise
USE_TEST_REPO: ${{ needs.prepare.outputs.use_test_repo }}
deb-oss:
needs: [ prepare ]
if: needs.prepare.outputs.should_build_deb == 'true' && needs.prepare.outputs.should_build_oss == 'yes'
uses: ./.github/workflows/publish-deb-package.yml
secrets: inherit
with:
HZ_VERSION: ${{ needs.prepare.outputs.hz_version }}
HZ_DISTRIBUTION: hazelcast
USE_TEST_REPO: ${{ needs.prepare.outputs.use_test_repo }}
rpm-ee:
if: needs.prepare.outputs.should_build_rpm == 'true' && needs.prepare.outputs.should_build_ee == 'yes'
needs: [prepare]
uses: ./.github/workflows/publish-rpm-package.yml
secrets: inherit
with:
HZ_VERSION: ${{ needs.prepare.outputs.hz_version }}
HZ_DISTRIBUTION: hazelcast-enterprise
USE_TEST_REPO: ${{ needs.prepare.outputs.use_test_repo }}
rpm-oss:
needs: [ prepare ]
if: needs.prepare.outputs.should_build_rpm == 'true' && needs.prepare.outputs.should_build_oss == 'yes'
uses: ./.github/workflows/publish-rpm-package.yml
secrets: inherit
with:
HZ_VERSION: ${{ needs.prepare.outputs.hz_version }}
HZ_DISTRIBUTION: hazelcast
USE_TEST_REPO: ${{ needs.prepare.outputs.use_test_repo }}
brew-ee:
if: needs.prepare.outputs.should_build_homebrew == 'true' && needs.prepare.outputs.should_build_ee == 'yes'
needs: [prepare]
uses: ./.github/workflows/publish-brew-package.yml
secrets: inherit
with:
HZ_VERSION: ${{ needs.prepare.outputs.hz_version }}
HZ_DISTRIBUTION: hazelcast-enterprise
USE_TEST_REPO: ${{ needs.prepare.outputs.use_test_repo }}
brew-oss:
needs: [ prepare ]
if: needs.prepare.outputs.should_build_homebrew == 'true' && needs.prepare.outputs.should_build_oss == 'yes' && !contains(needs.prepare.outputs.hz_version, 'SNAPSHOT')
uses: ./.github/workflows/publish-brew-package.yml
secrets: inherit
with:
HZ_VERSION: ${{ needs.prepare.outputs.hz_version }}
HZ_DISTRIBUTION: hazelcast
USE_TEST_REPO: ${{ needs.prepare.outputs.use_test_repo }}