|
| 1 | +# This is coded as an action rather than a workflow so the release-tools |
| 2 | +# repository can load it from a dynamically-chosen commit. Cross-repository |
| 3 | +# workflow calls must have a Git reference hard-coded in the calling workflow, |
| 4 | +# but actions can be run dynamically from the runner's filesystem. |
| 5 | + |
| 6 | +name: Build and test (Android) |
| 7 | +description: Build and test (Android) |
| 8 | + |
| 9 | +inputs: |
| 10 | + triplet: |
| 11 | + description: Host triplet |
| 12 | + required: true |
| 13 | + |
| 14 | +runs: |
| 15 | + using: composite |
| 16 | + |
| 17 | + steps: |
| 18 | + # Build Python, and package it into a release artifact. |
| 19 | + - run: ./Android/android.py build ${{ inputs.triplet }} |
| 20 | + - run: ./Android/android.py package ${{ inputs.triplet }} |
| 21 | + - uses: actions/upload-artifact@v4 |
| 22 | + with: |
| 23 | + name: android |
| 24 | + path: cross-build/${{ inputs.triplet }}/dist/* |
| 25 | + if-no-files-found: error |
| 26 | + |
| 27 | + # Currently, GitHub Actions can only run the Android emulator on Linux, so |
| 28 | + # all the remaining steps are conditional on that. |
| 29 | + |
| 30 | + # (https://github.blog/changelog/2024-04-02-github-actions-hardware-accelerated-android-virtualization-now-available/). |
| 31 | + - name: Enable KVM for Android emulator |
| 32 | + if: runner.os == "Linux" |
| 33 | + run: | |
| 34 | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ |
| 35 | + | sudo tee /etc/udev/rules.d/99-kvm4all.rules |
| 36 | + sudo udevadm control --reload-rules |
| 37 | + sudo udevadm trigger --name-match=kvm |
| 38 | +
|
| 39 | + - name: Unpack release artifact |
| 40 | + if: runner.os == "Linux" |
| 41 | + run: | |
| 42 | + mkdir $RUNNER_TEMP/android |
| 43 | + tar -C $RUNNER_TEMP/android -xf cross-build/${{ inputs.triplet }}/dist/* |
| 44 | +
|
| 45 | + - name: Tests |
| 46 | + if: runner.os == "Linux" |
| 47 | + run: | |
| 48 | + $RUNNER_TEMP/android/android.py test --managed maxVersion -v -- \ |
| 49 | + -uall --single-process --rerun -W |
0 commit comments