From 5f19e1d571e714b870cfb11bb364cd87151cc8da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 22 Oct 2020 13:10:34 +0200 Subject: [PATCH] CI: Refactor Android workflow, use pre-installed SDK and NDK No need to waste time downloading all this when it's readily available :) Also use the official action to setup Java 8. Also build both architectures (armv7 and arm64v8) and generate the APK, so we can upload it. Remove now unused and outdated `misc/ci/android-tools-linux.sh`. --- .github/workflows/android_builds.yml | 26 +++---- .github/workflows/linux_builds.yml | 2 +- misc/ci/android-tools-linux.sh | 108 --------------------------- 3 files changed, 11 insertions(+), 125 deletions(-) delete mode 100755 misc/ci/android-tools-linux.sh diff --git a/.github/workflows/android_builds.yml b/.github/workflows/android_builds.yml index 3c1e6a6b725..3ce3765efc1 100644 --- a/.github/workflows/android_builds.yml +++ b/.github/workflows/android_builds.yml @@ -23,20 +23,10 @@ jobs: sudo cp -f misc/ci/sources.list /etc/apt/sources.list sudo apt-get update - # Install all packages (except scons) - - name: Configure dependencies - run: | - sudo apt-get install openjdk-8-jdk - echo 'JAVA_HOME=usr/lib/jvm/java-8-openjdk-amd64' >> $GITHUB_ENV - - - name: Install Android SDK and NDK - run: | - echo '/usr/lib/jvm/java-8-openjdk-amd64/jre/bin' >> $GITHUB_PATH - java -version - echo "ANDROID_HOME=$(pwd)/godot-dev/build-tools/android-sdk" >> $GITHUB_ENV - echo "ANDROID_NDK_ROOT=$(pwd)/godot-dev/build-tools/android-ndk" >> $GITHUB_ENV - misc/ci/android-tools-linux.sh - source ~/.bashrc + - name: Set up Java 8 + uses: actions/setup-java@v1 + with: + java-version: 8 # Upload cache on completion and check it out now - name: Load .scons_cache directory @@ -59,7 +49,6 @@ jobs: # Optional - x64 or x86 architecture, defaults to x64 architecture: 'x64' - # You can test your matrix by printing the current Python version - name: Configuring Python packages run: | python -c "import sys; print(sys.version)" @@ -70,8 +59,13 @@ jobs: - name: Compilation env: SCONS_CACHE: ${{github.workspace}}/.scons_cache/ + ANDROID_NDK_ROOT: /usr/local/lib/android/sdk/ndk-bundle run: | - scons target=release tools=no + scons target=release tools=no android_arch=armv7 + scons target=release tools=no android_arch=arm64v8 + cd platform/android/java + ./gradlew generateGodotTemplates + cd ../../.. ls -l bin/ - uses: actions/upload-artifact@v2 diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml index f708952f753..b81c06e54dc 100644 --- a/.github/workflows/linux_builds.yml +++ b/.github/workflows/linux_builds.yml @@ -98,7 +98,7 @@ jobs: # Upload cache on completion and check it out now - name: Load .scons_cache directory - id: linux-editor-cache + id: linux-sanitizers-cache uses: actions/cache@v2 with: path: ${{github.workspace}}/.scons_cache/ diff --git a/misc/ci/android-tools-linux.sh b/misc/ci/android-tools-linux.sh deleted file mode 100755 index 6114551861c..00000000000 --- a/misc/ci/android-tools-linux.sh +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/bash - -# SDK -# https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip -# SHA-256 444e22ce8ca0f67353bda4b85175ed3731cae3ffa695ca18119cbacef1c1bea0 -# latest version available here: https://developer.android.com/studio/index.html - -# NDK -# https://dl.google.com/android/repository/android-ndk-r15c-linux-x86_64.zip -# SHA-1 0bf02d4e8b85fd770fd7b9b2cdec57f9441f27a2 -# latest version available here: https://developer.android.com/ndk/downloads/index.html - -BASH_RC=~/.bashrc -GODOT_BUILD_TOOLS_PATH=./godot-dev/build-tools -mkdir -p $GODOT_BUILD_TOOLS_PATH -cd $GODOT_BUILD_TOOLS_PATH - -ANDROID_BASE_URL=http://dl.google.com/android/repository - -ANDROID_SDK_RELEASE=4333796 -ANDROID_SDK_DIR=android-sdk -ANDROID_SDK_FILENAME=sdk-tools-linux-$ANDROID_SDK_RELEASE.zip -ANDROID_SDK_URL=$ANDROID_BASE_URL/$ANDROID_SDK_FILENAME -ANDROID_SDK_PATH=$GODOT_BUILD_TOOLS_PATH/$ANDROID_SDK_DIR -ANDROID_SDK_SHA256=92ffee5a1d98d856634e8b71132e8a95d96c83a63fde1099be3d86df3106def9 - -ANDROID_NDK_RELEASE=r21 -ANDROID_NDK_DIR=android-ndk -ANDROID_NDK_FILENAME=android-ndk-$ANDROID_NDK_RELEASE-linux-x86_64.zip -ANDROID_NDK_URL=$ANDROID_BASE_URL/$ANDROID_NDK_FILENAME -ANDROID_NDK_PATH=$GODOT_BUILD_TOOLS_PATH/$ANDROID_NDK_DIR -ANDROID_NDK_SHA1=afc9c0b9faad222898ac8168c78ad4ccac8a1b5c - -echo -echo "Download and install Android development tools ..." -echo - -if [ ! -e $ANDROID_SDK_FILENAME ]; then - echo "Downloading: Android SDK ..." - curl -L -O $ANDROID_SDK_URL -else - echo $ANDROID_SDK_SHA1 $ANDROID_SDK_FILENAME > $ANDROID_SDK_FILENAME.sha1 - if [ $(shasum -a 256 < $ANDROID_SDK_FILENAME | awk '{print $1;}') != $ANDROID_SDK_SHA1 ]; then - echo "Downloading: Android SDK ..." - curl -L -O $ANDROID_SDK_URL - fi -fi - -if [ ! -d $ANDROID_SDK_DIR ]; then - echo "Extracting: Android SDK ..." - unzip -qq $ANDROID_SDK_FILENAME -d $ANDROID_SDK_DIR - echo -fi - -if [ ! -e $ANDROID_NDK_FILENAME ]; then - echo "Downloading: Android NDK ..." - curl -L -O $ANDROID_NDK_URL -else - echo $ANDROID_NDK_MD5 $ANDROID_NDK_FILENAME > $ANDROID_NDK_FILENAME.md5 - if [ $(shasum -a 1 < $ANDROID_NDK_FILENAME | awk '{print $1;}') != $ANDROID_NDK_SHA1 ]; then - echo "Downloading: Android NDK ..." - curl -L -O $ANDROID_NDK_URL - fi -fi - -if [ ! -d $ANDROID_NDK_DIR ]; then - echo "Extracting: Android NDK ..." - unzip -qq $ANDROID_NDK_FILENAME - mv android-ndk-$ANDROID_NDK_RELEASE $ANDROID_NDK_DIR - echo -fi - -mkdir -p ~/.android && echo "count=0" > ~/.android/repositories.cfg -echo "Installing: Accepting Licenses ..." -yes | $ANDROID_SDK_DIR/tools/bin/sdkmanager --licenses > /dev/null -echo "Installing: Android Build and Platform Tools ..." -yes | $ANDROID_SDK_DIR/tools/bin/sdkmanager 'tools' > /dev/null -yes | $ANDROID_SDK_DIR/tools/bin/sdkmanager 'platform-tools' > /dev/null -yes | $ANDROID_SDK_DIR/tools/bin/sdkmanager 'build-tools;29.0.3' > /dev/null -echo - -EXPORT_VAL="export ANDROID_HOME=$ANDROID_SDK_PATH" -if ! grep -q "^$EXPORT_VAL" $BASH_RC; then - echo $EXPORT_VAL >> $BASH_RC -fi -#eval $EXPORT_VAL - -EXPORT_VAL="export ANDROID_NDK_ROOT=$ANDROID_NDK_PATH" -if ! grep -q "^$EXPORT_VAL" $BASH_RC; then - echo $EXPORT_VAL >> $BASH_RC -fi -#eval $EXPORT_VAL - -EXPORT_VAL="export PATH=$PATH:$ANDROID_SDK_PATH/tools" -if ! grep -q "^export PATH=.*$ANDROID_SDK_PATH/tools.*" $BASH_RC; then - echo $EXPORT_VAL >> $BASH_RC -fi -#eval $EXPORT_VAL - -EXPORT_VAL="export PATH=$PATH:$ANDROID_SDK_PATH/tools/bin" -if ! grep -q "^export PATH=.*$ANDROID_SDK_PATH/tools/bin.*" $BASH_RC; then - echo $EXPORT_VAL >> $BASH_RC -fi -#eval $EXPORT_VAL - -echo -echo "Done!" -echo