-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace release proces with new setup
- Loading branch information
1 parent
7e93a0d
commit 245c368
Showing
9 changed files
with
258 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ on: | |
merge_group: | ||
branches: | ||
- main | ||
workflow_call: {} | ||
|
||
jobs: | ||
build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[target.x86_64-unknown-linux-gnu] | ||
image = "ghcr.io/cross-rs/x86_64-unknown-linux-gnu" | ||
|
||
[target.aarch64-unknown-linux-gnu] | ||
image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eo pipefail | ||
|
||
: "${RELEASE_TARGETS:=aarch64-unknown-linux-gnu,armv7-unknown-linux-gnueabihf,x86_64-unknown-linux-gnu,i686-unknown-linux-gnu}" | ||
IFS=',' read -r -a targets <<< "$RELEASE_TARGETS" | ||
|
||
target_dir="target/pkg" | ||
|
||
rm -rf "$target_dir" | ||
mkdir -p "$target_dir" | ||
|
||
package_version=$(cargo read-manifest --manifest-path ntpd/Cargo.toml | jq -r .version) | ||
toolchain=$(rustup show active-toolchain | cut -d' ' -f1) | ||
host_target=$(echo "$toolchain" | cut -d'-' -f2-) | ||
sysroot=$(rustc --print sysroot) | ||
llvm_tools_path="$sysroot/lib/rustlib/$host_target/bin" | ||
|
||
echo "--- Running on toolchain '${toolchain}', make sure the llvm-tools component is installed" | ||
echo "--- Host target is '$host_target'" | ||
|
||
for target in "${targets[@]}"; do | ||
dbg_sym_tar="ntpd-rs_dbg_$package_version-$target.tar.gz" | ||
|
||
echo "--- Calling cross for building ntpd package for target '$target'" | ||
cross build --target "$target" --package ntpd --release --features "${RELEASE_FEATURES:-}" | ||
|
||
echo "--- Creating separate debug symbol files for target '$target'" | ||
( | ||
cd "target/$target/release" | ||
find . -maxdepth 1 -type f -executable -print0 | while IFS= read -r -d '' file; do | ||
echo "--- Writing debug symbols from '$file' to '$file.dbg'" | ||
"$llvm_tools_path/llvm-strip" --only-keep-debug -o "$file.dbg" "$file" | ||
chmod -x "$file.dbg" | ||
echo "--- Removing all symbols from binary '$file'" | ||
"$llvm_tools_path/llvm-strip" -s "$file" | ||
done | ||
); | ||
|
||
echo "--- Create tar for debug symbols" | ||
( | ||
cd "target/$target/release" | ||
rm -f "$dbg_sym_tar" | ||
find . -maxdepth 1 -type f -name '*.dbg' -exec tar uvf "$dbg_sym_tar" {} + | ||
); | ||
|
||
echo "--- Creating deb package" | ||
cargo deb --no-build --no-strip --target "$target" --compress-type xz --package ntpd | ||
|
||
echo "--- Creating rpm package" | ||
cargo generate-rpm --payload-compress xz --package ntpd --target "$target" --target-dir target | ||
|
||
echo "--- Copying output files to target" | ||
cp "target/$target/release/$dbg_sym_tar" "$target_dir/" | ||
find "target/$target/debian" -maxdepth 1 -type f -name '*.deb' -exec cp "{}" "$target_dir/" \; | ||
find "target/$target/generate-rpm" -maxdepth 1 -type f -name '*.rpm' -exec cp "{}" "$target_dir/" \; | ||
done | ||
|
||
echo "--- Generating SHA256SUMS file" | ||
( | ||
cd $target_dir | ||
sha256sum -b * > SHA256SUMS | ||
) | ||
|
||
echo "--- Done, output is in $target_dir" | ||
|
||
|
Oops, something went wrong.