mysu_anon/.forgejo/workflows/demo.yaml

237 lines
No EOL
11 KiB
YAML

on: [push]
jobs:
build-native-libraries-arm64-v8a:
runs-on: docker
container:
image: debian:stable
steps:
- run: apt update && apt upgrade -y
- run: apt install -y unzip automake build-essential curl file pkg-config git python3 python-is-python3 libtool libtinfo5 yacc clang libc6-dev nodejs
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- run: |
cd external-libs/monero
git submodule update --init --force
- run: |
export BASEDIR=$(pwd)
export WORKDIR=/opt/android
mkdir -p /opt/android
cd $WORKDIR
export ANDROID_SDK_REVISION=4333796
export ANDROID_SDK_HASH=92ffee5a1d98d856634e8b71132e8a95d96c83a63fde1099be3d86df3106def9
set -x \
&& curl -O https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_REVISION}.zip \
&& echo "${ANDROID_SDK_HASH} sdk-tools-linux-${ANDROID_SDK_REVISION}.zip" | sha256sum -c \
&& unzip -q sdk-tools-linux-${ANDROID_SDK_REVISION}.zip \
&& rm -f sdk-tools-linux-${ANDROID_SDK_REVISION}.zip
cd $WORKDIR
export ANDROID_NDK_REVISION=17c
export ANDROID_NDK_HASH=3f541adbd0330a9205ba12697f6d04ec90752c53d6b622101a2a8a856e816589
set -x \
&& curl -O https://dl.google.com/android/repository/android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip \
&& echo "${ANDROID_NDK_HASH} android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip" | sha256sum -c \
&& unzip -q android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip \
&& rm -f android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip
cd $WORKDIR
export ANDROID_SDK_ROOT=${WORKDIR}/tools
export ANDROID_NDK_ROOT=${WORKDIR}/android-ndk-r${ANDROID_NDK_REVISION}
export PREFIX=/opt/android/prefix
export TOOLCHAIN_DIR=${WORKDIR}/toolchain
set -x \
&& ${ANDROID_NDK_ROOT}/build/tools/make_standalone_toolchain.py \
--arch arm64 \
--api 21 \
--install-dir ${TOOLCHAIN_DIR} \
--stl=libc++
cd $WORKDIR
export CMAKE_VERSION=3.14.6
export CMAKE_HASH=82e08e50ba921035efa82b859c74c5fbe27d3e49a4003020e3c77618a4e912cd
set -x \
&& cd /usr \
&& curl -L -O https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz \
&& echo "${CMAKE_HASH} cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz" | sha256sum -c \
&& tar -xzf /usr/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz \
&& rm -f /usr/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz
export PATH=/usr/cmake-${CMAKE_VERSION}-Linux-x86_64/bin:$PATH
cd $WORKDIR
export BOOST_VERSION=1_70_0
export BOOST_VERSION_DOT=1.70.0
export BOOST_HASH=430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778
set -x \
&& curl -L -o boost_${BOOST_VERSION}.tar.bz2 https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \
&& echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \
&& tar -xf boost_${BOOST_VERSION}.tar.bz2 \
&& rm -f boost_${BOOST_VERSION}.tar.bz2 \
&& cd boost_${BOOST_VERSION} \
&& ./bootstrap.sh --prefix=${PREFIX}
export HOST_PATH=$PATH
export PATH=$TOOLCHAIN_DIR/aarch64-linux-android/bin:$TOOLCHAIN_DIR/bin:$PATH
export NPROC=4
cd $WORKDIR
export ICONV_VERSION=1.16
export ICONV_HASH=e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04
set -x \
&& curl -O http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ICONV_VERSION}.tar.gz \
&& echo "${ICONV_HASH} libiconv-${ICONV_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf libiconv-${ICONV_VERSION}.tar.gz \
&& rm -f libiconv-${ICONV_VERSION}.tar.gz \
&& cd libiconv-${ICONV_VERSION} \
&& CC=clang CXX=clang++ ./configure --build=x86_64-linux-gnu --host=aarch64-linux-android --prefix=${PREFIX} --disable-rpath \
&& make -j${NPROC} && make install
cd $WORKDIR
set -x \
&& cd boost_${BOOST_VERSION} \
&& ./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale --build-dir=android --stagedir=android toolset=clang threading=multi threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} install -j${NPROC}
cd $WORKDIR
export ZLIB_VERSION=1.3.1
export ZLIB_HASH=9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23
set -x \
&& curl -O https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz \
&& echo "${ZLIB_HASH} zlib-${ZLIB_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf zlib-${ZLIB_VERSION}.tar.gz \
&& rm zlib-${ZLIB_VERSION}.tar.gz \
&& mv zlib-${ZLIB_VERSION} zlib \
&& cd zlib && CC=clang CXX=clang++ ./configure --static \
&& make -j${NPROC}
cd $WORKDIR
export OPENSSL_VERSION=3.0.5
export OPENSSL_HASH=aa7d8d9bef71ad6525c55ba11e5f4397889ce49c2c9349dcea6d3e4f0b024a7a
export PRE_OPENSSL_PATH=$PATH
set -x \
&& curl -L -O https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \
&& echo "${OPENSSL_HASH} openssl-${OPENSSL_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf openssl-${OPENSSL_VERSION}.tar.gz \
&& rm openssl-${OPENSSL_VERSION}.tar.gz \
&& cd openssl-${OPENSSL_VERSION} \
&& export PATH=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH \
&& ./Configure android-arm64 \
-D__ANDROID_API__=21 \
-static \
no-shared no-tests \
--with-zlib-include=${WORKDIR}/zlib/include --with-zlib-lib=${WORKDIR}/zlib/lib \
--prefix=${PREFIX} --openssldir=${PREFIX} \
&& make -j${NPROC} \
&& make install_sw
export PATH=$PRE_OPENSSL_PATH
cd $WORKDIR
export ZMQ_VERSION=v4.3.2
export ZMQ_HASH=a84ffa12b2eb3569ced199660bac5ad128bff1f0
set -x \
&& git clone https://github.com/zeromq/libzmq.git -b ${ZMQ_VERSION} \
&& cd libzmq \
&& test `git rev-parse HEAD` = ${ZMQ_HASH} || exit 1 \
&& ./autogen.sh \
&& CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=aarch64-linux-android --enable-static --disable-shared \
&& make -j${NPROC} \
&& make install
cd $WORKDIR
export SODIUM_VERSION=1.0.18
export SODIUM_HASH=4f5e89fa84ce1d178a6765b8b46f2b6f91216677
set -x \
&& git clone https://github.com/jedisct1/libsodium.git -b ${SODIUM_VERSION} \
&& cd libsodium \
&& test `git rev-parse HEAD` = ${SODIUM_HASH} || exit 1 \
&& ./autogen.sh \
&& CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=aarch64-linux-android --enable-static --disable-shared \
&& make -j${NPROC} \
&& make install
cd $WORKDIR
export LIBEXPAT_VERSION=R_2_4_8
export LIBEXPAT_HASH=3bab6c09bbe8bf42d84b81563ddbcf4cca4be838
set -x \
&& git clone https://github.com/libexpat/libexpat.git -b ${LIBEXPAT_VERSION} \
&& cd libexpat/expat \
&& test `git rev-parse HEAD` = ${LIBEXPAT_HASH} || exit 1 \
&& ./buildconf.sh \
&& CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=aarch64-linux-android --enable-static --disable-shared \
&& make -j${NPROC} \
&& make install
cd $WORKDIR
export LIBUNBOUND_VERSION=release-1.16.1
export LIBUNBOUND_HASH=903538c76e1d8eb30d0814bb55c3ef1ea28164e8
git clone https://github.com/NLnetLabs/unbound.git -b ${LIBUNBOUND_VERSION}
set -x \
&& cd unbound \
&& test `git rev-parse HEAD` = ${LIBUNBOUND_HASH} || exit 1 \
&& CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=aarch64-linux-android --enable-static --disable-shared --disable-flto --with-ssl=${PREFIX} --with-libexpat=${PREFIX} \
&& make -j${NPROC} \
&& make install
cd $WORKDIR
git clone https://github.com/tevador/polyseed.git
set -x \
&& cd polyseed \
&& git reset --hard b7c35bb3c6b91e481ecb04fc235eaff69c507fa1 \
&& CC=clang CXX=clang++ cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} . \
&& make \
&& make install
cd $WORKDIR
git clone https://github.com/JuliaStrings/utf8proc -b v2.8.0
set -x \
&& cd utf8proc \
&& git reset --hard 1cb28a66ca79a0845e99433fd1056257456cef8b \
&& mkdir build \
&& cd build \
&& rm -rf ../CMakeCache.txt ../CMakeFiles/ \
&& CC=clang CXX=clang++ cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} .. \
&& make \
&& make install
cd $BASEDIR/external-libs/monero
CMAKE_INCLUDE_PATH="${PREFIX}/include" \
CMAKE_LIBRARY_PATH="${PREFIX}/lib" \
ANDROID_STANDALONE_TOOLCHAIN_PATH=${TOOLCHAIN_DIR} \
USE_SINGLE_BUILDDIR=1 \
PATH=${HOST_PATH} make release-static-android-armv8-wallet_api -j${NPROC}
cd $BASEDIR/external-libs/monero/build/release
find . -path ./lib -prune -o -name '*.a' -exec cp '{}' lib \;
cd $BASEDIR
mkdir -p /opt/output
mkdir /opt/output/arm64-v8a
mkdir /opt/output/arm64-v8a/monero
mkdir /opt/output/include
mv /opt/android/prefix/lib/** /opt/output/arm64-v8a/
mv external-libs/monero/build/release/lib/** /opt/output/arm64-v8a/monero/
mv external-libs/monero/src/wallet/api/wallet2_api.h /opt/output/include/
- uses: actions/upload-artifact@v3
with:
name: native-build-artifacts-arm64-v8a
path: /opt/output
build-apk-arm64-v8a:
runs-on: docker
container:
image: docker.io/cimg/android:2024.04.1-ndk
steps:
- run: sudo apt update && sudo apt upgrade -y
- run: curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh
- run: sudo bash nodesource_setup.sh
- run: sudo apt install -y nodejs
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: native-build-artifacts-arm64-v8a
path: external-libs/
- run: ./gradlew -PdbgBld assembleDebug
- uses: actions/upload-artifact@v3
with:
name: apk-arm64-v8a
path: app/build/outputs/apk/beta/