Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions step.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ fi
# Refine variables
[[ "$async" == "true" ]] && is_async="true"
[[ "$google_play" == "true" ]] && is_google_play="true"
[[ "$cancel_previous" == "true" ]] && is_cancel_previous="true"
[[ "$ignore_sha_check" == "true" ]] && is_ignore_sha_check="true"
[[ "$show_crosshairs" == "true" ]] && is_show_crosshairs="true"
[[ "$maestro_chrome_onboarding" == "true" ]] && is_maestro_chrome_onboarding="true"
Expand Down Expand Up @@ -59,6 +60,7 @@ echo "app_binary_id: $app_binary_id"
echo "app_file: $app_file"
echo "artifacts_path: $artifacts_path"
echo "async: $async"
echo "cancel_previous: $cancel_previous"
echo "config: $config"
echo "device_locale: $device_locale"
echo "download_artifacts: $download_artifacts"
Expand Down Expand Up @@ -107,6 +109,7 @@ ${api_url:+--api-url \"$api_url\"} \
${app_binary_id:+--app-binary-id \"$app_binary_id\"} \
${artifacts_path:+--artifacts-path \"$artifacts_path\"} \
${is_async:+--async} \
${is_cancel_previous:+--cancel-previous} \
${config:+--config \"$config\"} \
${is_debug:+--debug} \
${device_locale:+--device-locale \"$device_locale\"} \
Expand Down Expand Up @@ -158,6 +161,7 @@ ${api_url:+--api-url "$api_url"} \
${app_binary_id:+--app-binary-id "$app_binary_id"} \
${artifacts_path:+--artifacts-path "$artifacts_path"} \
${is_async:+--async} \
${is_cancel_previous:+--cancel-previous} \
${config:+--config "$config"} \
${is_debug:+--debug} \
${device_locale:+--device-locale "$device_locale"} \
Expand Down
20 changes: 20 additions & 0 deletions step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,26 @@ inputs:
- "true"
- "false"

- cancel_previous: "false"
opts:
title: "Cancel Previous Run"
summary: "Cancel the still-queued tests of the previous run from the same CI context"
description: |
Cancels the still-queued tests of the previous run from the same CI
context when this run is submitted. Tests already running are left to
finish; cancelled tests are refunded at 75%.

The context is matched on repository + branch (or PR) + `check_name`.
Bitrise reports no build id to DeviceCloud, so if one build runs this
step more than once give each invocation its own `check_name` —
otherwise the second would cancel the first.
is_expand: true
is_required: false
default_value: "false"
value_options:
- "true"
- "false"

- dry_run: "false"
opts:
title: "Dry Run"
Expand Down
14 changes: 14 additions & 0 deletions test/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,20 @@ teardown() {
[[ "$output" != *"--async"* ]]
}

@test "passes --cancel-previous only when cancel_previous=true" {
export api_key="k"

export cancel_previous="true"
run bash "${TEST_DIR}/step.sh"
[ "$status" -eq 0 ]
[[ "$output" == *"--cancel-previous"* ]]

export cancel_previous="false"
run bash "${TEST_DIR}/step.sh"
[ "$status" -eq 0 ]
[[ "$output" != *"--cancel-previous"* ]]
}

@test "boolean flags appear only when their inputs are true" {
export api_key="k"
export google_play="true"
Expand Down
Loading