From 4c96bcf5ba25d8b6d73e128a6358d7551b478ef2 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Thu, 23 Nov 2023 13:29:12 +0100 Subject: [PATCH] Improve CI log output --- .ci/tasks/build.sh | 25 ++++++++++++++----------- .ci/tasks/clippy.sh | 10 +++++++++- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/.ci/tasks/build.sh b/.ci/tasks/build.sh index 226f137..4c70a10 100755 --- a/.ci/tasks/build.sh +++ b/.ci/tasks/build.sh @@ -12,39 +12,42 @@ title() { printf "\033[1m%s\033[0m\n" "$1" } +cd "repo" + if [ -n "${PR:-}" ]; then title "PR: $(echo "$PR" | jq '.number') - $(echo "$PR" | jq '.title')" - ref="pr-$(echo "$PR" | jq '.number')-$(git rev-parse --short HEAD 2>/dev/null || echo 'manual')" + ref="pr-$(echo "$PR" | jq '.number')-$(git rev-parse --short $(cat .git/ref || echo "HEAD")) 2>/dev/null || echo 'manual')" else ref=$(git describe --tags) fi -title "Version is '$ref'" +title "Version: '$ref'" echo "$ref" > "$OUTPUT/version" -cd "repo" case "$TARGET" in msvc) cp /src/*.lib ./lib/oodle/ - title "Build project for target $TARGET" + title "Building project for target $TARGET" cargo build --color always --locked --release --target x86_64-pc-windows-msvc -Zbuild-std title "Install artifacts" - install -t "$OUTPUT/" target/x86_64-pc-windows-msvc/release/dtmt.exe - install -t "$OUTPUT/" target/x86_64-pc-windows-msvc/release/dtmm.exe + install -v -t "$OUTPUT/" target/x86_64-pc-windows-msvc/release/dtmt.exe + install -v -t "$OUTPUT/" target/x86_64-pc-windows-msvc/release/dtmm.exe ;; linux) cp /src/*.a ./lib/oodle/ - title "Build project for target $TARGET" + title "Building project for target $TARGET" cargo build --color always --locked --profile release-lto - title "Install artifacts" - install -t "$OUTPUT/" target/release-lto/dtmt - install -t "$OUTPUT/" target/release-lto/dtmm + title "Installing artifacts" + install -v -t "$OUTPUT/" target/release-lto/dtmt + install -v -t "$OUTPUT/" target/release-lto/dtmm ;; *) - echo "Env var 'TARGET' must either be 'msvc' or 'linux'. Got '$TARGET'." >&2 + echo -e "\033[31;1mEnv var 'TARGET' must either be 'msvc' or 'linux'. Got '$TARGET'.\033[0m" >&2 exit 1 esac + +title "Done" diff --git a/.ci/tasks/clippy.sh b/.ci/tasks/clippy.sh index a7b6e11..33901a9 100755 --- a/.ci/tasks/clippy.sh +++ b/.ci/tasks/clippy.sh @@ -1,7 +1,15 @@ #!/bin/sh -set -eux +set -eu +title() { + printf "\033[1m%s\033[0m\n" "$1" +} + +title "Install clippy" rustup component add clippy +title "Run clippy" cargo clippy --color always --no-deps + +title "Done"