Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Add Rust support #477

Merged
merged 27 commits into from
Dec 7, 2020
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3525f0c
Install stable Rust toolchain.
May 29, 2019
73a5e62
Install Rust dependencies, build optimised binaries.
May 29, 2019
09f583f
Remove `cargo update`; this would make Cargo.lock useless.
May 30, 2019
8399525
Cache Rust compiler output too.
May 30, 2019
ece7049
Bring back post-execution caching.
May 30, 2019
68c5d2b
Make `repo/target` caching optional.
Jun 4, 2019
d927ffb
Merge branch 'rust' into rust-nocache
Jun 4, 2019
8e13758
Merge commit ff8f5a3541b520f070dfd237a41cd9789de3b915 (no conflict)
cecton Oct 1, 2020
5cd8e76
Removed unneeded mkdir -p
cecton Nov 5, 2020
e4e7354
Removed ... something
cecton Nov 5, 2020
db4ab67
Apply suggestion
cecton Nov 5, 2020
60fd309
Removed pre-compilation step
cecton Nov 5, 2020
b720533
Fix comment and use appropriate function
cecton Nov 5, 2020
c56e184
Merge commit 96a3c6f04f5879262aa727dea3a1027b6095ddb1 (conflicts)
cecton Nov 5, 2020
c0de9b0
Merge commit 92f69f9fd7091370bb521169b2400ff5153f0dcc (no conflict)
cecton Nov 5, 2020
0a8215d
Merge commit 19b59c0408431d785c57f229aa9f701b0ae95613 (conflicts)
cecton Nov 5, 2020
6d1d1f6
Merge commit 3dbb487a86b68d051559ccd9d490fe785d3860f4 (no conflict)
cecton Nov 5, 2020
f14eeca
CLEANUP
cecton Nov 5, 2020
7084515
CLEANUP
cecton Nov 28, 2020
d39611c
Merge commit fa6e85ee8d61e9ca22f0d26fa3ebf5fce3ef2fec (no conflict)
cecton Nov 28, 2020
932e0af
Cache .cargo/bin and .rustup too
cecton Nov 28, 2020
0da465e
Do not install toolchain by default
cecton Dec 3, 2020
71ac638
Fix comment
cecton Dec 3, 2020
21ae6eb
Merge commit 8a965d0d4022211b40827efae49d344d9dec8783 (no conflict)
cecton Dec 4, 2020
7f1e907
Update included_software.md
cecton Dec 5, 2020
d66e848
Added rustup to the list of tools
cecton Dec 5, 2020
23b30a7
Revert "Added rustup to the list of tools"
cecton Dec 5, 2020
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
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,14 @@ RUN brew tap homebrew/bundle

WORKDIR /

################################################################################
#
# Rust toolchain & rustup
#
################################################################################
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH "$PATH:/opt/buildhome/.cargo/bin"

# Cleanup
USER root

Expand Down
15 changes: 15 additions & 0 deletions run-build-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ mkdir -p $NETLIFY_CACHE_DIR/.composer
mkdir -p $NETLIFY_CACHE_DIR/.gimme_cache/gopath
mkdir -p $NETLIFY_CACHE_DIR/.gimme_cache/gocache
mkdir -p $NETLIFY_CACHE_DIR/.homebrew-cache
mkdir -p $NETLIFY_CACHE_DIR/.cargo
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is necessary because I'm caching a few subdirectories to this


: ${YARN_FLAGS=""}
: ${NPM_FLAGS=""}
Expand Down Expand Up @@ -644,6 +645,16 @@ install_dependencies() {
fi
fi

# Rust
if [ -f Cargo.toml ] || [ -f Cargo.lock ]
then
restore_home_cache ".rustup" "rust rustup cache"
restore_home_cache ".cargo/registry" "rust cargo registry cache"
restore_home_cache ".cargo/bin" "rust cargo bin cache"
restore_cwd_cache "target" "rust compile output"
source $HOME/.cargo/env
fi

# Setup project GOPATH
if [ -n "$GO_IMPORT_PATH" ]
then
Expand All @@ -664,6 +675,7 @@ cache_artifacts() {
cache_cwd_directory ".venv" "python virtualenv"
cache_cwd_directory ".build" "swift build"
cache_cwd_directory ".netlify/plugins" "build plugins"
cache_cwd_directory "target" "rust compile output"

cache_home_directory ".yarn_cache" "yarn cache"
cache_home_directory ".cache/pip" "pip cache"
Expand All @@ -673,6 +685,9 @@ cache_artifacts() {
cache_home_directory ".boot" "boot dependencies"
cache_home_directory ".composer" "composer dependencies"
cache_home_directory ".homebrew-cache", "homebrew cache"
cache_home_directory ".rustup" "rust rustup cache"
cache_home_directory ".cargo/registry" "rust cargo registry cache"
cache_home_directory ".cargo/bin" "rust cargo bin cache"

# Don't follow the Go import path or we'll store
# the origin repo twice.
Expand Down
2 changes: 2 additions & 0 deletions run-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ echo "Executing user command: $cmd"
eval "$cmd"
CODE=$?

cache_artifacts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you adding this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, I'm not the author. Should I remove it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i'd remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e4e7354

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah funny I have re-added this!

I know why the author added this. It's because when you run the test, the cache is restored (by install_dependencies in line 29) but it is not saved after the job.


exit $CODE