From 8d51d5102314a4f28097574e61f0376e4df91c17 Mon Sep 17 00:00:00 2001 From: Anton Malinskiy Date: Tue, 20 Feb 2024 18:55:21 +1000 Subject: [PATCH] feat(cli): support cli v1 (#4) feat(cli): support cli v1 --- step.sh | 28 +++++++++++++++++++--------- step.yml | 28 ++++++++++++++++++---------- 2 files changed, 37 insertions(+), 19 deletions(-) diff --git a/step.sh b/step.sh index ff431f5..c78c88b 100644 --- a/step.sh +++ b/step.sh @@ -1,25 +1,35 @@ #!/usr/bin/env bash set -ex -command_args=" -api-key $API_KEY -app $application -testapp $test_application -platform $platform -system-image $system_image -isolated $isolated" +run_platform=$(echo "$platform" | awk '{print tolower($0)}') +command_args="run $run_platform" +command_args="$command_args --api-key $api_key" +command_args="$command_args --application $application" +command_args="$command_args --test-application $test_application" +command_args="$command_args --system-image $system_image" +command_args="$command_args --isolated $isolated" if [ -n "$os_version" ]; then - command_args="$command_args -os-version $os_version" + command_args="$command_args --os-version $os_version" fi if [ -n "$link" ]; then - command_args="$command_args -link $link" + command_args="$command_args --link $link" fi if [ -n "$run_name" ]; then - command_args="$command_args -name $run_name" + command_args="$command_args --name $run_name" +fi + +if [ -n "$ignore_test_failures" ]; then + command_args="$command_args --ignore-test-failures $ignore_test_failures" fi if [[ $OSTYPE == 'darwin'* ]]; then - echo 'macOS agents preinstall marathon-cloud cli via brew' - marathon-cloud $command_args + echo 'macOS agents preinstall marathon-cloud cli via brew' + marathon-cloud $command_args elif [[ $OSTYPE == 'linux'* ]]; then - echo 'using docker image $docker_image to pull the latest marathon-cloud cli version' - docker pull $docker_image - docker run -v "$(pwd)":/work --rm $docker_image $command_args + echo 'using docker image $docker_image to pull the latest marathon-cloud cli version' + docker pull $docker_image + docker run -v "$(pwd)":/work --rm $docker_image $command_args fi diff --git a/step.yml b/step.yml index 5d2a979..9aa26d6 100644 --- a/step.yml +++ b/step.yml @@ -50,16 +50,14 @@ type_tags: # deps: brew: - - name: malinskiy/tap/marathon-cloud + - name: malinskiy/tap/marathon-cloud # apt_get: # - name: cmake - toolkit: bash: entry_file: step.sh - inputs: - application: "" opts: @@ -68,7 +66,7 @@ inputs: description: | Application binary path. For an Android project: app APK file path. - For an iOS project: an ARM compatible Simulator build packaged in a ZIP archive. + For an iOS project: an ARM compatible Simulator build packaged in a ZIP archive. is_expand: true is_required: true - test_application: "" @@ -78,7 +76,7 @@ inputs: description: | Test application binary path. For an Android project: test app APK file path. - For an iOS project: an ARM compatible Simulator iOS Test Runner app packaged in a ZIP archive. + For an iOS project: an ARM compatible Simulator iOS Test Runner app packaged in a ZIP archive. is_expand: true is_required: true - platform: "" @@ -88,7 +86,7 @@ inputs: description: "" value_options: - "Android" - - "iOS" + - "iOS" is_expand: true is_required: true - api_key: @@ -96,7 +94,7 @@ inputs: title: Marathon Cloud API key summary: API key for authenticating with Marathon Cloud description: | - Have a look at [the tokens page](https://cloud.marathonlabs.io/tokens) in the dashboard to obtain your token. + Have a look at [the tokens page](https://cloud.marathonlabs.io/tokens) in the dashboard to obtain your token. is_expand: true is_required: true is_sensitive: true @@ -122,8 +120,8 @@ inputs: is_required: false - link: "" opts: - title: Link to commit - summary: Link to commit + title: Optional link, for example it could be a link to source control commit or CI run + summary: Optional link, for example it could be a link to source control commit or CI run description: "" is_expand: true is_required: false @@ -143,7 +141,17 @@ inputs: summary: Run each test using isolated execution. Default is false description: "" value_options: - - "true" + - "true" + - "false" + is_expand: true + is_required: false + - ignore_test_failures: false + opts: + title: Ignore test failures + summary: When tests fail and this option is true then cli will exit with code 0. By default, cli will exit with code 1 in case of test failures and 0 for passing tests + description: "" + value_options: + - "true" - "false" is_expand: true is_required: false