1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00

[CI] android adjustments

This commit is contained in:
Andrey Filipenkov 2024-04-22 10:26:05 +03:00
parent d7bf6b7dbe
commit 61093ab027
3 changed files with 46 additions and 28 deletions

View File

@ -88,16 +88,16 @@ jobs:
preset: windows-mingw-conan-linux preset: windows-mingw-conan-linux
conan_profile: mingw32-linux.jinja conan_profile: mingw32-linux.jinja
- platform: android-32 - platform: android-32
os: ubuntu-22.04 os: macos-14
extension: apk extension: apk
preset: android-conan-ninja-release preset: android-daily-release
conan_profile: android-32 conan_profile: android-32
conan_options: --conf tools.android:ndk_path=$ANDROID_NDK_ROOT conan_options: --conf tools.android:ndk_path=$ANDROID_NDK_ROOT
artifact_platform: armeabi-v7a artifact_platform: armeabi-v7a
- platform: android-64 - platform: android-64
os: ubuntu-22.04 os: macos-14
extension: apk extension: apk
preset: android-conan-ninja-release preset: android-daily-release
conan_profile: android-64 conan_profile: android-64
conan_options: --conf tools.android:ndk_path=$ANDROID_NDK_ROOT conan_options: --conf tools.android:ndk_path=$ANDROID_NDK_ROOT
artifact_platform: arm64-v8a artifact_platform: arm64-v8a
@ -187,6 +187,12 @@ jobs:
env: env:
GENERATE_ONLY_BUILT_CONFIG: 1 GENERATE_ONLY_BUILT_CONFIG: 1
- uses: actions/setup-java@v4
if: ${{ startsWith(matrix.platform, 'android') }}
with:
distribution: 'temurin'
java-version: '11'
- name: Build Number - name: Build Number
run: | run: |
source '${{github.workspace}}/CI/get_package_name.sh' source '${{github.workspace}}/CI/get_package_name.sh'
@ -215,7 +221,7 @@ jobs:
run: | run: |
ctest --preset ${{matrix.preset}} ctest --preset ${{matrix.preset}}
- name: Kill XProtect to work around CPack issue on macOS - name: Kill XProtect to work around CPack issue on macOS
if: ${{ startsWith(matrix.platform, 'mac') }} if: ${{ startsWith(matrix.platform, 'mac') }}
run: | run: |
# Cf. https://github.com/actions/runner-images/issues/7522#issuecomment-1556766641 # Cf. https://github.com/actions/runner-images/issues/7522#issuecomment-1556766641
@ -234,13 +240,6 @@ jobs:
&& '${{github.workspace}}/CI/${{matrix.platform}}/post_pack.sh' '${{github.workspace}}' "$(ls '${{ env.VCMI_PACKAGE_FILE_NAME }}'.*)" && '${{github.workspace}}/CI/${{matrix.platform}}/post_pack.sh' '${{github.workspace}}' "$(ls '${{ env.VCMI_PACKAGE_FILE_NAME }}'.*)"
rm -rf _CPack_Packages 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 - name: Additional logs
if: ${{ failure() && steps.cpack.outcome == 'failure' && matrix.platform == 'msvc' }} if: ${{ failure() && steps.cpack.outcome == 'failure' && matrix.platform == 'msvc' }}
run: | run: |
@ -254,7 +253,14 @@ jobs:
name: ${{ env.VCMI_PACKAGE_FILE_NAME }} - ${{ matrix.platform }} name: ${{ env.VCMI_PACKAGE_FILE_NAME }} - ${{ matrix.platform }}
path: | path: |
${{github.workspace}}/out/build/${{matrix.preset}}/${{ env.VCMI_PACKAGE_FILE_NAME }}.${{ matrix.extension }} ${{github.workspace}}/out/build/${{matrix.preset}}/${{ env.VCMI_PACKAGE_FILE_NAME }}.${{ matrix.extension }}
- name: Find Android package
if: ${{ startsWith(matrix.platform, 'android') }}
run: |
builtApkPath="$(ls ${{ github.workspace }}/out/build/${{ matrix.preset }}/android-build/vcmi-app/build/outputs/apk/release/*.${{ matrix.extension }})"
ANDROID_APK_PATH="${{ github.workspace }}/$VCMI_PACKAGE_FILE_NAME.${{ matrix.extension }}"
mv "$builtApkPath" "$ANDROID_APK_PATH"
echo "ANDROID_APK_PATH=$ANDROID_APK_PATH" >> $GITHUB_ENV
- name: Android artifacts - name: Android artifacts
if: ${{ startsWith(matrix.platform, 'android') }} if: ${{ startsWith(matrix.platform, 'android') }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@ -262,7 +268,7 @@ jobs:
name: ${{ env.VCMI_PACKAGE_FILE_NAME }} - ${{ matrix.platform }} name: ${{ env.VCMI_PACKAGE_FILE_NAME }} - ${{ matrix.platform }}
path: | path: |
${{ env.ANDROID_APK_PATH }} ${{ env.ANDROID_APK_PATH }}
- name: Symbols - name: Symbols
if: ${{ matrix.platform == 'msvc' }} if: ${{ matrix.platform == 'msvc' }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@ -283,19 +289,17 @@ jobs:
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' && matrix.platform != 'mingw-32' }} 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' && matrix.platform != 'mingw-32' }}
continue-on-error: true continue-on-error: true
run: | run: |
if cd '${{github.workspace}}/android/vcmi-app/build/outputs/apk/daily' ; then if [ -z '${{ env.ANDROID_APK_PATH }}' ] ; then
mv '${{ env.ANDROID_APK_PATH }}' "$VCMI_PACKAGE_FILE_NAME.${{ matrix.extension }}"
else
cd '${{github.workspace}}/out/build/${{matrix.preset}}' cd '${{github.workspace}}/out/build/${{matrix.preset}}'
fi fi
source '${{github.workspace}}/CI/upload_package.sh' source '${{github.workspace}}/CI/upload_package.sh'
env: env:
DEPLOY_RSA: ${{ secrets.DEPLOY_RSA }} DEPLOY_RSA: ${{ secrets.DEPLOY_RSA }}
PACKAGE_EXTENSION: ${{ matrix.extension }} PACKAGE_EXTENSION: ${{ matrix.extension }}
# copy-pasted mostly # copy-pasted mostly
bundle_release: bundle_release:
needs: build needs: build
if: always() && github.ref == 'refs/heads/master' if: always() && github.ref == 'refs/heads/master'
strategy: strategy:
@ -303,7 +307,6 @@ jobs:
include: include:
- platform: android-32 - platform: android-32
os: ubuntu-22.04 os: ubuntu-22.04
extension: aab
preset: android-conan-ninja-release preset: android-conan-ninja-release
conan_profile: android-32 conan_profile: android-32
conan_options: --conf tools.android:ndk_path=$ANDROID_NDK_ROOT conan_options: --conf tools.android:ndk_path=$ANDROID_NDK_ROOT
@ -367,13 +370,13 @@ jobs:
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: Android JNI android-64 name: Android JNI android-64
path: ${{ github.workspace }}/android/vcmi-app/src/main/jniLibs/ path: ${{ github.workspace }}/out/build/${{ matrix.preset }}/android-build/libs
- name: Create Android package - name: Create Android package
run: | run: |
cd android cd out/build/${{ matrix.preset }}/android-build
./gradlew bundleRelease --info ./gradlew bundleRelease --info
echo ANDROID_APK_PATH="$(ls ${{ github.workspace }}/android/vcmi-app/build/outputs/bundle/release/*.aab)" >> $GITHUB_ENV echo ANDROID_APK_PATH="$(ls ${{ github.workspace }}/out/build/${{ matrix.preset }}/android-build/vcmi-app/build/outputs/bundle/release/*.aab)" >> $GITHUB_ENV
env: env:
ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }} ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}

View File

@ -1,8 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
sudo apt-get update echo "ANDROID_NDK_ROOT=$ANDROID_HOME/ndk/25.2.9519653" >> $GITHUB_ENV
sudo apt-get install ninja-build
brew install ninja
mkdir ~/.conan ; cd ~/.conan mkdir ~/.conan ; cd ~/.conan
curl -L "https://github.com/vcmi/vcmi-dependencies/releases/download/android-1.0/$DEPS_FILENAME.txz" \ curl -L "https://github.com/vcmi/vcmi-dependencies/releases/download/android-1.1/$DEPS_FILENAME.txz" \
| tar -xf - --xz | tar -xf - --xz

View File

@ -52,7 +52,7 @@
"hidden": true, "hidden": true,
"cacheVariables": { "cacheVariables": {
"ENABLE_LOBBY": "ON", "ENABLE_LOBBY": "ON",
"ENABLE_TEST": "ON", "ENABLE_TEST": "ON",
"ENABLE_LUA": "ON" "ENABLE_LUA": "ON"
} }
}, },
@ -294,6 +294,15 @@
"cacheVariables": { "cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo" "CMAKE_BUILD_TYPE": "RelWithDebInfo"
} }
},
{
"name": "android-daily-release",
"displayName": "Android daily release",
"description": "VCMI Android daily build",
"inherits": "android-conan-ninja-release",
"cacheVariables": {
"ANDROID_GRADLE_PROPERTIES": "applicationIdSuffix=.daily;signingConfig=dailySigning;applicationLabel=VCMI daily"
}
} }
], ],
"buildPresets": [ "buildPresets": [
@ -412,6 +421,11 @@
"name": "android-conan-ninja-release", "name": "android-conan-ninja-release",
"configurePreset": "android-conan-ninja-release", "configurePreset": "android-conan-ninja-release",
"inherits": "default-release" "inherits": "default-release"
},
{
"name": "android-daily-release",
"configurePreset": "android-daily-release",
"inherits": "android-conan-ninja-release"
} }
], ],
"testPresets": [ "testPresets": [