This repository was archived by the owner on Apr 23, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 149
add presubmit_build.sh that passes a flag to swiftpm if it is a stock toolchain #723
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,43 @@ | ||
#!/bin/bash | ||
|
||
set -exuo pipefail | ||
|
||
sudo apt-get install -y docker.io | ||
|
||
# Sets 'swift_tf_url' to the public url corresponding to | ||
# 'swift_tf_bigstore_gfile', if it exists. | ||
if [[ ! -z ${swift_tf_bigstore_gfile+x} ]]; then | ||
export swift_tf_url="${swift_tf_bigstore_gfile/\/bigstore/https://storage.googleapis.com}" | ||
case "$swift_tf_url" in | ||
*stock*) STOCK_TOOLCHAIN=YES ;; | ||
*) ;; | ||
esac | ||
fi | ||
|
||
# Help debug the job's disk space. | ||
df -h | ||
|
||
# Move docker images into /tmpfs, where there is more space. | ||
sudo /etc/init.d/docker stop | ||
sudo mv /var/lib/docker /tmpfs/ | ||
sudo ln -s /tmpfs/docker /var/lib/docker | ||
sudo /etc/init.d/docker start | ||
|
||
# Help debug the job's disk space. | ||
df -h | ||
|
||
cd github/swift-models | ||
sudo -E docker build -t built-img -f docker/Dockerfile --build-arg swift_tf_url . | ||
|
||
# SwiftPM-based build. | ||
docker run built-img /bin/bash -c " | ||
swift build ${STOCK_TOOLCHAIN:+"-D -Xswiftc -D TENSORFLOW_USE_STANDARD_TOOLCHAIN"} ; | ||
swift test ${STOCK_TOOLCHAIN:+"-D -Xswiftc -D TENSORFLOW_USE_STANDARD_TOOLCHAIN"} ; | ||
" | ||
|
||
# CMake-based build. | ||
sudo docker run built-img /bin/bash -c " | ||
set -e; | ||
cmake -B /BinaryCache/tensorflow-swift-models -D CMAKE_BUILD_TYPE=Release -D CMAKE_Swift_COMPILER=/swift-tensorflow-toolchain/usr/bin/swiftc -G Ninja -S /swift-models; | ||
cmake --build /BinaryCache/tensorflow-swift-models --verbose; | ||
" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there might be an extra -D in both of these. Should it just be
"-Xswiftc -D TENSORFLOW_USE_STANDARD_TOOLCHAIN"
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. And there should also be another
-Xswiftc
, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think just the one is needed if you smoosh the last two together into
"-Xswiftc -DTENSORFLOW_USE_STANDARD_TOOLCHAIN"
. That works for me at the command line.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I tried what you have now with the two of them, and that also works well.