tinybirdco / ci

Collection of configuration files that enable CI flows for Tinybird projects
MIT License
2 stars 3 forks source link

Optimize CI #43

Closed jlmadurga closed 6 months ago

jlmadurga commented 6 months ago

Save some time:

jlmadurga commented 6 months ago

In case it's useful I used this to parallelize fixture tests. We could include it in the next CLI release.

#!/usr/bin/env bash

export TB_VERSION_WARNING=0

run_test() {
    t=$1
    echo "** Running $t **"
    echo "** $(cat $t)"
    if res=$(bash $t $2 | diff -B ${t}.result -); then
        echo 'OK';
    else
        echo "failed, diff:";
        echo "$res";
        return 1
    fi
    echo ""
}
export -f run_test

fail=0
parallel -j 4 --halt soon,fail=1 run_test {} $1 ::: $(find ./tests -name "*.test") || fail=1

if [ $fail == 1 ]; then
  exit -1;

Ok I see you need to have parallel dep. Let's do it in separate PR to analyze properly

alrocar commented 6 months ago

@jlmadurga should we merge this?

jlmadurga commented 6 months ago

@jlmadurga should we merge this?

Yes, I forgot to do it