From 7866e8269cce2a9d8b6a3f983c75977515b6ec7f Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Wed, 8 Feb 2023 15:18:11 +0100 Subject: [PATCH] Update github actions to Ubuntu 22.04 and OpenSSL3 --- .github/workflows/platform_natives.yaml | 52 ++++++++++--------- Dockerfile | 12 +++-- .../docker/build-natives.sh | 19 ++++--- 3 files changed, 50 insertions(+), 33 deletions(-) diff --git a/.github/workflows/platform_natives.yaml b/.github/workflows/platform_natives.yaml index 23770f9..7fa3f10 100644 --- a/.github/workflows/platform_natives.yaml +++ b/.github/workflows/platform_natives.yaml @@ -13,22 +13,20 @@ jobs: strategy: matrix: include: - - {os: ubuntu-22.04, usedocker: "true", useqemu: "false", arch: "linux/386", implementation: "tdlight"} - #- {os: ubuntu-22.04, usedocker: "true", useqemu: "false", arch: "linux/386", implementation: "tdlib"} - - {os: ubuntu-22.04, usedocker: "true", useqemu: "false", arch: "linux/amd64", implementation: "tdlight"} - #- {os: ubuntu-22.04, usedocker: "true", useqemu: "false", arch: "linux/amd64", implementation: "tdlib"} - - {os: ubuntu-22.04, usedocker: "true", useqemu: "false", arch: "linux/armhf", implementation: "tdlight"} - #- {os: ubuntu-22.04, usedocker: "true", useqemu: "false", arch: "linux/armhf", implementation: "tdlib"} - - {os: ubuntu-22.04, usedocker: "true", useqemu: "false", arch: "linux/arm64", implementation: "tdlight"} - #- {os: ubuntu-22.04, usedocker: "true", useqemu: "false", arch: "linux/arm64", implementation: "tdlib"} - - {os: ubuntu-22.04, usedocker: "true", useqemu: "false", arch: "linux/s390x", implementation: "tdlight"} - #- {os: ubuntu-22.04, usedocker: "true", useqemu: "false", arch: "linux/s390x", implementation: "tdlib"} - - {os: ubuntu-22.04, usedocker: "true", useqemu: "false", arch: "linux/ppc64le", implementation: "tdlight"} - #- {os: ubuntu-22.04, usedocker: "true", useqemu: "false", arch: "linux/ppc64le", implementation: "tdlib"} + - {os: ubuntu-20.04, usedocker: "true", ssl: "ssl1", useqemu: "false", arch: "linux/386", implementation: "tdlight"} + - {os: ubuntu-20.04, usedocker: "true", ssl: "ssl1", useqemu: "false", arch: "linux/amd64", implementation: "tdlight"} + - {os: ubuntu-20.04, usedocker: "true", ssl: "ssl1", useqemu: "false", arch: "linux/armhf", implementation: "tdlight"} + - {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: windows-2019, usedocker: "false", useqemu: "false", arch: "amd64", implementation: "tdlib", vcpkgCommitId: "6ca56aeb457f033d344a7106cb3f9f1abf8f4e98", triplet: "x64-windows-static"} - {os: macos-10.15, usedocker: "false", useqemu: "false", arch: "amd64", implementation: "tdlight"} - #- {os: macos-10.15, usedocker: "false", useqemu: "false", arch: "amd64", implementation: "tdlib"} steps: - name: Checkout current repo uses: actions/checkout@v2 @@ -55,16 +53,19 @@ jobs: VERSION=$(echo "$VERSION" | awk '{print tolower($0)}') ARCH=${{ matrix.arch }} SAFE_ARCH=${ARCH///} # linux/amd64 -> linuxamd64 + SSL3=${{ 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 # Print debug info echo "hash version: $HASH_VERSION" echo "version: $VERSION" echo "safe arch: $SAFE_ARCH" + echo "ssl3: $SSL3" # Save env to file cat $GITHUB_ENV > github.env @@ -82,33 +83,33 @@ jobs: uses: actions/cache@v3 with: path: /tmp/.buildx-cache - key: ${{ runner.os }}-v3-buildx-cache-${{ env.SAFE_ARCH }}-${{ github.sha }} + key: ${{ runner.os }}-v3-buildx-cache-${{ env.SAFE_ARCH }}-${{ env.SSL }}-${{ github.sha }} restore-keys: | - ${{ runner.os }}-v3-buildx-cache-${{ env.SAFE_ARCH }}- + ${{ runner.os }}-v3-buildx-cache-${{ env.SAFE_ARCH }}-${{ env.SSL }}- - name: Cache Maven uses: actions/cache@v3 with: path: ~/.m2/repository - key: ${{ runner.os }}-v3-maven-${{ env.SAFE_ARCH }}-${{ hashFiles('**/pom.xml') }} + key: ${{ runner.os }}-v3-maven-${{ env.SAFE_ARCH }}-${{ env.SSL }}-${{ hashFiles('**/pom.xml') }} restore-keys: | - ${{ runner.os }}-v3-maven-${{ env.SAFE_ARCH }}- + ${{ runner.os }}-v3-maven-${{ env.SAFE_ARCH }}-${{ env.SSL }}- - name: Cache packages cache uses: actions/cache@v3 with: path: ~/tdlight-java-natives/tdlight-java-natives/.cache - key: ${{ runner.os }}-v3-packages-${{ env.SAFE_ARCH }}-${{ github.sha }} + key: ${{ runner.os }}-v3-packages-${{ env.SAFE_ARCH }}-${{ env.SSL }}-${{ github.sha }} restore-keys: | - ${{ runner.os }}-v3-packages-${{ env.SAFE_ARCH }}- + ${{ runner.os }}-v3-packages-${{ env.SAFE_ARCH }}-${{ env.SSL }}- - name: Cache ccache uses: actions/cache@v3 with: path: ~/.ccache - key: ${{ runner.os }}-v2-ccache-${{ env.SAFE_ARCH }}-${{ github.sha }} + key: ${{ runner.os }}-v2-ccache-${{ env.SAFE_ARCH }}-${{ env.SSL }}-${{ github.sha }} restore-keys: | - ${{ runner.os }}-v2-ccache-${{ env.SAFE_ARCH }}- + ${{ runner.os }}-v2-ccache-${{ env.SAFE_ARCH }}-${{ env.SSL }}- - name: Build image if: matrix.usedocker == 'true' @@ -122,18 +123,19 @@ jobs: push: false load: true tags: | - tdlight-java-natives:${{ env.HASH_VERSION }}-${{ env.SAFE_ARCH }} + tdlight-java-natives:${{ env.HASH_VERSION }}-${{ env.SAFE_ARCH }}-${{ env.SSL }} build-args: | REVISION=${{ github.run_number }} GH_MATRIX_OS=${{ matrix.os }} GH_MATRIX_ARCH=${{ matrix.arch }} + GH_MATRIX_SSL=${{ matrix.ssl }} IMPLEMENTATION_NAME=${{ matrix.implementation }} - name: Extract jni from docker image if: matrix.usedocker == 'true' run: | mkdir generated - docker cp $(docker create tdlight-java-natives:${{ env.HASH_VERSION }}-${{ env.SAFE_ARCH }}):/usr/src/tdlight-java-natives/generated/. ./generated/. + docker cp $(docker create tdlight-java-natives:${{ env.HASH_VERSION }}-${{ env.SAFE_ARCH }}-${{ env.SSL }}):/usr/src/tdlight-java-natives/generated/. ./generated/. - name: Setup Java (Snapshot) if: github.ref == 'refs/heads/develop' @@ -160,6 +162,7 @@ jobs: export REVISION=${{ github.run_number }} export GH_MATRIX_OS=${{ matrix.os }} export GH_MATRIX_ARCH=${{ matrix.arch }} + export GH_MATRIX_SSL=${{ matrix.ssl }} export IMPLEMENTATION_NAME=${{ matrix.implementation }} source ./scripts/continuous-integration/github-workflows/setup-variables.sh @@ -185,6 +188,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 "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 diff --git a/Dockerfile b/Dockerfile index 7f08767..f2cbf69 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,17 @@ -FROM debian:oldstable - ARG REVISION ARG GH_MATRIX_OS ARG GH_MATRIX_ARCH +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 @@ -14,7 +20,7 @@ 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 libssl1.1 zlib1g-dev zlib1g + 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 && \ diff --git a/scripts/continuous-integration/docker/build-natives.sh b/scripts/continuous-integration/docker/build-natives.sh index 30e425a..24dd790 100755 --- a/scripts/continuous-integration/docker/build-natives.sh +++ b/scripts/continuous-integration/docker/build-natives.sh @@ -24,7 +24,7 @@ if [ -n "${CROSS_BUILD_DEPS_DIR}" ]; then } PWD_BEFORE_CROSS_DEPS=$(pwd) - if [[ ! -f "$CROSS_BUILD_DEPS_DIR/ok-012" ]]; then + 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" @@ -48,10 +48,17 @@ if [ -n "${CROSS_BUILD_DEPS_DIR}" ]; then LIBSSL_DEV_DEB=$(find . -name "libssl-dev_*.deb") dpkg -x "$LIBSSL_DEV_DEB" "$CROSS_BUILD_DEPS_DIR" rm "$LIBSSL_DEV_DEB" - # LibSSL - apt-get download "libssl3:${CPU_ARCH_DPKG}" - LIBSSL_DEB=$(find . -name "libssl3_*.deb") - dpkg -x "$LIBSSL_DEB" "$CROSS_BUILD_DEPS_DIR" + 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" @@ -89,7 +96,7 @@ if [ -n "${CROSS_BUILD_DEPS_DIR}" ]; then fix_jdk_path check_jdk_existance - touch "$CROSS_BUILD_DEPS_DIR/ok-012" + touch "$CROSS_BUILD_DEPS_DIR/ok-013" fi echo "Cross build deps dir setup done" fix_jdk_path