CI Improvements #142

Merged
lucas merged 5 commits from issue/color-eyre into master 2023-11-23 15:30:31 +01:00
2 changed files with 23 additions and 12 deletions
Showing only changes of commit 4c96bcf5ba - Show all commits

View file

@ -12,39 +12,42 @@ title() {
printf "\033[1m%s\033[0m\n" "$1" printf "\033[1m%s\033[0m\n" "$1"
} }
cd "repo"
if [ -n "${PR:-}" ]; then if [ -n "${PR:-}" ]; then
title "PR: $(echo "$PR" | jq '.number') - $(echo "$PR" | jq '.title')" 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 else
ref=$(git describe --tags) ref=$(git describe --tags)
fi fi
title "Version is '$ref'" title "Version: '$ref'"
echo "$ref" > "$OUTPUT/version" echo "$ref" > "$OUTPUT/version"
cd "repo"
case "$TARGET" in case "$TARGET" in
msvc) msvc)
cp /src/*.lib ./lib/oodle/ 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 cargo build --color always --locked --release --target x86_64-pc-windows-msvc -Zbuild-std
title "Install artifacts" title "Install artifacts"
install -t "$OUTPUT/" target/x86_64-pc-windows-msvc/release/dtmt.exe install -v -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/dtmm.exe
;; ;;
linux) linux)
cp /src/*.a ./lib/oodle/ 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 cargo build --color always --locked --profile release-lto
title "Install artifacts" title "Installing artifacts"
install -t "$OUTPUT/" target/release-lto/dtmt install -v -t "$OUTPUT/" target/release-lto/dtmt
install -t "$OUTPUT/" target/release-lto/dtmm 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 exit 1
esac esac
title "Done"

View file

@ -1,7 +1,15 @@
#!/bin/sh #!/bin/sh
set -eux set -eu
title() {
printf "\033[1m%s\033[0m\n" "$1"
}
title "Install clippy"
rustup component add clippy rustup component add clippy
title "Run clippy"
cargo clippy --color always --no-deps cargo clippy --color always --no-deps
title "Done"