Skip to content

Merge branch 'master' into 5.6.x #540

Merge branch 'master' into 5.6.x

Merge branch 'master' into 5.6.x #540

name: Run tests, measure coverage and upload results to codecov
on:
workflow_dispatch:
inputs:
pr_number:
description: Enter PR number coming from community to run coverage on it. Do not run for PR coming from hazelcast organization, they will be run automatically.
required: true
push:
branches:
- master
- '[45].*.x'
pull_request_target:
jobs:
check_for_membership:
runs-on: ubuntu-latest
name: Check membership of given user
outputs:
check-result: ${{ steps.composite.outputs.check-result }}
steps:
- name: Action for membership check
id: composite
uses: hazelcast/hazelcast-tpm/membership@main
with:
organization-name: 'hazelcast'
member-name: ${{ github.actor }}
token: ${{ secrets.PAT }}
node-versions:
uses: ./.github/workflows/get-supported-node-versions.yml
run-tests:
name: Run Tests on (${{ matrix.os }})
needs:
- check_for_membership
- node-versions
if: github.event_name == 'push' || needs.check_for_membership.outputs.check-result == 'true' || github.event_name == 'workflow_dispatch'
runs-on: ${{ matrix.os }}
permissions:
id-token: write
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
hz_version: [ "5.6.0" ]
steps:
- name: Checkout code for PR
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- name: Checkout repository for push event
if: github.event_name == 'push'
uses: actions/checkout@v4
- name: Checkout PR coming from community.
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.inputs.pr_number }}/merge
- name: Read Java Config
shell: bash
run: cat .github/java-config.env >> $GITHUB_ENV
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRIBUTION }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ needs.node-versions.outputs.default-version }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v5
with:
role-to-assume: ${{ secrets.AWS_HAZELCAST_OIDC_GITHUB_ACTIONS_ROLE_ARN }}
aws-region: 'us-east-1'
- name: Get Secrets
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
HAZELCAST_ENTERPRISE_KEY,CN/HZ_LICENSE_KEY
- name: Checkout to certificates
uses: actions/checkout@v4
with:
repository: hazelcast/private-test-artifacts
path: certs
ref: data
token: ${{ secrets.GH_TOKEN }}
- name: Copy certificates JAR to destination with the appropriate name
run: |
cp ${{ github.workspace }}/certs/certs.jar ${{ github.workspace }}/certs.jar
unzip -p ${{ github.workspace }}/certs.jar com/hazelcast/nio/ssl/letsencrypt.jks > test/integration/backward_compatible/parallel/ssl/keystore.jks
- name: Create the test jar with certificates (Linux)
if: matrix.os == 'ubuntu-latest'
working-directory: certs
run: |
zip -r -j certs.jar $GITHUB_WORKSPACE/test/integration/backward_compatible/parallel/ssl/*.pem
cp certs.jar ../hazelcast-enterprise-${{ matrix.hz_version }}-tests.jar
- name: Create the test jar with certificates (Windows)
if: matrix.os == 'windows-latest'
working-directory: certs
run: |
$compress = @{
Path = "../test/integration/backward_compatible/parallel/ssl/*.pem"
CompressionLevel = "Fastest"
DestinationPath = "certs.jar"
}
Compress-Archive -Update @compress
cp certs.jar ../hazelcast-enterprise-${{ matrix.hz_version }}-tests.jar
- name: Download RCD (Linux)
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
wget -q https://client-rcd-download.s3.us-east-2.amazonaws.com/rcd-ubuntu-latest
- name: Download RCD (Windows)
if: matrix.os == 'windows-latest'
run: |
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest https://client-rcd-download.s3.us-east-2.amazonaws.com/rcd-windows-latest.exe -OutFile rcd-windows-latest.exe
- name: Install dependencies and compile client
run: |
npm install
npm run compile
- name: Run all tests (Linux)
if: matrix.os == 'ubuntu-latest'
env:
HZ_VERSION: ${{ matrix.hz_version }}
run: |
chmod +x rcd-ubuntu-latest
./rcd-ubuntu-latest -version $HZ_VERSION -no-simple-server &
# wait for a bit for RCD to download artifacts
sleep 10
npm run coverage
- name: Run all tests (Windows)
if: matrix.os == 'windows-latest'
env:
HZ_VERSION: ${{ matrix.hz_version }}
run: |
Start-Process -FilePath .\rcd-windows-latest -ArgumentList '-version', $Env:HZ_VERSION, '-no-simple-server' -RedirectStandardOutput rcd-stdout.log -RedirectStandardError rcd-stderr.log
# wait for a bit for RCD to download artifacts
sleep 10
echo "RCD Log:"
cat rcd-stdout.log
cat rcd-stderr.log
npm run coverage
- name: Publish results to Codecov for PR coming from hazelcast organization
if: ${{ matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request_target' }}
uses: codecov/codecov-action@v5
with:
use_oidc: true
files: coverage/lcov.info
override_pr: ${{ github.event.pull_request.number }}
fail_ci_if_error: true
- name: Publish results to Codecov for Push
if: ${{ matrix.os == 'ubuntu-latest' && github.event_name == 'push' }}
uses: codecov/codecov-action@v5
with:
use_oidc: true
files: coverage/lcov.info
fail_ci_if_error: true
- name: Publish result to Codecov for PR coming from community
if: ${{ matrix.os == 'ubuntu-latest' && github.event_name == 'workflow_dispatch' }}
uses: codecov/codecov-action@v5
with:
use_oidc: true
files: coverage/lcov.info
override_pr: ${{ github.event.inputs.pr_number }}
fail_ci_if_error: true