|
| 1 | +# The 32 and 64 bit version of these actions should be kept in sync |
| 2 | +name: Android 32/64-bit Release |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - 'master' |
| 8 | + - 'Stable*' |
| 9 | + tags: |
| 10 | + - 'v*' |
| 11 | + paths-ignore: |
| 12 | + - 'docs/**' |
| 13 | + pull_request: |
| 14 | + branches: |
| 15 | + - '*' |
| 16 | + paths-ignore: |
| 17 | + - 'docs/**' |
| 18 | + |
| 19 | +defaults: |
| 20 | + run: |
| 21 | + shell: bash |
| 22 | + |
| 23 | +env: |
| 24 | + SOURCE_DIR: ${{ github.workspace }} |
| 25 | + QT_VERSION: 5.15.2 |
| 26 | + BUILD_TYPE: ${{ fromJSON('["DailyBuild", "StableBuild"]')[ github.ref_type == 'tag' || contains(github.ref, 'Stable_' ) ] }} |
| 27 | + |
| 28 | +jobs: |
| 29 | + build: |
| 30 | + runs-on: ubuntu-20.04 |
| 31 | + |
| 32 | + strategy: |
| 33 | + matrix: |
| 34 | + include: |
| 35 | + - architecture: 32bits |
| 36 | + eabi: armeabi-v7a |
| 37 | + ARTIFACT: QGroundControl32.apk |
| 38 | + - architecture: 64bits |
| 39 | + eabi: arm64-v8a |
| 40 | + ARTIFACT: QGroundControl64.apk |
| 41 | + |
| 42 | + steps: |
| 43 | + - name: Checkout repo |
| 44 | + uses: actions/checkout@v3 |
| 45 | + with: |
| 46 | + submodules: recursive |
| 47 | + |
| 48 | + - name: Free Disk Space (Ubuntu) |
| 49 | + |
| 50 | + with: |
| 51 | + android: 'false' |
| 52 | + continue-on-error: true |
| 53 | + |
| 54 | + - name: Get all tags for correct version determination |
| 55 | + working-directory: ${{ github.workspace }} |
| 56 | + run: | |
| 57 | + git fetch --all --tags -f --depth 1 |
| 58 | +
|
| 59 | + - name: Install Qt |
| 60 | + uses: jurplel/install-qt-action@v3 |
| 61 | + with: |
| 62 | + version: ${{ env.QT_VERSION }} |
| 63 | + host: linux |
| 64 | + target: android |
| 65 | + dir: ${{ runner.temp }} |
| 66 | + modules: qtcharts |
| 67 | + setup-python: true |
| 68 | + |
| 69 | + - name: Install Android NDK |
| 70 | + uses: nttld/setup-ndk@v1 |
| 71 | + id: setup-ndk |
| 72 | + with: |
| 73 | + ndk-version: r21e |
| 74 | + add-to-path: false |
| 75 | + |
| 76 | + - name: Remove Android SDKs to force usage of android-33 only |
| 77 | + run: | |
| 78 | + ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --uninstall "platforms;android-33-ext5" |
| 79 | + ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --uninstall "platforms;android-33-ext4" |
| 80 | + ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --uninstall "platforms;android-34" |
| 81 | + ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --uninstall "platforms;android-34-ext8" |
| 82 | + ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --uninstall "platforms;android-34-ext10" |
| 83 | + ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --uninstall "platforms;android-34-ext11" |
| 84 | + ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --uninstall "platforms;android-34-ext12" |
| 85 | + ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --uninstall "platforms;android-35" |
| 86 | + ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --uninstall "platforms;android-35-ext14" |
| 87 | +
|
| 88 | + - name: Install ccache |
| 89 | + run: sudo apt-get install ccache |
| 90 | + |
| 91 | + - name: Prepare ccache timestamp |
| 92 | + id: ccache_cache_timestamp |
| 93 | + run: echo "name=timestamp::$(date --utc +'%Y-%m-%d-%H\;%M\;%S')" >> $GITHUB_OUTPUT |
| 94 | + |
| 95 | + - name: ccache cache files |
| 96 | + uses: actions/cache@v3 |
| 97 | + with: |
| 98 | + path: ~/.ccache |
| 99 | + key: ${{ runner.os }}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}} |
| 100 | + restore-keys: ${{ runner.os }}-ccache- |
| 101 | + |
| 102 | + - name: Setup ccache |
| 103 | + run: | |
| 104 | + mkdir -p ~/.ccache |
| 105 | + echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf |
| 106 | + echo "compression = true" >> ~/.ccache/ccache.conf |
| 107 | + echo "compression_level = 5" >> ~/.ccache/ccache.conf |
| 108 | + ccache -s |
| 109 | + ccache -z |
| 110 | +
|
| 111 | + - name: Create build directory |
| 112 | + run: mkdir ${{ runner.temp }}/shadow_build_dir |
| 113 | + |
| 114 | + - name: Install gstreamer |
| 115 | + working-directory: ${{ github.workspace }} |
| 116 | + run: | |
| 117 | + wget --quiet https://gstreamer.freedesktop.org/data/pkg/android/1.18.6/gstreamer-1.0-android-universal-1.18.6.tar.xz |
| 118 | + mkdir gstreamer-1.0-android-universal-1.18.6 |
| 119 | + tar xf gstreamer-1.0-android-universal-1.18.6.tar.xz -C gstreamer-1.0-android-universal-1.18.6 |
| 120 | +
|
| 121 | + - name: Update android manifest |
| 122 | + if: github.ref_name != 'Stable' |
| 123 | + run: | |
| 124 | + ${SOURCE_DIR}/tools/update_android_manifest_package.sh ${{ github.ref_name }} |
| 125 | +
|
| 126 | + - name: Build |
| 127 | + working-directory: ${{ runner.temp }}/shadow_build_dir |
| 128 | + env: |
| 129 | + ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} |
| 130 | + ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }} |
| 131 | + ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} |
| 132 | + ANDROID_NDK_LATEST_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} |
| 133 | + ANDROID_NDK: ${{ steps.setup-ndk.outputs.ndk-path }} |
| 134 | + run: | |
| 135 | + qmake -r ${SOURCE_DIR}/qgroundcontrol.pro -spec android-clang CONFIG+=${BUILD_TYPE} CONFIG+=installer ANDROID_ABIS="${{ matrix.eabi }}" |
| 136 | + make -j2 |
| 137 | +
|
| 138 | + - name: ccache post-run |
| 139 | + run: ccache -s |
| 140 | + |
| 141 | + - name: Save artifact |
| 142 | + uses: actions/upload-artifact@master |
| 143 | + with: |
| 144 | + name: ${{ matrix.ARTIFACT }} |
| 145 | + path: ${{ runner.temp }}/shadow_build_dir/package/${{ matrix.ARTIFACT }} |
| 146 | + |
| 147 | + - name: Publish artifact to GitHub release |
| 148 | + if: ${{ startsWith(github.ref, 'refs/tags/v') }} |
| 149 | + uses: svenstaro/upload-release-action@v2 |
| 150 | + with: |
| 151 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 152 | + file: ${{ runner.temp }}/shadow_build_dir/package/${{ matrix.ARTIFACT }} |
| 153 | + asset_name: ${{ matrix.ARTIFACT }} |
| 154 | + tag: ${{ github.ref }} |
| 155 | + overwrite: true |
| 156 | + |
| 157 | + - name: Upload build to S3 Bucket |
| 158 | + if: github.event_name == 'push' |
| 159 | + working-directory: ${{ runner.temp }}/shadow_build_dir/package |
| 160 | + run: | |
| 161 | + aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 162 | + aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 163 | + aws s3 cp ${{ matrix.ARTIFACT }} s3://qgroundcontrol/builds/${{ github.ref_name }}/${{ matrix.ARTIFACT }} --region us-west-2 --acl public-read |
| 164 | +
|
| 165 | + - name: Upload tagged stable build to S3 latest Bucket |
| 166 | + if: github.event_name == 'push' && github.ref_type == 'tag' |
| 167 | + working-directory: ${{ runner.temp }}/shadow_build_dir/package |
| 168 | + run: | |
| 169 | + aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 170 | + aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 171 | + aws s3 cp ${{ matrix.ARTIFACT }} s3://qgroundcontrol/latest/${{ matrix.ARTIFACT }} --region us-west-2 --acl public-read |
0 commit comments