|
| 1 | +name: Custom build |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + arch: |
| 7 | + description: "Comma separated architectures (e.g., armeabi-v7a, arm64-v8a, x86_64, x86)" |
| 8 | + required: true |
| 9 | + default: "armeabi-v7a,arm64-v8a,x86_64,x86" |
| 10 | + artifact: |
| 11 | + description: "Artifact type" |
| 12 | + required: true |
| 13 | + default: "apk" |
| 14 | + type: choice |
| 15 | + options: |
| 16 | + - "aab" |
| 17 | + - "aar" |
| 18 | + - "apk" |
| 19 | + bootstrap: |
| 20 | + description: "Bootstrap to use" |
| 21 | + required: true |
| 22 | + default: "sdl2" |
| 23 | + type: choice |
| 24 | + options: |
| 25 | + - "qt" |
| 26 | + - "sdl2" |
| 27 | + - "service_library" |
| 28 | + - "service_only" |
| 29 | + - "webview" |
| 30 | + mode: |
| 31 | + description: "Build mode" |
| 32 | + required: true |
| 33 | + default: "debug" |
| 34 | + type: choice |
| 35 | + options: |
| 36 | + - "debug" |
| 37 | + - "release" |
| 38 | + os: |
| 39 | + description: "Operating system to run on" |
| 40 | + required: true |
| 41 | + default: "ubuntu-latest" |
| 42 | + type: choice |
| 43 | + options: |
| 44 | + - "ubuntu-latest" |
| 45 | + - "macos-latest" |
| 46 | + requirements: |
| 47 | + description: "Comma separated requirements" |
| 48 | + required: true |
| 49 | + default: "python3,kivy" |
| 50 | + |
| 51 | +env: |
| 52 | + APK_ARTIFACT_FILENAME: bdist_unit_tests_app-debug-1.1.apk |
| 53 | + AAB_ARTIFACT_FILENAME: bdist_unit_tests_app-release-1.1.aab |
| 54 | + AAR_ARTIFACT_FILENAME: bdist_unit_tests_app-release-1.1.aar |
| 55 | + PYTHONFORANDROID_PREREQUISITES_INSTALL_INTERACTIVE: 0 |
| 56 | + |
| 57 | +jobs: |
| 58 | + build: |
| 59 | + name: Build test APP [ ${{ github.event.inputs.arch }} | ${{ github.event.inputs.artifact }} | ${{ github.event.inputs.bootstrap }} | ${{ github.event.inputs.mode }} | ${{ github.event.inputs.os }} | ${{ github.event.inputs.requirements }}] |
| 60 | + runs-on: ${{ github.event.inputs.os }} |
| 61 | + steps: |
| 62 | + - name: Checkout python-for-android |
| 63 | + uses: actions/checkout@v4 |
| 64 | + - name: Pull the python-for-android docker image |
| 65 | + run: make docker/pull |
| 66 | + - name: Build python-for-android docker image |
| 67 | + run: make docker/build |
| 68 | + - name: Build multi-arch artifact with docker |
| 69 | + run: | |
| 70 | + docker run --name p4a-latest kivy/python-for-android make ARCH=${{ github.event.inputs.arch }} ARTIFACT=${{ github.event.inputs.artifact }} BOOTSTRAP=${{ github.event.inputs.bootstrap }} MODE=${{ github.event.inputs.mode }} REQUIREMENTS=${{ github.event.inputs.requirements }} testapps-generic |
| 71 | + - name: Copy produced artifacts from docker container (*.apk, *.aab) |
| 72 | + if: github.event.inputs.bootstrap != 'service_library' |
| 73 | + run: | |
| 74 | + mkdir -p dist |
| 75 | + docker cp p4a-latest:/home/user/app/testapps/on_device_unit_tests/${{ env.APK_ARTIFACT_FILENAME }} dist/ || true |
| 76 | + docker cp p4a-latest:/home/user/app/testapps/on_device_unit_tests/${{ env.AAB_ARTIFACT_FILENAME }} dist/ || true |
| 77 | + - name: Copy produced artifacts from docker container (*.aar) |
| 78 | + if: github.event.inputs.bootstrap == 'service_library' |
| 79 | + run: | |
| 80 | + mkdir -p dist |
| 81 | + docker cp p4a-latest:/home/user/app/testapps/on_device_unit_tests/${{ env.AAR_ARTIFACT_FILENAME }} dist/ |
| 82 | + - name: Rename artifacts to include the build platform name (*.apk, *.aab, *.aar) |
| 83 | + run: | |
| 84 | + 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 |
| 85 | + 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 |
| 86 | + 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 |
| 87 | + - name: Upload artifacts |
| 88 | + uses: actions/upload-artifact@v4 |
| 89 | + with: |
| 90 | + name: ${{ github.event.inputs.os }}-${{ github.event.inputs.bootstrap }}-artifacts |
| 91 | + path: dist |
| 92 | + # Cleanup the container after all steps are done |
| 93 | + - name: Cleanup Docker container |
| 94 | + run: docker rm p4a-latest |
| 95 | + if: always() |
0 commit comments