Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiline scripts #391

Open
TWiStErRob opened this issue Apr 27, 2024 · 0 comments
Open

Allow multiline scripts #391

TWiStErRob opened this issue Apr 27, 2024 · 0 comments

Comments

@TWiStErRob
Copy link
Contributor

At the moment there's some (seemingly unnecessary) parsing of script: input, which prevents everyday usages.

Examples:

Standard Gradle or adb invocation, we all know how long the parameter list can get with filters, and instrumentation arguments, no-one wants to maintain that potentially 500 character line on a single line.

script: |
  command \
    long \
    long \
    param \
    list

Really simple if-else:

script: |
  if [[ $ENV_VAR = "xx" ]]; then
    x
  else
    y
  fi

Function definition and complex scripts.

script: |
  some() {
    ...
  }
  if [[ some() ]]; then ...; fi

The workaround is to dump the script into a file and just call the file as single command:

      - name: "Prepare script to run."
        id: script
        env:
          SCRIPT: |
            # complex parts that are multiline
            ${{ inputs.script }}
        run: |
          script_file="${TEMP}/reactivecircus-android-emulator-runner-preapred-script.sh"
          echo "${SCRIPT}" > "${script_file}"
          echo "file=${script_file}" >> "${GITHUB_OUTPUT}"

      - name: "Run Instrumentation Tests on emulator."
        timeout-minutes: ${{ inputs.timeout-minutes }}
        uses: reactivecircus/android-emulator-runner@v2
        with:
          script: bash "${{ steps.script.outputs.file }}"

but this is so unwieldy.

Would you mind explaining why this parsing is in place, and would you be open to remove it and replace it with just executing the input as is?

(I've faced this issue about 6 times in the last few years, and always had to work around it in some way.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant