diff --git a/action.yml b/action.yml index b2c0edc..aad041c 100644 --- a/action.yml +++ b/action.yml @@ -47,7 +47,7 @@ inputs: packageMode: required: false default: false - description: 'Whether the tests are being run for a Unity package. Not needed for packages located within a Unity Project.' + description: 'Whether the tests are being run for a Unity package instead of a Unity project. NOTE: If this is true, any custom docker image you pass must be compatible with apt-get.' outputs: artifactsPath: description: 'Path where the artifacts are stored' diff --git a/dist/Dockerfile b/dist/Dockerfile index b694818..f420b80 100644 --- a/dist/Dockerfile +++ b/dist/Dockerfile @@ -10,13 +10,6 @@ LABEL "repository"="http://github.com/webbertakken/unity-actions" LABEL "homepage"="http://github.com/webbertakken/unity-actions" LABEL "maintainer"="Webber Takken " -RUN apt-get update \ -&& apt-get upgrade -y --force-yes \ -&& apt-get install -y --force-yes \ - jq \ -&& apt-get clean \ -&& rm -rf /var/cache/apt/archives/* /var/lib/apt/lists/* - ADD steps /steps RUN chmod -R +x /steps ADD entrypoint.sh /entrypoint.sh diff --git a/dist/entrypoint.sh b/dist/entrypoint.sh index 7a266ad..aa32b19 100755 --- a/dist/entrypoint.sh +++ b/dist/entrypoint.sh @@ -7,6 +7,27 @@ ACTIVATE_LICENSE_PATH="$GITHUB_WORKSPACE/_activate-license" mkdir -p "$ACTIVATE_LICENSE_PATH" +# +# Check if apt-get is available if in package mode (if not, we must abort since we need to install jq) +# +if [ "$PACKAGE_MODE" = "true" ]; then + echo "Running tests on a Unity package rather than a Unity project." + echo "Checking if apt-get is installed." + apt-get --version > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "apt-get is not installed. Aborting..." + exit + fi + + # install jq + apt-get update \ + && apt-get upgrade -y --force-yes \ + && apt-get install -y --force-yes \ + jq \ + && apt-get clean \ + && rm -rf /var/cache/apt/archives/* /var/lib/apt/lists/* +fi + # # Run steps #