(context)
| 811 | |
| 812 | |
| 813 | def ci(context): |
| 814 | for step in [ |
| 815 | configure_build_python, |
| 816 | make_build_python, |
| 817 | configure_host_python, |
| 818 | make_host_python, |
| 819 | package, |
| 820 | ]: |
| 821 | caption = ( |
| 822 | step.__name__.replace("_", " ") |
| 823 | .capitalize() |
| 824 | .replace("python", "Python") |
| 825 | ) |
| 826 | print(f"::group::{caption}") |
| 827 | result = step(context) |
| 828 | if step is package: |
| 829 | package_path = result |
| 830 | print("::endgroup::") |
| 831 | |
| 832 | if ( |
| 833 | "GITHUB_ACTIONS" in os.environ |
| 834 | and (platform.system(), platform.machine()) != ("Linux", "x86_64") |
| 835 | ): |
| 836 | print( |
| 837 | "Skipping tests: GitHub Actions does not support the Android " |
| 838 | "emulator on this platform." |
| 839 | ) |
| 840 | else: |
| 841 | with TemporaryDirectory(prefix=SCRIPT_NAME) as temp_dir: |
| 842 | print("::group::Tests") |
| 843 | |
| 844 | # Prove the package is self-contained by using it to run the tests. |
| 845 | shutil.unpack_archive(package_path, temp_dir) |
| 846 | launcher_args = [ |
| 847 | "--managed", "maxVersion", "-v", f"--{context.ci_mode}-ci" |
| 848 | ] |
| 849 | run( |
| 850 | ["./android.py", "test", *launcher_args], |
| 851 | cwd=temp_dir |
| 852 | ) |
| 853 | print("::endgroup::") |
| 854 | |
| 855 | |
| 856 | def env(context): |
nothing calls this directly
no test coverage detected