From 53c9606cfef9a920801a9f869f6362c550bd7506 Mon Sep 17 00:00:00 2001 From: Thomas Ubensee <34603111+tomuben@users.noreply.github.com> Date: Tue, 15 Oct 2024 08:20:59 -0300 Subject: [PATCH] Created installUdfClientDeps.sh --- .github/workflows/check_bazel_tests.yml | 31 ++++---------- scripts/installUdfClientDeps.sh | 56 +++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 23 deletions(-) create mode 100644 scripts/installUdfClientDeps.sh diff --git a/.github/workflows/check_bazel_tests.yml b/.github/workflows/check_bazel_tests.yml index 565826a5..0b80aaa6 100644 --- a/.github/workflows/check_bazel_tests.yml +++ b/.github/workflows/check_bazel_tests.yml @@ -8,6 +8,7 @@ on: env: USE_BAZEL_VERSION: 7.2.1 + UDF_CLIENT_ENV_FILE: /tmp/.udf_client_env jobs: build: runs-on: ubuntu-22.04 @@ -16,26 +17,14 @@ jobs: - name: Search for duplicated error codes run: bash find_duplicate_error_codes.sh - - name: Install bazel - run: | - curl -L -o bazel https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-amd64 - chmod +x bazel - - name: Install JDK and ZMQ + - name: Install UDF Client Dependencies run: | - sudo apt-get update - sudo apt-get install -y openjdk-11-jdk libzmq3-dev python3 protobuf-compiler + bash scripts/installUdfClientDeps.sh "$UDF_CLIENT_ENV_FILE" - name: Build run: | - bazel build --lockfile_mode=off --config no-tty -c dbg --config python --config fast-binary --verbose_failures + source "$UDF_CLIENT_ENV_FILE" + bazel build --lockfile_mode=off --config no-tty -c dbg --config python --config java --config fast-binary --verbose_failures working-directory: ./exaudfclient/ - env: - PYTHON3_PREFIX: /usr - PYTHON3_VERSION: python3.10 - ZMQ_LIBRARY_PREFIX: /usr/lib/x86_64-linux-gnu/ - ZMQ_INCLUDE_PREFIX: /usr/include - PROTOBUF_LIBRARY_PREFIX: /usr/lib/x86_64-linux-gnu - PROTOBUF_INCLUDE_PREFIX: /usr/include/ - PROTOBUF_BIN: /usr/bin/protoc tests: runs-on: ubuntu-latest @@ -75,16 +64,12 @@ jobs: name: "script_options_parser_legacy_with_asan" steps: - uses: actions/checkout@v4 - - name: Install bazel - run: | - curl -L -o bazel https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-amd64 - chmod +x bazel - - name: Install JDK and ZMQ + - name: Install UDF Client Dependencies run: | - sudo apt-get update - sudo apt-get install -y openjdk-11-jdk libzmq3-dev valgrind + bash scripts/installUdfClientDeps.sh "$UDF_CLIENT_ENV_FILE" - name: Run tests run: | + source "$UDF_CLIENT_ENV_FILE" bazel test ${{ matrix.additional_args }} ${{ matrix.test }} working-directory: ./exaudfclient/ diff --git a/scripts/installUdfClientDeps.sh b/scripts/installUdfClientDeps.sh new file mode 100644 index 00000000..075b5c06 --- /dev/null +++ b/scripts/installUdfClientDeps.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +set -euo pipefail + +source /etc/os-release + +if [ "$VERSION_CODENAME" != "jammy" ]; then + echo "Script can only work correctly under Ubuntu 22.04" + exit 1 +fi + +if [ $# -ne 1 ]; +then + me=$(basename "$0") + echo "Usage: '$me '. For example: '$me .env'. will contain necessary environment variables to run 'bazel build'." + exit 1 +fi + +OUT_ENV_FILE="$1" + +export DEBIAN_FRONTEND=noninteractive + +apt update +apt install -y curl openjdk-11-jdk libzmq3-dev python3 protobuf-compiler build-essential python3-pip libpcre3-dev chrpath tar locales coreutils libssl-dev + +BAZEL_PACKAGE_VERSION="7.2.1" +BAZEL_PACKAGE_FILE="bazel_$BAZEL_PACKAGE_VERSION-linux-x86_64.deb" +BAZEL_PACKAGE_URL="https://github.com/bazelbuild/bazel/releases/download/$BAZEL_PACKAGE_VERSION/$BAZEL_PACKAGE_FILE" + + +curl -L --output "$BAZEL_PACKAGE_FILE" "$BAZEL_PACKAGE_URL" && \ +apt install -y "./$BAZEL_PACKAGE_FILE" && \ +rm "$BAZEL_PACKAGE_FILE" && \ + +apt -y clean +apt -y autoremove + + +curl -L -o swig-2.0.4.tar.gz https://exasol-script-languages-dependencies.s3.eu-central-1.amazonaws.com/swig-2.0.4.tar.gz && \ + tar zxf swig-2.0.4.tar.gz && \ + (cd swig-2.0.4 && ./configure --prefix=/usr && make && make install) && \ + rm -rf swig-2.0.4 swig-2.0.4.tar.gz + + +pip install numpy + + +cat >"$OUT_ENV_FILE" <