Skip to content

Commit

Permalink
Merge nightly + PR builder test GitHub Actions (#1243)
Browse files Browse the repository at this point in the history
The nightly and PR builder test actions are largely identical, but
duplicated.

Changes:
- Extract common jobs into shared `composite` workflows
- e.g. a single shared Ubuntu x64 build+test action for PR builder _or_
nightly builds
- Upgrade code coverage in PR builder to use `ubuntu-latest` as used
elsewhere.

Fixes: #1237
  • Loading branch information
JackPGreen authored Sep 18, 2024
1 parent f30f684 commit 952e05e
Show file tree
Hide file tree
Showing 12 changed files with 698 additions and 629 deletions.
64 changes: 64 additions & 0 deletions .github/actions/build-test/macos-x86_64/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build & Test - macOS - x86-64

inputs:
GH_TOKEN:
required: true
BOOST_VERSION:
required: true
WARN_AS_ERR:
required: true
BUILD_TYPE:
required: true
SHARED_LIBS_TOGGLE:
required: true
OPENSSL_TOGGLE:
required: true
RUN_TESTS:
required: true
HAZELCAST_ENTERPRISE_KEY:
required: true
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
HZ_TEST_AWS_INSTANCE_PRIVATE_IP:
required: true

env:
# Not possible to set this as a default
# https://github.com/orgs/community/discussions/46670
shell: bash

runs:
using: composite
steps:
- name: Read Config
shell: ${{ env.shell }}
run: cat .github/config.env >> $GITHUB_ENV

- name: Install Dependencies
shell: ${{ env.shell }}
run: |
sudo ./scripts/install-boost.sh ${{ inputs.BOOST_VERSION }}
brew install [email protected] thrift curl
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRIBUTION }}

- uses: ./.github/actions/build-test/unix
with:
GH_TOKEN: ${{ inputs.GH_TOKEN }}
BOOST_VERSION: ${{ inputs.BOOST_VERSION }}
THRIFT_VERSION: ${{ inputs.THRIFT_VERSION }}
WARN_AS_ERR: ${{ inputs.WARN_AS_ERR }}
BUILD_TYPE: ${{ inputs.BUILD_TYPE }}
SHARED_LIBS_TOGGLE: ${{ inputs.SHARED_LIBS_TOGGLE }}
OPENSSL_TOGGLE: ${{ inputs.OPENSSL_TOGGLE }}
RUN_TESTS: ${{ inputs.RUN_TESTS }}
HAZELCAST_ENTERPRISE_KEY: ${{ inputs.HAZELCAST_ENTERPRISE_KEY }}
AWS_ACCESS_KEY_ID: ${{ inputs.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ inputs.AWS_SECRET_ACCESS_KEY }}
HZ_TEST_AWS_INSTANCE_PRIVATE_IP: ${{ inputs.HZ_TEST_AWS_INSTANCE_PRIVATE_IP }}
110 changes: 110 additions & 0 deletions .github/actions/build-test/ubuntu-i386/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Build & Test - Ubuntu - i386

inputs:
GH_TOKEN:
required: true
BOOST_VERSION:
required: true
THRIFT_VERSION:
required: true
WARN_AS_ERR:
required: true
BUILD_TYPE:
required: true
SHARED_LIBS_TOGGLE:
required: true
OPENSSL_TOGGLE:
required: true
RUN_TESTS:
required: true
HAZELCAST_ENTERPRISE_KEY:
required: true
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
HZ_TEST_AWS_INSTANCE_PRIVATE_IP:
required: true

env:
# Not possible to set this as a default
# https://github.com/orgs/community/discussions/46670
shell: bash

runs:
using: composite
steps:
- name: Read Config
shell: ${{ env.shell }}
run: cat .github/config.env >> $GITHUB_ENV

# Install Java via `apt`, can't use the `setup-java` action on this image
# `setup-java` is written in TypeScript and requires a compatible Node installation
# Newest available version for this image is Node 8, which is too old for any version to run against
# https://github.com/actions/setup-node/issues/922
- name: Install Necessary Packages
shell: ${{ env.shell }}
run: |
apt-get update
apt-get install -y build-essential cmake curl git libssl-dev maven net-tools openjdk-${{ env.JAVA_VERSION }}-jre-headless gdb curl
- name: Make sure the target architecture is 32 bit
shell: ${{ env.shell }}
run: |
echo 'int main() { return sizeof(void*) != 4; }' > test.c
gcc test.c -oa
./a
rm a test.c
# `apt-get` brings in `3.6` which is too old to be compatible with Java 17
- name: Install Maven
shell: ${{ env.shell }}
run: |
install_dir="/opt/maven"
mkdir ${install_dir}
curl \
--fail \
--silent \
--show-error \
--location \
https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/${{ env.MAVEN_VERSION }}/apache-maven-${{ env.MAVEN_VERSION }}-bin.tar.gz |
tar \
--extract \
--gzip \
--strip-components=1 \
--directory ${install_dir}
echo "${install_dir}/bin" >> $GITHUB_PATH
- name: Install Boost
shell: ${{ env.shell }}
run: |
./scripts/install-boost.sh ${{ inputs.BOOST_VERSION }}
- name: Install Thrift
shell: ${{ env.shell }}
run: |
./scripts/install-thrift.sh ${{ inputs.THRIFT_VERSION }}
- name: Configure Resources
if: ${{ inputs.run_tests }}
shell: ${{ env.shell }}
run: |
ulimit -c unlimited
sh -c "echo 'core' > /proc/sys/kernel/core_pattern"
sh -c "echo '1' > /proc/sys/kernel/core_uses_pid"
- uses: ./.github/actions/build-test/unix
with:
GH_TOKEN: ${{ inputs.GH_TOKEN }}
BOOST_VERSION: ${{ inputs.BOOST_VERSION }}
THRIFT_VERSION: ${{ inputs.THRIFT_VERSION }}
WARN_AS_ERR: ${{ inputs.WARN_AS_ERR }}
BUILD_TYPE: ${{ inputs.BUILD_TYPE }}
SHARED_LIBS_TOGGLE: ${{ inputs.SHARED_LIBS_TOGGLE }}
OPENSSL_TOGGLE: ${{ inputs.OPENSSL_TOGGLE }}
RUN_TESTS: ${{ inputs.RUN_TESTS }}
HAZELCAST_ENTERPRISE_KEY: ${{ inputs.HAZELCAST_ENTERPRISE_KEY }}
AWS_ACCESS_KEY_ID: ${{ inputs.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ inputs.AWS_SECRET_ACCESS_KEY }}
HZ_TEST_AWS_INSTANCE_PRIVATE_IP: ${{ inputs.HZ_TEST_AWS_INSTANCE_PRIVATE_IP }}
85 changes: 85 additions & 0 deletions .github/actions/build-test/ubuntu-x86_64/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Build & Test - Ubuntu - x86-64

inputs:
GH_TOKEN:
required: true
BOOST_VERSION:
required: true
THRIFT_VERSION:
required: true
WARN_AS_ERR:
required: true
BUILD_TYPE:
required: true
SHARED_LIBS_TOGGLE:
required: true
OPENSSL_TOGGLE:
required: true
RUN_TESTS:
required: true
HAZELCAST_ENTERPRISE_KEY:
required: true
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
HZ_TEST_AWS_INSTANCE_PRIVATE_IP:
required: true

env:
# Not possible to set this as a default
# https://github.com/orgs/community/discussions/46670
shell: bash

runs:
using: composite
steps:
- name: Install Necessary Packages
shell: ${{ env.shell }}
run: |
sudo apt-get update
sudo apt-get install -y net-tools libssl-dev gdb curl
- name: Read Config
shell: ${{ env.shell }}
run: cat .github/config.env >> $GITHUB_ENV

- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRIBUTION }}

- name: Install Boost
shell: ${{ env.shell }}
run: |
sudo ./scripts/install-boost.sh ${{ inputs.BOOST_VERSION }}
- name: Install Thrift
shell: ${{ env.shell }}
run: |
sudo ./scripts/install-thrift.sh ${{ inputs.THRIFT_VERSION }}
- name: Configure Resources
if: ${{ inputs.run_tests }}
shell: ${{ env.shell }}
run: |
ulimit -c unlimited
sudo sh -c "echo 'core' > /proc/sys/kernel/core_pattern"
sudo sh -c "echo '1' > /proc/sys/kernel/core_uses_pid"
- uses: ./.github/actions/build-test/unix
with:
GH_TOKEN: ${{ inputs.GH_TOKEN }}
BOOST_VERSION: ${{ inputs.BOOST_VERSION }}
THRIFT_VERSION: ${{ inputs.THRIFT_VERSION }}
WARN_AS_ERR: ${{ inputs.WARN_AS_ERR }}
BUILD_TYPE: ${{ inputs.BUILD_TYPE }}
SHARED_LIBS_TOGGLE: ${{ inputs.SHARED_LIBS_TOGGLE }}
OPENSSL_TOGGLE: ${{ inputs.OPENSSL_TOGGLE }}
RUN_TESTS: ${{ inputs.RUN_TESTS }}
HAZELCAST_ENTERPRISE_KEY: ${{ inputs.HAZELCAST_ENTERPRISE_KEY }}
AWS_ACCESS_KEY_ID: ${{ inputs.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ inputs.AWS_SECRET_ACCESS_KEY }}
HZ_TEST_AWS_INSTANCE_PRIVATE_IP: ${{ inputs.HZ_TEST_AWS_INSTANCE_PRIVATE_IP }}
67 changes: 67 additions & 0 deletions .github/actions/build-test/unix/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build & Test - Unix

inputs:
GH_TOKEN:
required: true
BOOST_VERSION:
required: true
THRIFT_VERSION:
required: true
WARN_AS_ERR:
required: true
BUILD_TYPE:
required: true
SHARED_LIBS_TOGGLE:
required: true
OPENSSL_TOGGLE:
required: true
RUN_TESTS:
required: true
HAZELCAST_ENTERPRISE_KEY:
required: true
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
HZ_TEST_AWS_INSTANCE_PRIVATE_IP:
required: true

env:
# Not possible to set this as a default
# https://github.com/orgs/community/discussions/46670
shell: bash

runs:
using: composite
steps:
- name: Download hazelcast-enterprise-tests.jar
shell: ${{ env.shell }}
run: |
curl -H "Authorization: token ${{ inputs.GH_TOKEN }}" https://raw.githubusercontent.com/hazelcast/private-test-artifacts/data/certs.jar > hazelcast-enterprise-${{ env.HAZELCAST_VERSION }}-tests.jar
- name: Build & Install
env:
BUILD_DIR: build
INSTALL: ON
WARN_AS_ERR: ${{ inputs.WARN_AS_ERR }}
shell: ${{ env.shell }}
run: |
./scripts/build-unix.sh \
-DCMAKE_BUILD_TYPE=${{ inputs.BUILD_TYPE }} \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/destination \
-DBUILD_SHARED_LIBS=${{ inputs.SHARED_LIBS_TOGGLE }} \
-DWITH_OPENSSL=${{ inputs.OPENSSL_TOGGLE }} \
-DBUILD_TESTS=ON \
-DBUILD_EXAMPLES=OFF
- name: Test
if: ${{ inputs.run_tests }}
env:
BUILD_DIR: build
HAZELCAST_ENTERPRISE_KEY: ${{ inputs.HAZELCAST_ENTERPRISE_KEY }}
AWS_ACCESS_KEY_ID: ${{ inputs.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ inputs.AWS_SECRET_ACCESS_KEY }}
HZ_TEST_AWS_INSTANCE_PRIVATE_IP: ${{ inputs.HZ_TEST_AWS_INSTANCE_PRIVATE_IP }}
shell: ${{ env.shell }}
run: |
./scripts/test-unix.sh
Loading

0 comments on commit 952e05e

Please sign in to comment.