name: Build AndroidGamepad on: push: branches: ["master"] pull_request: branches: ["master"] workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - name: "Checkout repo" uses: actions/checkout@v3 - name: "Install system dependencies" run: | sudo apt update sudo apt install -y openjdk-11-jdk unzip wget git g++ libgl-dev python3 cmake ninja-build - name: Cache Android Tools id: cache-cmdline-tools uses: actions/cache@v3 with: path: cmdline-tools key: ${{ runner.os }}-cmdline-tools - name: "Install Android SDK|NDK" if: steps.cache-cmdline-tools.outputs.cache-hit != 'true' run: | wget https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip echo "2ccbda4302db862a28ada25aa7425d99dce9462046003c1714b059b5c47970d8 commandlinetools-linux-8512546_latest.zip" | sha256sum --check --status unzip commandlinetools-linux-8512546_latest.zip export ANDROID_SDK_ROOT=$(pwd)/cmdline-tools yes | $ANDROID_SDK_ROOT/bin/sdkmanager --licenses --sdk_root=$ANDROID_SDK_ROOT >> /dev/null $ANDROID_SDK_ROOT/bin/sdkmanager --install "platforms;android-31" "platform-tools" "build-tools;31.0.0" --sdk_root=$ANDROID_SDK_ROOT >> /dev/null $ANDROID_SDK_ROOT/bin/sdkmanager --install "ndk;23.1.7779620" --sdk_root=$ANDROID_SDK_ROOT >> /dev/null echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" >> $GITHUB_ENV echo "ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/23.1.7779620" >> $GITHUB_ENV - name: Cache Qt source code id: cache-qt-code uses: actions/cache@v3 with: path: qt-code key: ${{ runner.os }}-qt-code - name: "Get Qt source code" if: steps.cache-qt-code.outputs.cache-hit != 'true' run: | git clone https://code.qt.io/qt/qt5.git qt6 cd qt6 git switch 6.4 perl init-repository --module-subset=qtbase,qtsensors - name: Cache Qt host build id: cache-qt-host uses: actions/cache@v3 with: path: qt-host key: ${{ runner.os }}-qt-host - name: "Build host Qt" if: steps.cache-qt-host.outputs.cache-hit != 'true' run: | installdir=$(pwd) cd qt6 mkdir qt6-host cd qt6-host ../configure -prefix $installdir/qt-host cmake --build . --parallel $(nproc) cmake --install . - name: Cache Qt android build id: cache-qt-android uses: actions/cache@v3 with: path: qt-android key: ${{ runner.os }}-qt-android - name: "Build android Qt" if: steps.cache-qt-android.outputs.cache-hit != 'true' run: | installdir=$(pwd) cd qt6 mkdir qt6-android cd qt6-android ../configure ANDROID_PLATFORM=31 -platform android-clang -prefix $HOME/QtAndroid -android-ndk ${{ env.ANDROID_NDK_ROOT }} -android-sdk ${{ env.ANDROID_SDK_ROOT }} -android-abis arm64-v8a -qt-host-path $installdir/qt-android cmake --build . --parallel $(nproc) cmake --install . - name: "Configure AndroidGamepad" run: | mkdir build cd build $HOME/QtAndroid/bin/qmake ../AndroidGamepad.pro - name: "Build AndroidGamepad" run: | cd build make -j $(nproc) apk - name: Upload artifact uses: actions/upload-artifact@v3 with: name: AndroidGamepad-arm64.apk path: ./build/android-build/build/outputs/apk/debug/android-build-debug.apk