|
| 1 | +name: Custom build |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +env: |
| 7 | + # TODO |
| 8 | + APK_ARTIFACT_FILENAME: bdist_custom_build-debug-1.1.apk |
| 9 | + AAB_ARTIFACT_FILENAME: bdist_custom_build-release-1.1.aab |
| 10 | + AAR_ARTIFACT_FILENAME: bdist_custom_build-release-1.1.aar |
| 11 | + # TODO: needed? |
| 12 | + PYTHONFORANDROID_PREREQUISITES_INSTALL_INTERACTIVE: 0 |
| 13 | + |
| 14 | +jobs: |
| 15 | + |
| 16 | + # TODO |
| 17 | + # flake8: |
| 18 | + # name: Flake8 tests |
| 19 | + # runs-on: ubuntu-latest |
| 20 | + # steps: |
| 21 | + # - name: Checkout python-for-android |
| 22 | + # uses: actions/checkout@v4 |
| 23 | + # - name: Set up Python 3.x |
| 24 | + # uses: actions/setup-python@v5 |
| 25 | + # with: |
| 26 | + # python-version: 3.x |
| 27 | + |
| 28 | + # TODO |
| 29 | + # test: |
| 30 | + # name: Pytest [Python ${{ matrix.python-version }} | ${{ matrix.os }}] |
| 31 | + # needs: flake8 |
| 32 | + # runs-on: ${{ matrix.os }} |
| 33 | + # strategy: |
| 34 | + # matrix: |
| 35 | + # python-version: ['3.11'] |
| 36 | + # os: [ubuntu-latest] |
| 37 | + # steps: |
| 38 | + # - name: Checkout python-for-android |
| 39 | + # uses: actions/checkout@v4 |
| 40 | + # - name: Set up Python ${{ matrix.python-version }} |
| 41 | + # uses: actions/setup-python@v4 |
| 42 | + # with: |
| 43 | + # python-version: ${{ matrix.python-version }} |
| 44 | + # - name: Tox tests |
| 45 | + # run: | |
| 46 | + # python -m pip install --upgrade pip |
| 47 | + # pip install tox>=2.0 |
| 48 | + # make test |
| 49 | + # - name: Coveralls |
| 50 | + # uses: AndreMiras/coveralls-python-action@develop |
| 51 | + # if: ${{ matrix.os == 'ubuntu-latest' }} |
| 52 | + # with: |
| 53 | + # parallel: true |
| 54 | + # flag-name: run-${{ matrix.os }}-${{ matrix.python-version }} |
| 55 | + |
| 56 | + ubuntu_build: |
| 57 | + name: Build test APP [ ${{ matrix.runs_on }} | ${{ matrix.bootstrap.name }} ] |
| 58 | + needs: [flake8] |
| 59 | + runs-on: ${{ matrix.runs_on }} |
| 60 | + continue-on-error: true |
| 61 | + strategy: |
| 62 | + matrix: |
| 63 | + runs_on: [ubuntu-latest] |
| 64 | + # TODO |
| 65 | + bootstrap: |
| 66 | + - name: sdl2 |
| 67 | + target: testapps-with-numpy |
| 68 | + - name: sdl2_scipy |
| 69 | + target: testapps-with-scipy |
| 70 | + - name: webview |
| 71 | + target: testapps-webview |
| 72 | + - name: service_library |
| 73 | + target: testapps-service_library-aar |
| 74 | + - name: qt |
| 75 | + target: testapps-qt |
| 76 | + steps: |
| 77 | + - name: Checkout python-for-android |
| 78 | + uses: actions/checkout@v4 |
| 79 | + # TODO: later we would pull from Docker hub |
| 80 | + - name: Build python-for-android docker image |
| 81 | + run: | |
| 82 | + docker build --tag=kivy/python-for-android . |
| 83 | + - name: Build multi-arch ${{ matrix.bootstrap.target }} artifact with docker |
| 84 | + run: | |
| 85 | + docker run --name p4a-latest kivy/python-for-android make ${{ matrix.bootstrap.target }} |
| 86 | + - name: Copy produced artifacts from docker container (*.apk, *.aab) |
| 87 | + if: matrix.bootstrap.name != 'service_library' |
| 88 | + run: | |
| 89 | + mkdir -p dist |
| 90 | + docker cp p4a-latest:/home/user/app/testapps/on_device_unit_tests/${{ env.APK_ARTIFACT_FILENAME }} dist/ |
| 91 | + docker cp p4a-latest:/home/user/app/testapps/on_device_unit_tests/${{ env.AAB_ARTIFACT_FILENAME }} dist/ |
| 92 | + - name: Copy produced artifacts from docker container (*.aar) |
| 93 | + if: matrix.bootstrap.name == 'service_library' |
| 94 | + run: | |
| 95 | + mkdir -p dist |
| 96 | + docker cp p4a-latest:/home/user/app/testapps/on_device_unit_tests/${{ env.AAR_ARTIFACT_FILENAME }} dist/ |
| 97 | + - name: Rename artifacts to include the build platform name (*.apk, *.aab, *.aar) |
| 98 | + run: | |
| 99 | + if [ -f dist/${{ env.APK_ARTIFACT_FILENAME }} ]; then mv dist/${{ env.APK_ARTIFACT_FILENAME }} dist/${{ matrix.runs_on }}-${{ matrix.bootstrap.name }}-${{ env.APK_ARTIFACT_FILENAME }}; fi |
| 100 | + if [ -f dist/${{ env.AAB_ARTIFACT_FILENAME }} ]; then mv dist/${{ env.AAB_ARTIFACT_FILENAME }} dist/${{ matrix.runs_on }}-${{ matrix.bootstrap.name }}-${{ env.AAB_ARTIFACT_FILENAME }}; fi |
| 101 | + if [ -f dist/${{ env.AAR_ARTIFACT_FILENAME }} ]; then mv dist/${{ env.AAR_ARTIFACT_FILENAME }} dist/${{ matrix.runs_on }}-${{ matrix.bootstrap.name }}-${{ env.AAR_ARTIFACT_FILENAME }}; fi |
| 102 | + - name: Upload artifacts |
| 103 | + uses: actions/upload-artifact@v3 |
| 104 | + with: |
| 105 | + name: ${{ matrix.runs_on }}-${{ matrix.bootstrap.name }}-artifacts |
| 106 | + path: dist |
| 107 | + |
| 108 | + # TODO: should we support both |
| 109 | + macos_build: |
| 110 | + name: Build test APP [ ${{ matrix.runs_on }} | ${{ matrix.bootstrap.name }} ] |
| 111 | + needs: [flake8] |
| 112 | + runs-on: ${{ matrix.runs_on }} |
| 113 | + continue-on-error: true |
| 114 | + strategy: |
| 115 | + matrix: |
| 116 | + # macos-latest (ATM macos-14) runs on Apple Silicon, |
| 117 | + # macos-13 runs on Intel |
| 118 | + runs_on: ['macos-latest', 'macos-13'] |
| 119 | + bootstrap: |
| 120 | + - name: sdl2 |
| 121 | + target: testapps-with-numpy |
| 122 | + - name: webview |
| 123 | + target: testapps-webview |
| 124 | + env: |
| 125 | + ANDROID_HOME: ${HOME}/.android |
| 126 | + ANDROID_SDK_ROOT: ${HOME}/.android/android-sdk |
| 127 | + ANDROID_SDK_HOME: ${HOME}/.android/android-sdk |
| 128 | + ANDROID_NDK_HOME: ${HOME}/.android/android-ndk |
| 129 | + steps: |
| 130 | + - name: Checkout python-for-android |
| 131 | + uses: actions/checkout@v4 |
| 132 | + - name: Set up Python 3.x |
| 133 | + uses: actions/setup-python@v5 |
| 134 | + with: |
| 135 | + python-version: 3.x |
| 136 | + - name: Install python-for-android |
| 137 | + run: | |
| 138 | + python3 -m pip install -e . |
| 139 | + - name: Install prerequisites via pythonforandroid/prerequisites.py (Experimental) |
| 140 | + run: | |
| 141 | + python3 pythonforandroid/prerequisites.py |
| 142 | + - name: Install dependencies (Legacy) |
| 143 | + run: | |
| 144 | + make --file ci/makefiles/osx.mk |
| 145 | + - name: Build multi-arch apk Python 3 (armeabi-v7a, arm64-v8a, x86_64, x86) |
| 146 | + run: | |
| 147 | + make ${{ matrix.bootstrap.target }} |
| 148 | + - name: Copy produced artifacts into dist/ (*.apk, *.aab) |
| 149 | + run: | |
| 150 | + mkdir -p dist |
| 151 | + cp testapps/on_device_unit_tests/*.apk dist/ |
| 152 | + cp testapps/on_device_unit_tests/*.aab dist/ |
| 153 | + ls -l dist/ |
| 154 | + - name: Rename artifacts to include the build platform name (*.apk, *.aab) |
| 155 | + run: | |
| 156 | + if [ -f dist/${{ env.APK_ARTIFACT_FILENAME }} ]; then mv dist/${{ env.APK_ARTIFACT_FILENAME }} dist/${{ matrix.runs_on }}-${{ matrix.bootstrap.name }}-${{ env.APK_ARTIFACT_FILENAME }}; fi |
| 157 | + if [ -f dist/${{ env.AAB_ARTIFACT_FILENAME }} ]; then mv dist/${{ env.AAB_ARTIFACT_FILENAME }} dist/${{ matrix.runs_on }}-${{ matrix.bootstrap.name }}-${{ env.AAB_ARTIFACT_FILENAME }}; fi |
| 158 | + - name: Upload artifacts |
| 159 | + uses: actions/upload-artifact@v3 |
| 160 | + with: |
| 161 | + name: ${{ matrix.runs_on }}-${{ matrix.bootstrap.name }}-artifacts |
| 162 | + path: dist |
| 163 | + |
| 164 | + ubuntu_rebuild_updated_recipes: |
| 165 | + name: Test updated recipes for arch ${{ matrix.android_arch }} [ ubuntu-latest ] |
| 166 | + needs: [flake8] |
| 167 | + runs-on: ubuntu-latest |
| 168 | + continue-on-error: true |
| 169 | + strategy: |
| 170 | + matrix: |
| 171 | + android_arch: ["arm64-v8a", "armeabi-v7a", "x86_64", "x86"] |
| 172 | + env: |
| 173 | + REBUILD_UPDATED_RECIPES_EXTRA_ARGS: --arch=${{ matrix.android_arch }} |
| 174 | + steps: |
| 175 | + - name: Checkout python-for-android (all-history) |
| 176 | + uses: actions/checkout@v4 |
| 177 | + with: |
| 178 | + fetch-depth: 0 |
| 179 | + # helps with GitHub runner getting out of space |
| 180 | + - name: Free disk space |
| 181 | + run: | |
| 182 | + df -h |
| 183 | + sudo swapoff -a |
| 184 | + sudo rm -f /swapfile |
| 185 | + sudo apt -y clean |
| 186 | + docker rmi $(docker image ls -aq) |
| 187 | + df -h |
| 188 | + - name: Pull docker image |
| 189 | + run: | |
| 190 | + make docker/pull |
| 191 | + - name: Rebuild updated recipes |
| 192 | + run: | |
| 193 | + make docker/run/make/rebuild_updated_recipes |
| 194 | +
|
| 195 | + macos_rebuild_updated_recipes: |
| 196 | + name: Test updated recipes for arch ${{ matrix.android_arch }} [ ${{ matrix.runs_on }} ] |
| 197 | + needs: [flake8] |
| 198 | + runs-on: ${{ matrix.runs_on }} |
| 199 | + continue-on-error: true |
| 200 | + strategy: |
| 201 | + matrix: |
| 202 | + android_arch: ["arm64-v8a", "armeabi-v7a", "x86_64", "x86"] |
| 203 | + # macos-latest (ATM macos-14) runs on Apple Silicon, |
| 204 | + # macos-13 runs on Intel |
| 205 | + runs_on: ['macos-latest', 'macos-13'] |
| 206 | + env: |
| 207 | + ANDROID_HOME: ${HOME}/.android |
| 208 | + ANDROID_SDK_ROOT: ${HOME}/.android/android-sdk |
| 209 | + ANDROID_SDK_HOME: ${HOME}/.android/android-sdk |
| 210 | + ANDROID_NDK_HOME: ${HOME}/.android/android-ndk |
| 211 | + REBUILD_UPDATED_RECIPES_EXTRA_ARGS: --arch=${{ matrix.android_arch }} |
| 212 | + steps: |
| 213 | + - name: Checkout python-for-android (all-history) |
| 214 | + uses: actions/checkout@v4 |
| 215 | + with: |
| 216 | + fetch-depth: 0 |
| 217 | + - name: Set up Python 3.x |
| 218 | + uses: actions/setup-python@v5 |
| 219 | + with: |
| 220 | + python-version: 3.x |
| 221 | + - name: Install python-for-android |
| 222 | + run: | |
| 223 | + python3 -m pip install -e . |
| 224 | + - name: Install prerequisites via pythonforandroid/prerequisites.py (Experimental) |
| 225 | + run: | |
| 226 | + python3 pythonforandroid/prerequisites.py |
| 227 | + - name: Install dependencies (Legacy) |
| 228 | + run: | |
| 229 | + make --file ci/makefiles/osx.mk |
| 230 | + - name: Rebuild updated recipes |
| 231 | + run: | |
| 232 | + make rebuild_updated_recipes |
| 233 | +
|
| 234 | + coveralls_finish: |
| 235 | + needs: test |
| 236 | + runs-on: ubuntu-latest |
| 237 | + steps: |
| 238 | + - name: Coveralls Finished |
| 239 | + uses: AndreMiras/coveralls-python-action@develop |
| 240 | + with: |
| 241 | + parallel-finished: true |
| 242 | + |
| 243 | + documentation: |
| 244 | + runs-on: ubuntu-latest |
| 245 | + steps: |
| 246 | + - uses: actions/checkout@v4 |
| 247 | + - name: Requirements |
| 248 | + run: | |
| 249 | + python -m pip install --upgrade pip |
| 250 | + pip install -r doc/requirements.txt |
| 251 | + - name: Check links |
| 252 | + run: sphinx-build -b linkcheck doc/source doc/build |
| 253 | + - name: Generate documentation |
| 254 | + run: sphinx-build doc/source doc/build |
| 255 | + |
| 256 | + |
0 commit comments