aboutsummaryrefslogtreecommitdiffstats
path: root/utils.sh
diff options
context:
space:
mode:
authoreine <6628437+eine@users.noreply.github.com>2020-01-19 03:25:43 +0000
committertgingold <tgingold@users.noreply.github.com>2020-01-19 04:25:43 +0100
commit910073d647e55d133494429d8c3a4bacffc32428 (patch)
tree6b1e616a1f670d44b03c1239ab5cba8aff15b909 /utils.sh
parent175123cda990ee2b5cfac461bd8ec44956da302a (diff)
downloadghdl-yosys-plugin-910073d647e55d133494429d8c3a4bacffc32428.tar.gz
ghdl-yosys-plugin-910073d647e55d133494429d8c3a4bacffc32428.tar.bz2
ghdl-yosys-plugin-910073d647e55d133494429d8c3a4bacffc32428.zip
migrate from Travis to GHA and rework examples (#78)
* migrate from Travis to GHA * rework examples
Diffstat (limited to 'utils.sh')
-rw-r--r--utils.sh56
1 files changed, 18 insertions, 38 deletions
diff --git a/utils.sh b/utils.sh
index 9bbcb47..68a6f02 100644
--- a/utils.sh
+++ b/utils.sh
@@ -19,54 +19,34 @@ enable_color
#--
print_start() {
- COL="$ANSI_BLUE"
- if [ "x$3" != "x" ]; then
- COL="$3"
+ if [ "x$2" != "x" ]; then
+ COL="$2"
+ elif [ "x$BASE_COL" != "x" ]; then
+ COL="$BASE_COL"
+ else
+ COL="$ANSI_MAGENTA"
fi
- printf "$COL> $2$ANSI_NOCOLOR\n"
+ printf "${COL}${1}$ANSI_NOCOLOR\n"
}
-travis_start () {
+gstart () {
print_start "$@"
}
-travis_finish () {
+gend () {
:
}
-[ -n "$TRAVIS" ] && {
- # This is a trimmed down copy of
- # https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/templates/header.sh
- travis_time_start() {
- # `date +%N` returns the date in nanoseconds. It is used as a replacement for $RANDOM, which is only available in bash.
- travis_timer_id=`date +%N`
- travis_start_time=$(travis_nanoseconds)
- echo "travis_time:start:$travis_timer_id"
- }
- travis_time_finish() {
- travis_end_time=$(travis_nanoseconds)
- local duration=$(($travis_end_time-$travis_start_time))
- echo "travis_time:end:$travis_timer_id:start=$travis_start_time,finish=$travis_end_time,duration=$duration"
- }
+if [ -n "$GITHUB_EVENT_PATH" ]; then
+ export CI=true
+fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then
- travis_nanoseconds() {
- date -u '+%s000000000'
- }
- else
- travis_nanoseconds() {
- date -u '+%s%N'
- }
- fi
-
- travis_start () {
- echo "travis_fold:start:$1"
- travis_time_start
+[ -n "$CI" ] && {
+ gstart () {
+ printf '::group::'
print_start "$@"
}
- travis_finish () {
- travis_time_finish
- echo "travis_fold:end:$1"
+ gend () {
+ echo '::endgroup::'
}
-
-} || echo "INFO: not in Travis CI"
+} || echo "INFO: not in CI"