CI: Update Artifact actions to v4 #60
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Build Python for Android wth MacOS emulator" | |
on: | |
push: | |
paths: | |
- '.github/workflows/android-macos-python.yml' | |
- '.github/workflows/adb-emu.sh' | |
tags: | |
- v* | |
pull_request: | |
paths: | |
- '.github/workflows/android-macos-python.yml' | |
- '.github/workflows/adb-emu.sh' | |
jobs: | |
build-android: | |
name: ${{ matrix.ndk-arch }} on ${{ matrix.arch }} Android | |
runs-on: macos-13 | |
strategy: | |
matrix: | |
ndk-arch: [x86_64] | |
arch: [x86_64] | |
api-level: [21] | |
target: [default] | |
include: | |
- ndk-arch: arm64-v8a | |
arch: x86_64 | |
api-level: 30 | |
target: google_apis | |
- ndk-arch: x86 | |
arch: x86 | |
api-level: 21 | |
target: default | |
- ndk-arch: armeabi-v7a | |
arch: x86_64 | |
api-level: 30 | |
target: google_apis | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: create directories | |
run: | | |
mkdir -p build-python/python-cmake-buildsystem | |
mkdir -p build-boost/Boost-for-Android | |
mkdir -p build-godot | |
- name: Prepare dist version | |
id: cmake-dist-version | |
shell: cmake -P {0} | |
run: | | |
include(Version.cmake) | |
file(APPEND "$ENV{GITHUB_OUTPUT}" "dist-version=${DIST_VERSION}") | |
- uses: actions/cache@v3 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
~/.android/debug.keystore | |
key: avd-${{ matrix.api-level }}-${{ matrix.target }}-${{ matrix.arch }} | |
- name: run emulator to generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
target: ${{ matrix.target }} | |
arch: ${{ matrix.arch }} | |
profile: Galaxy Nexus | |
cores: 2 | |
sdcard-path-or-size: 100M | |
emulator-build: 7425822 # https://github.com/ReactiveCircus/android-emulator-runner/issues/160 | |
avd-name: test | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: false | |
working-directory: ./ | |
ndk: 23.0.7421159 | |
cmake: 3.10.2.4988404 | |
channel: beta | |
script: echo "Generated AVD snapshot for caching." | |
- uses: actions/checkout@v3 | |
with: | |
repository: 'o01eg/python-cmake-buildsystem' | |
ref: 'android-initial-support' | |
path: 'build-python/python-cmake-buildsystem' | |
- name: run action | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
target: ${{ matrix.target }} | |
arch: ${{ matrix.arch }} | |
profile: Galaxy Nexus | |
cores: 2 | |
ram-size: 2048M | |
sdcard-path-or-size: 100M | |
emulator-build: 7425822 # https://github.com/ReactiveCircus/android-emulator-runner/issues/160 | |
avd-name: test | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
working-directory: build-python/python-cmake-buildsystem | |
ndk: 23.0.7421159 | |
cmake: 3.10.2.4988404 | |
channel: beta | |
script: | | |
# ls -lR /Users/runner/Library/Android/sdk | |
adb devices | |
mkdir ../python-build | |
mkdir ../python-install-prefix | |
cd ../python-build | |
# ls -lR /Users/runner/Library/Android/sdk/ndk/23.0.7421159/ | |
cmake -DANDROID_NDK=/Users/runner/Library/Android/sdk/ndk/23.0.7421159/ -DCMAKE_INSTALL_PREFIX:PATH=../python-install-prefix -DCMAKE_TOOLCHAIN_FILE=/Users/runner/Library/Android/sdk/ndk/23.0.7421159/build/cmake/android.toolchain.cmake -DANDROID_ABI=${{ matrix.ndk-arch }} -DCMAKE_CROSSCOMPILING_EMULATOR=/Users/runner/work/freeorion-sdk/freeorion-sdk/.github/workflows/adb-emu.sh -DANDROID_ALLOW_UNDEFINED_SYMBOLS=On -DENABLE_DECIMAL=Off -DENABLE_CTYPES=Off -DENABLE_CODECS_JP=OFF -DENABLE_CODECS_KR=OFF -DENABLE_CODECS_TW=OFF -DENABLE_MULTIBYTECODEC=OFF -DENABLE_CODECS_CN=OFF -DENABLE_CODECS_HK=OFF -DENABLE_CODECS_ISO2022=OFF -DBUILD_EXTENSIONS_AS_BUILTIN=On -DANDROID_PLATFORM=android-21 ../python-cmake-buildsystem/ | |
cmake --build . -- VERBOSE=1 | |
cmake --build . --target install | |
- name: Pack Python SDK | |
shell: bash | |
run: | | |
cd build-python/python-install-prefix/lib/python3.9 | |
zip -r -9 -q --exclude=*.pyc --exclude=*.a --exclude=*.so ../../../../python39.zip . | |
cd ../.. | |
zip -r -9 -q ../../FreeOrionSDK_${{ steps.cmake-dist-version.outputs.dist-version }}_Android-${{ matrix.ndk-arch }}.zip include/ lib/libpython3.9.a bin/python | |
cd .. | |
- uses: actions/checkout@v3 | |
with: | |
repository: 'moritz-wundke/Boost-for-Android' | |
ref: '529027ab2f1253f17797d364fb6f456d57dc9d5e' | |
path: 'build-boost/Boost-for-Android' | |
- name: Build Boost | |
shell: bash | |
run: | | |
export PYTHON_PATH=$(cd build-python/python-install-prefix/ ; pwd) | |
cd build-boost/Boost-for-Android | |
CXXFLAGS="-std=c++14" ./build-android.sh --boost=1.78.0 --arch=${{ matrix.ndk-arch }} --with-iconv --with-python=${PYTHON_PATH} --layout=system /Users/runner/Library/Android/sdk/ndk/23.0.7421159/ | |
- name: Pack Boost | |
shell: bash | |
run: | | |
pushd build-boost/Boost-for-Android/build/out/${{ matrix.ndk-arch }}/ | |
zip -r -9 -q ../../../../../FreeOrionSDK_${{ steps.cmake-dist-version.outputs.dist-version }}_Android-${{ matrix.ndk-arch }}.zip include/ lib/ | |
popd | |
pushd build-boost/Boost-for-Android/libiconv-libicu-android/${{ matrix.ndk-arch }}/ | |
zip -r -9 -q ../../../../FreeOrionSDK_${{ steps.cmake-dist-version.outputs.dist-version }}_Android-${{ matrix.ndk-arch }}.zip lib/libicui18n.a lib/libicuuc.a lib/libicudata.a lib/libiconv.so | |
- uses: actions/upload-artifact@v4 | |
name: Artifacts | |
if: ${{ !startsWith(github.ref, 'refs/tags/v') }} | |
with: | |
name: python ${{ matrix.ndk-arch }} SDK | |
path: | | |
${{ matrix.ndk-arch == 'x86_64' && 'python39.zip' || '' }} | |
FreeOrionSDK_${{ steps.cmake-dist-version.outputs.dist-version }}_Android-${{ matrix.ndk-arch }}.zip | |
- name: Prepare Release | |
if: startsWith(github.ref, 'refs/tags/v') | |
id: prepare-release-options | |
run: | | |
echo "release-name=$(git tag -ln --format '%(subject)' ${{ github.ref_name }})" >> $GITHUB_OUTPUT | |
- uses: softprops/action-gh-release@v1 | |
name: Release | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
name: ${{ steps.prepare-release-options.outputs.release-name }} | |
draft: true | |
files: | | |
python39.zip | |
FreeOrionSDK_${{ steps.cmake-dist-version.outputs.dist-version }}_Android-${{ matrix.ndk-arch }}.zip | |
token: ${{ secrets.RELEASE_TOKEN }} |