Skip to content

[Static SDK for Linux] Add a sanity check #446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions swift-ci/sdks/static-linux/build
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ case $(arch) in
arm64|aarch64)
OS_ARCH_SUFFIX=-aarch64
;;
amd64|x86_64)
i386|amd64|x86_64)
OS_ARCH_SUFFIX=
;;
*)
Expand All @@ -32,7 +32,7 @@ case $(arch) in
esac

# Build the Docker image
$DOCKER build --build-arg OS_ARCH_SUFFIX=$OS_ARCH_SUFFIX -t static-swift-linux .
$DOCKER build $DOCKER_EXTRA_ARGS --build-arg OS_ARCH_SUFFIX=$OS_ARCH_SUFFIX -t static-swift-linux .

# Check-out the sources
scripts/fetch-source.sh --clone-with-ssh --source-dir source
Expand All @@ -43,5 +43,6 @@ mkdir -p products
$DOCKER run -it --rm \
-v ./source:/source \
-v ./products:/products \
-m 10G \
static-swift-linux \
/scripts/build.sh --source-dir /source --products-dir /products
24 changes: 24 additions & 0 deletions swift-ci/sdks/static-linux/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -926,3 +926,27 @@ quiet_pushd "${build_dir}"
mkdir -p "${products_dir}"
tar cvzf "${products_dir}/${bundle}.tar.gz" "${bundle}"
quiet_popd

header "Install SDK"
swift sdk install "${products_dir}/${bundle}.tar.gz"

header "Build Hello World"
quiet_pushd "${build_dir}"
mkdir -p hello-world
cd hello-world
swift package init --type executable
for arch in $archs; do
swift build --swift-sdk ${arch}-swift-linux-musl
done
quiet_popd

header "Run Hello World"
quiet_pushd "${build_dir}/hello-world"
native_arch=$(uname -p)
native_binary=.build/${native_arch}-swift-linux-musl/debug/hello-world
if [[ -x "${native_binary}" ]]; then
"${native_binary}"
else
echo "No binary for ${native_arch}"
fi
quiet_popd
Loading