94 Commits

Author SHA1 Message Date
Brian Dickens 0d47f0813d Avoid Wrapping Script Code In Quotes
The exec() command only runs a program with literal argument strings.
It does not know how to do things like expanding environment variables,
or piping/redirection.  Hence the way to get "shell intelligence"
is to use exec() to run the `sh` process with the command line string
as a parameter.

But the method being used to do this was:

    exec.exec(`sh -c \\"${script}"`)

This has problems, because wrapping the script in quotes creates
issues when the script itself contains quotes.  Escaping the string
correctly is a non-trivial problem, which also would create "noise"
in the debug output which would add confusion.

http://mywiki.wooledge.org/BashFAQ/050

The easiest way to work around this here is to use the array form of
exec() to pass exactly two parameters to `sh`.  No manipulation of the
script string is needed with this approach:

    exec.exec("sh", ["-c", script])

There are more cases in the project of `sh -c` usage which should also
be changed, and likely abstracted (shellExec()?)  But this small patch
just fixes the most important case for the user-provided script.

---

Additionally, this removes the escaped backslash (`\\`) from the
start of the executed command.  That was presumably to suppress the
use of aliases:

https://unix.stackexchange.com/questions/524254/why-are-backslashes-included-in-this-shell-script

But because this is invoking a non-interactive shell session, aliases
would not apply.  Hence the extra backslash shouldn't be needed.
2021-03-09 18:49:23 +11:00
Afzal Najam d85239a9fb Add option to modify the number of cores 2021-03-03 08:41:55 +11:00
Yang 205fbe1b31 Always add path for cmdline-tools to support macos-11.0. 2021-01-13 19:24:10 +11:00
linl33 434e949c3b Support non-default API 28 images 2021-01-05 18:21:57 +11:00
Yang 28373d3d4f Fix AVD creation hang when profile is not specified. 2020-12-28 13:13:03 +11:00
Yang b0f3c521a5 Support specifying SD card path or size. 2020-12-27 20:37:13 +11:00
Yang d4b3926c7d Replace usages of deprecated ANDROID_HOME with ANDROID_ROOT_SDK.
Bump build tools to 30.0.3.
Update test-fixture dependencies.
2020-12-25 00:05:51 +11:00
Yang b5ac8dfbfe Update cmdline-tools to 3.0. 2020-11-14 19:02:24 +11:00
Yang 53151f5236 Add support for using google_apis_playstore system images. 2020-10-16 14:32:01 +11:00
Yang 8feb8a564a SDK Build tools 30.0.2. 2020-08-15 15:00:23 +10:00
Yang 327f6f1c1f Update packages. 2020-07-18 19:43:39 +10:00
Yang fb3c06d709 Use fs for writing licence files. 2020-07-03 16:14:01 +10:00
Yang e22ecdedee Update cmdline-tools to 2.1. 2020-06-24 23:39:11 +10:00
Yang b39f1a9f8b Support running multiple actions sequentially in a single job. 2020-06-20 19:48:18 +10:00
Yang 8d0ce4c94b Support API 30 system images and add API 30 to workflow. Update build tools to 30.0.0. Update test projec’s compileSdk and targetSdk to API 30. 2020-06-12 19:44:21 +10:00
Yang 736093576f SDK Command-line Tools 2.0. 2020-05-29 21:48:25 +10:00
Yang f5435af41b Add support for specifying a custom name used for creating AVD. 2020-05-01 20:11:25 +10:00
Yang 438dce7110 Support specifying versions of NDK and CMake to install. 2020-04-11 21:02:42 +10:00
Yang Chen 0d53ec8e43 Use correct cli-tools binary for mac. 2020-04-02 22:56:56 +11:00
Yang Chen 49a3d042e9 Fix sdk license issue with API 28+ system images on Linux. 2020-04-01 00:38:58 +11:00
Yang Chen eb9e069f3f Update packages. 2020-03-28 14:10:50 +11:00
Yang Chen 345ace6178 Support running on linux without hardware accleration. 2020-03-28 14:10:50 +11:00
Yang Chen ede514c8c2 Add support for API 15-19 system images. 2020-03-05 14:50:59 +11:00
Yang Chen 4a949058e2 Use new cmdline-tools with support for running sdkmanager and avdmanager with Java 8+. 2020-03-05 14:34:19 +11:00
Yang Chen ff311e8a7d Add support for setting a custom working-directory. 2020-02-15 18:29:17 +11:00
Yang Chen 4082c705ad Fix escaped environment variables in script. 2020-02-04 12:25:35 +11:00
Yang Chen 97f77e3305 Build tools 29.0.3. 2020-01-31 11:43:15 +11:00
Yang Chen e756009f0d Force use Java 8 for sdkmanager and avdmanager. 2020-01-20 03:52:46 +11:00
Yang Chen 12eba85b00 Add support for pinning specific emulator build. 2019-12-15 04:27:24 +11:00
Yang Chen c03965e565 Fix script execution order. Run test fixture in workflow. 2019-12-15 02:15:41 +11:00
Yang Chen 9739504a54 Support multi-line script. 2019-12-14 00:30:11 +11:00
Yang Chen 0d276b963a Add support for providing any emulator launch options as action input. Remove headless input which might overlap with emulator-options. 2019-12-07 17:54:13 +11:00
Yang Chen 0fde7031bc Increase emulator boot timeout to 5 mins. 2019-11-30 22:02:47 +11:00
Yang Chen b34584f4b0 Switch to sh. 2019-11-24 17:47:07 +11:00
Yang Chen 9fc21537b8 Also update emulator. Add docs. 2019-11-09 20:23:29 +11:00
Yang Chen 108f020fac Only install / update required components. 2019-11-09 18:48:21 +11:00
Yang Chen 83dda62a70 Fail action when script fails. 2019-11-09 03:34:10 +11:00
Yang Chen a6ea5be5bb Add missing js. 2019-11-09 00:30:21 +11:00
Yang Chen 9f3feeefc6 Single line script. 2019-11-09 00:27:35 +11:00
Yang Chen 0035a64068 Add missing compiled js files. 2019-11-08 23:36:53 +11:00
Yang Chen 0f9b17b151 Add support for configuring hardware profile and running custom script. 2019-11-08 22:42:01 +11:00
Yang Chen 34df1eaf0e Add emulator-launcher. 2019-11-08 18:33:07 +11:00
Yang Chen 137c96a972 Add input validations with tests. 2019-11-06 22:14:03 +11:00
Yang Chen 8425a60746 Initial commit. 2019-11-06 02:46:20 +11:00