Update github actions to Ubuntu 22.04 and OpenSSL3

This commit is contained in:
Andrea Cavalli 2023-02-08 17:04:30 +01:00
parent 7866e8269c
commit b218ca97da
7 changed files with 157 additions and 129 deletions

View File

@ -19,14 +19,10 @@ jobs:
- {os: ubuntu-20.04, usedocker: "true", ssl: "ssl1", useqemu: "false", arch: "linux/arm64", implementation: "tdlight"}
- {os: ubuntu-20.04, usedocker: "true", ssl: "ssl1", useqemu: "false", arch: "linux/s390x", implementation: "tdlight"}
- {os: ubuntu-20.04, usedocker: "true", ssl: "ssl1", useqemu: "false", arch: "linux/ppc64le", implementation: "tdlight"}
- {os: ubuntu-22.04, usedocker: "true", ssl: "ssl3", useqemu: "false", arch: "linux/386", implementation: "tdlight"}
- {os: ubuntu-22.04, usedocker: "true", ssl: "ssl3", useqemu: "false", arch: "linux/amd64", implementation: "tdlight"}
- {os: ubuntu-22.04, usedocker: "true", ssl: "ssl3", useqemu: "false", arch: "linux/armhf", implementation: "tdlight"}
- {os: ubuntu-22.04, usedocker: "true", ssl: "ssl3", useqemu: "false", arch: "linux/arm64", implementation: "tdlight"}
- {os: ubuntu-22.04, usedocker: "true", ssl: "ssl3", useqemu: "false", arch: "linux/s390x", implementation: "tdlight"}
- {os: ubuntu-22.04, usedocker: "true", ssl: "ssl3", useqemu: "false", arch: "linux/ppc64le", implementation: "tdlight"}
- {os: windows-2019, usedocker: "false", useqemu: "false", arch: "amd64", implementation: "tdlight", vcpkgCommitId: "6ca56aeb457f033d344a7106cb3f9f1abf8f4e98", triplet: "x64-windows-static"}
- {os: macos-10.15, usedocker: "false", useqemu: "false", arch: "amd64", implementation: "tdlight"}
- {os: windows-2019, usedocker: "false", ssl: "ssl1", useqemu: "false", arch: "amd64", implementation: "tdlight", vcpkgCommitId: "6ca56aeb457f033d344a7106cb3f9f1abf8f4e98", triplet: "x64-windows-static"}
- {os: macos-10.15, usedocker: "false", ssl: "ssl1", useqemu: "false", arch: "amd64", implementation: "tdlight"}
steps:
- name: Checkout current repo
uses: actions/checkout@v2
@ -53,19 +49,19 @@ jobs:
VERSION=$(echo "$VERSION" | awk '{print tolower($0)}')
ARCH=${{ matrix.arch }}
SAFE_ARCH=${ARCH///} # linux/amd64 -> linuxamd64
SSL3=${{ matrix.ssl }}
SSL_TYPE=${{ matrix.ssl }}
# Store variable for future use
echo "HASH_VERSION=$HASH_VERSION" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "SAFE_ARCH=$SAFE_ARCH" >> $GITHUB_ENV
echo "SSL3=$SSL3" >> $GITHUB_ENV
echo "SSL_TYPE=$SSL_TYPE" >> $GITHUB_ENV
# Print debug info
echo "hash version: $HASH_VERSION"
echo "version: $VERSION"
echo "safe arch: $SAFE_ARCH"
echo "ssl3: $SSL3"
echo "ssl type: $SSL_TYPE"
# Save env to file
cat $GITHUB_ENV > github.env
@ -188,7 +184,7 @@ jobs:
echo "VCPKG_DIR=$VCPKG_DIR" >> $GITHUB_ENV
echo "MAVEN_OPTS=$MAVEN_OPTS" >> $GITHUB_ENV
echo "GH_CPU_ARCH=$GH_CPU_ARCH" >> $GITHUB_ENV
echo "SSL3=$GH_MATRIX_SSL" >> $GITHUB_ENV
echo "SSL_TYPE=$GH_MATRIX_SSL" >> $GITHUB_ENV
echo "CPU_ARCH_JAVA=$CPU_ARCH_JAVA" >> $GITHUB_ENV
echo "CPU_ARCHITECTURE_NAME=$CPU_ARCHITECTURE_NAME" >> $GITHUB_ENV
echo "CPU_CORES_NUM=$CPU_CORES_NUM" >> $GITHUB_ENV
@ -268,6 +264,7 @@ jobs:
shell: bash
run: |
echo "REVISION: $REVISION"
echo "SSL TYPE: $SSL_TYPE"
source ./scripts/continuous-integration/github-workflows/deploy-snapshot.sh
env:
@ -278,6 +275,7 @@ jobs:
shell: bash
run: |
echo "REVISION: $REVISION"
echo "SSL TYPE: $SSL_TYPE"
source ./scripts/continuous-integration/github-workflows/deploy-release.sh
env:

View File

@ -1,3 +1,11 @@
ARG GH_MATRIX_SSL
FROM debian:oldstable as img_ssl1
ONBUILD ENV SSL_LIB_NAME=libssl1.1
FROM ubuntu:jammy as img_ssl3
ONBUILD ENV SSL_LIB_NAME=libssl3
FROM img_${GH_MATRIX_SSL} AS build
ARG REVISION
ARG GH_MATRIX_OS
ARG GH_MATRIX_ARCH
@ -5,29 +13,14 @@ ARG GH_MATRIX_SSL
ARG IMPLEMENTATION_NAME
ARG CPU_CORES_NUM
FROM ubuntu:jammy as img_ssl1
ONBUILD ENV SSL_LIB_NAME=libssl1.1
FROM debian:oldstable as img_ssl3
ONBUILD ENV SSL_LIB_NAME=libssl3
FROM img_${GH_MATRIX_SSL}
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=Europe/Kiev
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt update && apt upgrade -y
RUN apt install -y sudo build-essential openjdk-11-jdk locales wget cmake gperf ccache maven \
libssl-dev ${SSL_LIB_NAME} zlib1g-dev zlib1g
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8
ENV LANG "en_US.UTF-8"
ENV JAVA_TOOL_OPTIONS "-Dfile.encoding=UTF8"
ENV CROSS_BUILD_DEPS_DIR "/var/cache/crossbuild-deps"
ADD implementations /usr/src/tdlight-java-natives/implementations
ADD scripts /usr/src/tdlight-java-natives/scripts
@ -35,7 +28,14 @@ ADD src /usr/src/tdlight-java-natives/src
WORKDIR /usr/src/tdlight-java-natives/
RUN /bin/bash /usr/src/tdlight-java-natives/scripts/continuous-integration/docker/build-natives.sh
RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
--mount=target=/var/cache/apt,type=cache,sharing=locked \
--mount=target=/var/cache/crossbuild-deps,type=cache,sharing=locked \
/bin/bash /usr/src/tdlight-java-natives/scripts/continuous-integration/docker/install-dependencies.sh
RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
--mount=target=/var/cache/apt,type=cache,sharing=locked \
--mount=target=/var/cache/crossbuild-deps,type=cache,sharing=locked \
/bin/bash /usr/src/tdlight-java-natives/scripts/continuous-integration/docker/build-natives.sh
#WORKDIR /usr/src/tdlight-java-natives/generated/
#RUN echo "aaaa" > test.txt

View File

@ -1,109 +1,9 @@
#!/bin/bash -e
source ./scripts/continuous-integration/docker/setup-platform-variables.sh
export JAVA_HOME
JAVA_HOME="$(find "/usr/lib/jvm/" -maxdepth 1 -type d -iname "java*jdk*" | head -n 1)/"
export JAVA_INCLUDE_PATH="$JAVA_HOME/include"
source ./scripts/continuous-integration/github-workflows/setup-variables.sh
export CROSS_BUILD_DEPS_DIR="$PWD/cross-build-deps"
# Check variables correctness
if [ -z "${CPU_ARCH_DPKG}" ]; then
echo "Missing parameter: CPU_ARCH_DPKG"
exit 1
fi
if [ -n "${CROSS_BUILD_DEPS_DIR}" ]; then
CROSS_OPENJDK_PATH=""
fix_jdk_path() {
# Setup OpenJDK path
CROSS_OPENJDK_PATH=$(find "$CROSS_BUILD_DEPS_DIR/usr/lib/jvm/" -maxdepth 1 -type d -iname "java*jdk*" | head -n 1)
}
check_jdk_existance() {
if [[ ! -d "$CROSS_OPENJDK_PATH" ]]; then
echo "Can't find cross OpenJDK at location $CROSS_OPENJDK_PATH"
exit 1
fi
}
PWD_BEFORE_CROSS_DEPS=$(pwd)
if [[ ! -f "$CROSS_BUILD_DEPS_DIR/ok-013" ]]; then
echo "Setting up cross build deps dir"
rm -rf "$CROSS_BUILD_DEPS_DIR" || true
mkdir -p "$CROSS_BUILD_DEPS_DIR"
cd "$CROSS_BUILD_DEPS_DIR"
dpkg --add-architecture "${CPU_ARCH_DPKG}"
apt-get update
# LibZ-Dev
apt-get download "zlib1g-dev:${CPU_ARCH_DPKG}"
ZLIB1G_DEV_DEB=$(find . -name "zlib1g-dev_*.deb")
dpkg -x "$ZLIB1G_DEV_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$ZLIB1G_DEV_DEB"
# LibZ
apt-get download "zlib1g:${CPU_ARCH_DPKG}"
ZLIB1G_DEB=$(find . -name "zlib1g_*.deb")
dpkg -x "$ZLIB1G_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$ZLIB1G_DEB"
# LibSSL-Dev
apt-get download "libssl-dev:${CPU_ARCH_DPKG}"
LIBSSL_DEV_DEB=$(find . -name "libssl-dev_*.deb")
dpkg -x "$LIBSSL_DEV_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$LIBSSL_DEV_DEB"
if [[ "$GH_MATRIX_SSL" == "ssl3" ]]; then
# LibSSL
apt-get download "libssl3:${CPU_ARCH_DPKG}"
LIBSSL_DEB=$(find . -name "libssl3_*.deb")
dpkg -x "$LIBSSL_DEB" "$CROSS_BUILD_DEPS_DIR"
else
# LibSSL
apt-get download "libssl:${CPU_ARCH_DPKG}"
LIBSSL_DEB=$(find . -name "libssl_*.deb")
dpkg -x "$LIBSSL_DEB" "$CROSS_BUILD_DEPS_DIR"
fi
rm "$LIBSSL_DEB"
# Java Common
apt-get download "java-common"
JC_DEB=$(find . -name "java-common_*.deb")
dpkg -x "$JC_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$JC_DEB"
# OpenJDK-JRE-Headless
apt-get download "openjdk-11-jre-headless:${CPU_ARCH_DPKG}"
OJDKRH_DEB=$(find . -name "openjdk-11-jre-headless_*.deb")
dpkg -x "$OJDKRH_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$OJDKRH_DEB"
# OpenJDK-JRE
apt-get download "openjdk-11-jre:${CPU_ARCH_DPKG}"
OJDKR_DEB=$(find . -name "openjdk-11-jre_*.deb")
dpkg -x "$OJDKR_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$OJDKR_DEB"
# OpenJDK-JDK
apt-get download "openjdk-11-jdk-headless:${CPU_ARCH_DPKG}"
OJDKJ_DEB=$(find . -name "openjdk-11-jdk-headless_*.deb")
dpkg -x "$OJDKJ_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$OJDKJ_DEB"
# OpenJDK-GUI
apt-get download "openjdk-11-jdk:${CPU_ARCH_DPKG}"
OJDKG_DEB=$(find . -name "openjdk-11-jdk_*.deb")
dpkg -x "$OJDKG_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$OJDKG_DEB"
# Fix symlinks
find "$CROSS_BUILD_DEPS_DIR" -lname "/*" \
-exec sh -c "ln -sf \"\`echo \"$CROSS_BUILD_DEPS_DIR\$(readlink \$0)\"\`\" \"\$0\"" {} \;
echo "Cross build deps dir setup finished, testing..."
# Check if openjdk is found
fix_jdk_path
check_jdk_existance
touch "$CROSS_BUILD_DEPS_DIR/ok-013"
fi
echo "Cross build deps dir setup done"
fix_jdk_path
check_jdk_existance
cd "${PWD_BEFORE_CROSS_DEPS}"
apt install -y "crossbuild-essential-${CPU_ARCH_DPKG}"
fi
cd scripts/core
source ./setup-variables.sh

View File

@ -0,0 +1,113 @@
source ./scripts/continuous-integration/docker/setup-platform-variables.sh
# Check variables correctness
if [ -z "${CPU_ARCH_DPKG}" ]; then
echo "Missing parameter: CPU_ARCH_DPKG"
exit 1
fi
install_deps() {
apt-get install -y sudo build-essential openjdk-11-jdk locales wget cmake gperf ccache maven \
libssl-dev ${SSL_LIB_NAME} zlib1g-dev zlib1g "crossbuild-essential-${CPU_ARCH_DPKG}"
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8
}
if [ -n "${CROSS_BUILD_DEPS_DIR}" ]; then
CROSS_OPENJDK_PATH=""
fix_jdk_path() {
# Setup OpenJDK path
CROSS_OPENJDK_PATH=$(find "$CROSS_BUILD_DEPS_DIR/usr/lib/jvm/" -maxdepth 1 -type d -iname "java*jdk*" | head -n 1)
}
check_jdk_existance() {
if [[ ! -d "$CROSS_OPENJDK_PATH" ]]; then
echo "Can't find cross OpenJDK at location $CROSS_OPENJDK_PATH"
exit 1
fi
}
PWD_BEFORE_CROSS_DEPS=$(pwd)
if [[ ! -f "$CROSS_BUILD_DEPS_DIR/ok-013" ]]; then
echo "Setting up cross build deps dir"
rm -rf "$CROSS_BUILD_DEPS_DIR" || true
mkdir -p "$CROSS_BUILD_DEPS_DIR"
cd "$CROSS_BUILD_DEPS_DIR"
dpkg --add-architecture "${CPU_ARCH_DPKG}"
apt-get update
# LibZ-Dev
apt-get download "zlib1g-dev:${CPU_ARCH_DPKG}"
ZLIB1G_DEV_DEB=$(find . -name "zlib1g-dev_*.deb")
dpkg -x "$ZLIB1G_DEV_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$ZLIB1G_DEV_DEB"
# LibZ
apt-get download "zlib1g:${CPU_ARCH_DPKG}"
ZLIB1G_DEB=$(find . -name "zlib1g_*.deb")
dpkg -x "$ZLIB1G_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$ZLIB1G_DEB"
# LibSSL-Dev
apt-get download "libssl-dev:${CPU_ARCH_DPKG}"
LIBSSL_DEV_DEB=$(find . -name "libssl-dev_*.deb")
dpkg -x "$LIBSSL_DEV_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$LIBSSL_DEV_DEB"
if [[ "$GH_MATRIX_SSL" == "ssl3" ]]; then
# LibSSL
apt-get download "libssl3:${CPU_ARCH_DPKG}"
LIBSSL_DEB=$(find . -name "libssl3_*.deb")
dpkg -x "$LIBSSL_DEB" "$CROSS_BUILD_DEPS_DIR"
else
# LibSSL
apt-get download "libssl:${CPU_ARCH_DPKG}"
LIBSSL_DEB=$(find . -name "libssl_*.deb")
dpkg -x "$LIBSSL_DEB" "$CROSS_BUILD_DEPS_DIR"
fi
rm "$LIBSSL_DEB"
# Java Common
apt-get download "java-common"
JC_DEB=$(find . -name "java-common_*.deb")
dpkg -x "$JC_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$JC_DEB"
# OpenJDK-JRE-Headless
apt-get download "openjdk-11-jre-headless:${CPU_ARCH_DPKG}"
OJDKRH_DEB=$(find . -name "openjdk-11-jre-headless_*.deb")
dpkg -x "$OJDKRH_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$OJDKRH_DEB"
# OpenJDK-JRE
apt-get download "openjdk-11-jre:${CPU_ARCH_DPKG}"
OJDKR_DEB=$(find . -name "openjdk-11-jre_*.deb")
dpkg -x "$OJDKR_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$OJDKR_DEB"
# OpenJDK-JDK
apt-get download "openjdk-11-jdk-headless:${CPU_ARCH_DPKG}"
OJDKJ_DEB=$(find . -name "openjdk-11-jdk-headless_*.deb")
dpkg -x "$OJDKJ_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$OJDKJ_DEB"
# OpenJDK-GUI
apt-get download "openjdk-11-jdk:${CPU_ARCH_DPKG}"
OJDKG_DEB=$(find . -name "openjdk-11-jdk_*.deb")
dpkg -x "$OJDKG_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$OJDKG_DEB"
# Fix symlinks
find "$CROSS_BUILD_DEPS_DIR" -lname "/*" \
-exec sh -c "ln -sf \"\`echo \"$CROSS_BUILD_DEPS_DIR\$(readlink \$0)\"\`\" \"\$0\"" {} \;
echo "Cross build deps dir setup finished, testing..."
# Check if openjdk is found
fix_jdk_path
check_jdk_existance
touch "$CROSS_BUILD_DEPS_DIR/ok-013"
else
apt-get update
fi
install_deps
echo "Cross build deps dir setup done"
fix_jdk_path
check_jdk_existance
cd "${PWD_BEFORE_CROSS_DEPS}"
else
apt-get update
install_deps
fi

View File

@ -0,0 +1,7 @@
#!/bin/bash -e
source ./scripts/continuous-integration/github-workflows/setup-variables.sh
export JAVA_HOME
JAVA_HOME="$(find "/usr/lib/jvm/" -maxdepth 1 -type d -iname "java*jdk*" | head -n 1)/"
export JAVA_INCLUDE_PATH="$JAVA_HOME/include"

View File

@ -3,6 +3,7 @@
# REVISION = <revision>
# OTHER ENVIRONMENT VARIABLES:
# API_TYPE = <legacy|sealed>
# SSL_TYPE = <ssl1|ssl3>
# Check variables correctness
if [ -z "${REVISION}" ]; then
@ -12,8 +13,12 @@ fi
source ./setup-variables.sh
FALLBACK_API_TYPE="sealed"
FALLBACK_SSL_TYPE="ssl1"
SAFE_VERSION_NAME="v4_0_${REVISION}"
REVISION_SUFFIX=""
if [ "${SSL_TYPE:-${FALLBACK_SSL_TYPE}}" != "ssl1" ]; then
REVISION_SUFFIX="-${SSL_TYPE}${REVISION_SUFFIX}"
fi
REVISION_MVN="4.0.${REVISION}${REVISION_SUFFIX}"
if [ -z "${API_TYPE}" ]; then

View File

@ -1,6 +1,7 @@
#!/bin/bash -e
# OTHER ENVIRONMENT VARIABLES:
# API_TYPE = <legacy|sealed>
# SSL_TYPE = <ssl1|ssl3>
if [ -z "${API_TYPE}" ]; then
cd ../../generated
@ -9,8 +10,12 @@ else
fi
FALLBACK_API_TYPE="sealed"
FALLBACK_SSL_TYPE="ssl1"
SAFE_VERSION_NAME="v4_0_0"
REVISION_SUFFIX="-SNAPSHOT"
if [ "${SSL_TYPE:-${FALLBACK_SSL_TYPE}}" != "ssl1" ]; then
REVISION_SUFFIX="-${SSL_TYPE}${REVISION_SUFFIX}"
fi
REVISION_MVN="4.0.0${REVISION_SUFFIX}"
mvn -B -Drevision="${REVISION_MVN}" -DsafeVersionName="${SAFE_VERSION_NAME}" "-D${API_TYPE:-${FALLBACK_API_TYPE}}" deploy