diff --git a/.github/workflows/github.yml b/.github/workflows/github.yml index ca77d40ab..f186a9576 100644 --- a/.github/workflows/github.yml +++ b/.github/workflows/github.yml @@ -83,6 +83,7 @@ jobs: extension: dmg preset: macos-conan-ninja-release conan_profile: macos-intel + conan_options: --options with_apple_system_libs=True artifact_platform: intel - platform: mac-arm os: macos-12 @@ -91,6 +92,7 @@ jobs: extension: dmg preset: macos-arm-conan-ninja-release conan_profile: macos-arm + conan_options: --options with_apple_system_libs=True artifact_platform: arm - platform: ios os: macos-12 @@ -99,6 +101,7 @@ jobs: extension: ipa preset: ios-release-conan conan_profile: ios-arm64 + conan_options: --options with_apple_system_libs=True - platform: msvc os: windows-latest test: 0 @@ -114,6 +117,20 @@ jobs: cmake_args: -G Ninja preset: windows-mingw-conan-linux conan_profile: mingw64-linux.jinja + - platform: android-32 + os: ubuntu-22.04 + extension: apk + preset: android-conan-ninja-release + conan_profile: android-32 + conan_options: --conf tools.android:ndk_path=$ANDROID_NDK_ROOT + artifact_platform: armeabi-v7a + - platform: android-64 + os: ubuntu-22.04 + extension: apk + preset: android-conan-ninja-release + conan_profile: android-64 + conan_options: --conf tools.android:ndk_path=$ANDROID_NDK_ROOT + artifact_platform: aarch64-v8a runs-on: ${{ matrix.os }} defaults: run: @@ -144,7 +161,7 @@ jobs: --build=never \ --profile:build=default \ --profile:host=CI/conan/${{ matrix.conan_profile }} \ - --options with_apple_system_libs=True + ${{ matrix.conan_options }} env: GENERATE_ONLY_BUILT_CONFIG: 1 @@ -188,6 +205,13 @@ jobs: && '${{github.workspace}}/CI/${{matrix.platform}}/post_pack.sh' '${{github.workspace}}' "$(ls '${{ env.VCMI_PACKAGE_FILE_NAME }}'.*)" rm -rf _CPack_Packages + - name: Create android package + if: ${{ startsWith(matrix.platform, 'android') }} + run: | + cd android + ./gradlew assembleDaily --info + echo ANDROID_APK_PATH="$(ls ${{ github.workspace }}/android/vcmi-app/build/outputs/apk/daily/*.${{ matrix.extension }})" >> $GITHUB_ENV + - name: Additional logs if: ${{ failure() && steps.cpack.outcome == 'failure' && matrix.platform == 'msvc' }} run: | @@ -201,12 +225,19 @@ jobs: name: ${{ env.VCMI_PACKAGE_FILE_NAME }} - ${{ matrix.platform }} path: | ${{github.workspace}}/out/build/${{matrix.preset}}/${{ env.VCMI_PACKAGE_FILE_NAME }}.${{ matrix.extension }} + - name: Android artifacts + if: ${{ startsWith(matrix.platform, 'android') }} + uses: actions/upload-artifact@v3 + with: + name: ${{ env.VCMI_PACKAGE_FILE_NAME }} - ${{ matrix.platform }} + path: | + ${{ env.ANDROID_APK_PATH }} - name: Upload build - if: ${{ matrix.pack == 1 && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/features/')) && matrix.platform != 'msvc' }} + if: ${{ (matrix.pack == 1 || startsWith(matrix.platform, 'android')) && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/features/')) && matrix.platform != 'msvc' }} continue-on-error: true run: | - cd '${{github.workspace}}/out/build/${{matrix.preset}}' + cd '${{github.workspace}}/android/vcmi-app/build/outputs/apk/daily' || cd '${{github.workspace}}/out/build/${{matrix.preset}}' source '${{github.workspace}}/CI/upload_package.sh' env: DEPLOY_RSA: ${{ secrets.DEPLOY_RSA }} @@ -219,11 +250,3 @@ jobs: env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} if: always() - - - name: Trigger Android - uses: peter-evans/repository-dispatch@v1 - if: ${{ (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/master') && matrix.platform == 'msvc' }} - with: - token: ${{ secrets.VCMI_ANDROID_ACCESS_TOKEN }} - repository: vcmi/vcmi-android - event-type: vcmi diff --git a/CI/android-32/before_install.sh b/CI/android-32/before_install.sh new file mode 100755 index 000000000..12adadd89 --- /dev/null +++ b/CI/android-32/before_install.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +DEPS_FILENAME=armeabi-v7a +. CI/android/before_install.sh diff --git a/CI/android-64/before_install.sh b/CI/android-64/before_install.sh new file mode 100755 index 000000000..b26082d29 --- /dev/null +++ b/CI/android-64/before_install.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +DEPS_FILENAME=aarch64-v8a +. CI/android/before_install.sh diff --git a/CI/android/before_install.sh b/CI/android/before_install.sh new file mode 100755 index 000000000..feec37dff --- /dev/null +++ b/CI/android/before_install.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +sudo apt-get update +sudo apt-get install ninja-build + +mkdir ~/.conan ; cd ~/.conan +curl -L "https://github.com/vcmi/vcmi-dependencies/releases/download/android-1.0/$DEPS_FILENAME.txz" \ + | tar -xf - --xz diff --git a/CMakePresets.json b/CMakePresets.json index 2abf86650..99e31c8cb 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -186,6 +186,18 @@ "cacheVariables": { "CMAKE_PREFIX_PATH": "${sourceDir}/build/iphoneos" } + }, + { + "name": "android-conan-ninja-release", + "displayName": "Android release", + "description": "VCMI Android Ninja using Conan", + "inherits": [ + "build-with-conan", + "default-release" + ], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } } ], "buildPresets": [ @@ -255,6 +267,11 @@ "name": "ios-release-legacy", "configurePreset": "ios-release-legacy", "inherits": "ios-release-conan" + }, + { + "name": "android-conan-ninja-release", + "configurePreset": "android-conan-ninja-release", + "inherits": "default-release" } ], "testPresets": [