dtmt/.ci/tasks/build.sh
Lucas Schwiderski f30dc95385
Some checks are pending
test Testing the new resource type
lint/clippy Checking for common mistakes and opportunities for code improvement
build/msvc Build for the target platform: msvc
build/linux Build for the target platform: linux
ci: Use resource for Gitea package upload
2023-11-22 16:22:26 +01:00

50 lines
1.3 KiB
Bash
Executable file

#!/bin/sh
set -eu
if [ -n "$OUTPUT" ]; then
OUTPUT="$PWD/$OUTPUT"
else
OUTPUT=$(mktemp -d)
fi
title() {
printf "\033[1m%s\033[0m\n" "$1"
}
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')"
else
ref=$(git describe --tags)
fi
title "Version is '$ref'"
echo "$ref" > "$OUTPUT/version"
cd "repo"
case "$TARGET" in
msvc)
cp /src/*.lib ./lib/oodle/
title "Build 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
;;
linux)
cp /src/*.a ./lib/oodle/
title "Build 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
;;
*)
echo "Env var 'TARGET' must either be 'msvc' or 'linux'. Got '$TARGET'." >&2
exit 1
esac