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

Fix set -e failure #473

Merged
merged 1 commit into from
Nov 12, 2024
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
74 changes: 74 additions & 0 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,21 @@ blocks:
- sudo ./tests/support/bats-core/install.sh /usr/local
- bats --report-formatter junit --tap --timing $TEST

- name: "Cache tests -e"
matrix:
- env_var: TEST
values:
- tests/libcheckout.bats
- env_var: SEMAPHORE_CACHE_ARCHIVE_METHOD
values:
- shell-out
- native
- native-parallel
commands:
- cd ~ && rm -rf toolbox
- set -evo pipefail
- checkout --use-cache

- name: "Non-cache tests"
matrix:
- env_var: TEST
Expand Down Expand Up @@ -460,6 +475,26 @@ blocks:
- sudo ./tests/support/bats-core/install.sh /usr/local
- bats --report-formatter junit --tap --timing $TEST

- name: "Cache tests -e"
matrix:
- env_var: TEST
values:
- tests/libcheckout.bats
- env_var: SEMAPHORE_CACHE_ARCHIVE_METHOD
values:
- shell-out
- native
- native-parallel
commands:
- source release/install_in_tests.sh
- cd ~ && rm -rf toolbox
- set -evo pipefail
- checkout --use-cache
- git submodule init && git submodule update
- sudo ./tests/support/bats-core/install.sh /usr/local
- bats --report-formatter junit --tap --timing $TEST


- name: "Non-cache tests"
matrix:
- env_var: TEST
Expand Down Expand Up @@ -519,6 +554,25 @@ blocks:
- sudo ./tests/support/bats-core/install.sh /usr/local
- bats --report-formatter junit --tap --timing $TEST

- name: "Cache tests -e"
matrix:
- env_var: TEST
values:
- tests/libcheckout.bats
- env_var: SEMAPHORE_CACHE_ARCHIVE_METHOD
values:
- shell-out
- native
- native-parallel
commands:
- source release/install_in_tests.sh
- cd ~ && rm -rf toolbox
- set -evo pipefail
- checkout --use-cache
- git submodule init && git submodule update
- sudo ./tests/support/bats-core/install.sh /usr/local
- bats --report-formatter junit --tap --timing $TEST

- name: "Non-cache tests"
matrix:
- env_var: TEST
Expand Down Expand Up @@ -631,6 +685,26 @@ blocks:
- sudo ./tests/support/bats-core/install.sh /usr/local
- bats --report-formatter junit --tap --timing $TEST

- name: "Cache tests -e"
matrix:
- env_var: TEST
values:
- tests/libcheckout.bats
- env_var: SEMAPHORE_CACHE_ARCHIVE_METHOD
values:
- shell-out
- native
- native-parallel
commands:
- source release/install_in_tests.sh
- cd ~ && rm -rf toolbox
- set -evo pipefail
- checkout --use-cache
- git submodule init && git submodule update
- sudo ./tests/support/bats-core/install.sh /usr/local
- bats --report-formatter junit --tap --timing $TEST


- name: "Non-cache tests"
matrix:
- env_var: TEST
Expand Down
5 changes: 4 additions & 1 deletion libcheckout
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ function checkout::cache_store() {

local cache_key
local cache_age
cache_key=$(cache list 2>&1 | grep git-cache- | awk '{ print $1 }' | head -1)
cache_key="$(cache list 2>&1 | grep git-cache- || true )"
if [[ -n "$cache_key" ]];then
cache_key=$(echo "${cache_key}" | awk '{ print $1 }'| head -1)
fi
cache_age=$(echo "${cache_key}" | cut -d'-' -f8)

if [[ -n "$cache_age" ]] && [[ $cache_age =~ ^[0-9]+$ ]]; then
Expand Down
Loading