Custom build #2
Workflow file for this run
This file contains hidden or 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: Custom build | |
on: | |
workflow_dispatch: | |
inputs: | |
os: | |
description: "Operating system to run on" | |
required: true | |
default: "ubuntu-latest" | |
type: choice | |
options: | |
- "ubuntu-latest" | |
- "macos-latest" | |
mode: | |
description: "Build mode" | |
required: true | |
default: "debug" | |
type: choice | |
options: | |
- "debug" | |
- "release" | |
artifact: | |
description: "Artifact type" | |
required: true | |
default: "apk" | |
type: choice | |
options: | |
- "aab" | |
- "aar" | |
- "apk" | |
bootstrap: | |
description: "Bootstrap to use" | |
required: true | |
default: "sdl2" | |
type: choice | |
options: | |
- "qt" | |
- "sdl2" | |
- "service_library" | |
- "service_only" | |
- "webview" | |
requirements: | |
description: "Comma separated requirements" | |
required: true | |
default: "python3,kivy" | |
env: | |
# TODO | |
APK_ARTIFACT_FILENAME: bdist_custom_build-debug-1.1.apk | |
AAB_ARTIFACT_FILENAME: bdist_custom_build-release-1.1.aab | |
AAR_ARTIFACT_FILENAME: bdist_custom_build-release-1.1.aar | |
PYTHONFORANDROID_PREREQUISITES_INSTALL_INTERACTIVE: 0 | |
jobs: | |
# TODO: rename | |
build: | |
name: Build test APP [ ${{ github.event.inputs.os }} | ${{ github.event.inputs.mode }} | ${{ github.event.inputs.artifact }} | ${{ github.event.inputs.bootstrap }} | ${{ github.event.inputs.requirements }}] | |
runs-on: ${{ github.event.inputs.os }} | |
# TODO | |
# env: | |
# ANDROID_HOME: ${HOME}/.android | |
# ANDROID_SDK_ROOT: ${HOME}/.android/android-sdk | |
# ANDROID_SDK_HOME: ${HOME}/.android/android-sdk | |
# ANDROID_NDK_HOME: ${HOME}/.android/android-ndk | |
steps: | |
- name: Checkout python-for-android | |
uses: actions/checkout@v4 | |
- name: Pull the python-for-android docker image | |
run: make docker/pull | |
- name: Build python-for-android docker image | |
run: make docker/build | |
- name: Build multi-arch artifact with docker | |
run: | | |
docker run --name p4a-latest --rm kivy/python-for-android make MODE=${{ github.event.inputs.mode }} ARTIFACT=${{ github.event.inputs.artifact }} REQUIREMENTS=${{ github.event.inputs.requirements }} BOOTSTRAP=${{ github.event.inputs.bootstrap }} testapps-generic | |
- name: Copy produced artifacts from docker container (*.apk, *.aab) | |
if: github.event.inputs.bootstrap != 'service_library' | |
run: | | |
mkdir -p dist | |
docker cp p4a-latest:/home/user/app/testapps/on_device_unit_tests/${{ env.APK_ARTIFACT_FILENAME }} dist/ | |
docker cp p4a-latest:/home/user/app/testapps/on_device_unit_tests/${{ env.AAB_ARTIFACT_FILENAME }} dist/ | |
- name: Copy produced artifacts from docker container (*.aar) | |
if: github.event.inputs.bootstrap == 'service_library' | |
run: | | |
mkdir -p dist | |
docker cp p4a-latest:/home/user/app/testapps/on_device_unit_tests/${{ env.AAR_ARTIFACT_FILENAME }} dist/ | |
- name: Rename artifacts to include the build platform name (*.apk, *.aab, *.aar) | |
run: | | |
if [ -f dist/${{ env.APK_ARTIFACT_FILENAME }} ]; then mv dist/${{ env.APK_ARTIFACT_FILENAME }} dist/${{ github.event.inputs.os }}-${{ github.event.inputs.bootstrap }}-${{ env.APK_ARTIFACT_FILENAME }}; fi | |
if [ -f dist/${{ env.AAB_ARTIFACT_FILENAME }} ]; then mv dist/${{ env.AAB_ARTIFACT_FILENAME }} dist/${{ github.event.inputs.os }}-${{ github.event.inputs.bootstrap }}-${{ env.AAB_ARTIFACT_FILENAME }}; fi | |
if [ -f dist/${{ env.AAR_ARTIFACT_FILENAME }} ]; then mv dist/${{ env.AAR_ARTIFACT_FILENAME }} dist/${{ github.event.inputs.os }}-${{ github.event.inputs.bootstrap }}-${{ env.AAR_ARTIFACT_FILENAME }}; fi | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ github.event.inputs.os }}-${{ github.event.inputs.bootstrap }}-artifacts | |
path: dist |