Skip to content

Commit e8a9613

Browse files
authored
update1 (#473)
1 parent 29a607d commit e8a9613

File tree

2 files changed

+78
-1
lines changed

2 files changed

+78
-1
lines changed

.semaphore/semaphore.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,21 @@ blocks:
400400
- sudo ./tests/support/bats-core/install.sh /usr/local
401401
- bats --report-formatter junit --tap --timing $TEST
402402

403+
- name: "Cache tests -e"
404+
matrix:
405+
- env_var: TEST
406+
values:
407+
- tests/libcheckout.bats
408+
- env_var: SEMAPHORE_CACHE_ARCHIVE_METHOD
409+
values:
410+
- shell-out
411+
- native
412+
- native-parallel
413+
commands:
414+
- cd ~ && rm -rf toolbox
415+
- set -evo pipefail
416+
- checkout --use-cache
417+
403418
- name: "Non-cache tests"
404419
matrix:
405420
- env_var: TEST
@@ -460,6 +475,26 @@ blocks:
460475
- sudo ./tests/support/bats-core/install.sh /usr/local
461476
- bats --report-formatter junit --tap --timing $TEST
462477

478+
- name: "Cache tests -e"
479+
matrix:
480+
- env_var: TEST
481+
values:
482+
- tests/libcheckout.bats
483+
- env_var: SEMAPHORE_CACHE_ARCHIVE_METHOD
484+
values:
485+
- shell-out
486+
- native
487+
- native-parallel
488+
commands:
489+
- source release/install_in_tests.sh
490+
- cd ~ && rm -rf toolbox
491+
- set -evo pipefail
492+
- checkout --use-cache
493+
- git submodule init && git submodule update
494+
- sudo ./tests/support/bats-core/install.sh /usr/local
495+
- bats --report-formatter junit --tap --timing $TEST
496+
497+
463498
- name: "Non-cache tests"
464499
matrix:
465500
- env_var: TEST
@@ -519,6 +554,25 @@ blocks:
519554
- sudo ./tests/support/bats-core/install.sh /usr/local
520555
- bats --report-formatter junit --tap --timing $TEST
521556

557+
- name: "Cache tests -e"
558+
matrix:
559+
- env_var: TEST
560+
values:
561+
- tests/libcheckout.bats
562+
- env_var: SEMAPHORE_CACHE_ARCHIVE_METHOD
563+
values:
564+
- shell-out
565+
- native
566+
- native-parallel
567+
commands:
568+
- source release/install_in_tests.sh
569+
- cd ~ && rm -rf toolbox
570+
- set -evo pipefail
571+
- checkout --use-cache
572+
- git submodule init && git submodule update
573+
- sudo ./tests/support/bats-core/install.sh /usr/local
574+
- bats --report-formatter junit --tap --timing $TEST
575+
522576
- name: "Non-cache tests"
523577
matrix:
524578
- env_var: TEST
@@ -631,6 +685,26 @@ blocks:
631685
- sudo ./tests/support/bats-core/install.sh /usr/local
632686
- bats --report-formatter junit --tap --timing $TEST
633687

688+
- name: "Cache tests -e"
689+
matrix:
690+
- env_var: TEST
691+
values:
692+
- tests/libcheckout.bats
693+
- env_var: SEMAPHORE_CACHE_ARCHIVE_METHOD
694+
values:
695+
- shell-out
696+
- native
697+
- native-parallel
698+
commands:
699+
- source release/install_in_tests.sh
700+
- cd ~ && rm -rf toolbox
701+
- set -evo pipefail
702+
- checkout --use-cache
703+
- git submodule init && git submodule update
704+
- sudo ./tests/support/bats-core/install.sh /usr/local
705+
- bats --report-formatter junit --tap --timing $TEST
706+
707+
634708
- name: "Non-cache tests"
635709
matrix:
636710
- env_var: TEST

libcheckout

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ function checkout::cache_store() {
125125

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

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

0 commit comments

Comments
 (0)