2017-12-08 9 views
0

tmp/ディレクトリにコピーして圧縮する必要があるファイルがたくさんあります。Travis-CIがジョブを終了させないようにする方法は?

私はcp -rf $SRC $DSTを試しましたが、コマンドが完了する前にジョブが終了しています。詳細オプションintは、ログファイルがサイズ制限を超えているために役立ちます。

私はパーセンテージバーだけを印刷する小さな関数を書いていましたが、ログサイズの制限と同じ問題が発生するので、stdoutをstderrにリダイレクトする必要があるかもしれませんが、わかりません。

これは、関数との抜粋です。

function cp_p() { 
    local files=0 
    while IFS= read -r -d '' file; do ((files++)); done < <(find -L $1 -mindepth 1 -name '*.*' -print0) 
    local duration=$(tput cols) 
    duration=$(($duration<80?$duration:80-8)) 
    local count=1 
    local elapsed=1 
    local bar="" 

    already_done() { 
    bar="\r|" 
    for ((done=0; done<$((($elapsed)*($duration)/100)); done++)); do 
     printf -v bar "$bar▇" 
    done 
    } 
    remaining() { 
    for ((remain=$((($elapsed)*($duration)/100)); remain<$duration; remain++)); do 
     printf -v bar "$bar " 
    done 
    printf -v bar "$bar|" 
    } 
    percentage() { 
    printf -v bar "$bar%3d%s" $elapsed '%%' 
    } 

    mkdir -p "$2/$1" 
    chmod `stat -f %A "$1"` "$2/$1" 

    while IFS= read -r -d '' file; do 
    file=$(echo $file | sed 's|^\./\(.*\)|"\1"|') 
    elapsed=$(((($count)*100)/($files))) 
    already_done 
    remaining 
    percentage 
    printf "$bar" 
    if [[ -d "$file" ]]; then 
     dst=$2/$file 
     test -d "$dst" || (mkdir -p "$dst" && chmod `stat -f %A "$file"` "$dst") 
    else 
     src=${file%/*} 
     dst=$2/$src 
     test -d "$dst" || (mkdir -p "$dst" && chmod `stat -f %A "$src"` "$dst") 
     cp -pf "$file" "$2/$file" 
    fi 
    ((count++)) 
    done < <(find -L $1 -mindepth 1 -name '*.*' -print0) 

    printf "\r" 
} 

これは私が

packaging files (this may take several minutes) ... 

|▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ | 98% 

The log length has exceeded the limit of 4 MB (this usually means that the test suite is raising the same exception over and over). 

The job has been terminated 

答えて

1

あなたはtravis_wait cp -rf $SRC $DSTを試してみました取得エラーですか?詳細については、https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-receivedを参照してください。

また、私は、一般的に、macOSビルドではディスク操作がかなり遅いと考えています。ファイルに触れている間は、ファイル構造を圧縮するほうがよいでしょう。あなたがgzipにしたいと思っているもの:

travis_wait tar -zcf $DST.tar.gz $SRC 
+0

私はそれを試してみましょう、ありがとう。 – rraallvv

関連する問題