2022-07-02 18:15:48 +03:00
|
|
|
FROM rust:1.61.0-slim-bullseye # make sure to update rust-toolchain.toml too so that everything uses the same rust version
|
2021-02-02 17:14:27 +03:00
|
|
|
WORKDIR /earthbuild
|
|
|
|
|
|
|
|
prep-debian:
|
|
|
|
RUN apt -y update
|
|
|
|
|
|
|
|
install-other-libs:
|
|
|
|
FROM +prep-debian
|
|
|
|
RUN apt -y install wget git
|
|
|
|
RUN apt -y install libxcb-shape0-dev libxcb-xfixes0-dev # for editor clipboard
|
2021-09-29 16:02:23 +03:00
|
|
|
RUN apt -y install libasound2-dev # for editor sounds
|
2021-08-29 23:59:43 +03:00
|
|
|
RUN apt -y install libunwind-dev pkg-config libx11-dev zlib1g-dev
|
2022-05-02 16:34:00 +03:00
|
|
|
RUN apt -y install unzip # for www/build.sh
|
2021-02-02 17:14:27 +03:00
|
|
|
|
2022-07-13 16:51:32 +03:00
|
|
|
install-zig-llvm-valgrind:
|
2021-02-02 17:14:27 +03:00
|
|
|
FROM +install-other-libs
|
2022-03-11 02:27:15 +03:00
|
|
|
# editor
|
|
|
|
RUN apt -y install libxkbcommon-dev
|
2021-02-03 18:45:04 +03:00
|
|
|
# zig
|
2022-02-15 08:23:42 +03:00
|
|
|
RUN wget -c https://ziglang.org/download/0.9.1/zig-linux-x86_64-0.9.1.tar.xz --no-check-certificate
|
|
|
|
RUN tar -xf zig-linux-x86_64-0.9.1.tar.xz
|
2022-05-07 20:38:04 +03:00
|
|
|
RUN ln -s /earthbuild/zig-linux-x86_64-0.9.1/zig /bin/zig
|
2022-03-11 02:27:15 +03:00
|
|
|
# zig builtins wasm tests
|
|
|
|
RUN apt -y install build-essential
|
|
|
|
RUN cargo install wasmer-cli --features "singlepass"
|
2022-07-09 23:30:29 +03:00
|
|
|
RUN cargo install bindgen
|
2021-02-03 18:45:04 +03:00
|
|
|
# llvm
|
2021-02-02 17:14:27 +03:00
|
|
|
RUN apt -y install lsb-release software-properties-common gnupg
|
|
|
|
RUN wget https://apt.llvm.org/llvm.sh
|
|
|
|
RUN chmod +x llvm.sh
|
2022-04-08 15:38:11 +03:00
|
|
|
RUN ./llvm.sh 13
|
|
|
|
RUN ln -s /usr/bin/clang-13 /usr/bin/clang
|
2021-02-09 13:29:41 +03:00
|
|
|
# use lld as linker
|
2022-04-08 15:38:11 +03:00
|
|
|
RUN ln -s /usr/bin/lld-13 /usr/bin/ld.lld
|
2021-02-22 00:09:17 +03:00
|
|
|
ENV RUSTFLAGS="-C link-arg=-fuse-ld=lld -C target-cpu=native"
|
2021-02-03 18:45:04 +03:00
|
|
|
# valgrind
|
2021-09-05 14:31:58 +03:00
|
|
|
RUN apt -y install valgrind
|
2022-03-27 12:37:34 +03:00
|
|
|
# wasm repl & tests
|
|
|
|
RUN rustup target add wasm32-unknown-unknown wasm32-wasi
|
2022-02-27 14:26:17 +03:00
|
|
|
RUN apt -y install libssl-dev
|
2022-02-27 01:45:45 +03:00
|
|
|
RUN OPENSSL_NO_VENDOR=1 cargo install wasm-pack
|
2021-05-17 20:44:03 +03:00
|
|
|
# criterion
|
2021-08-02 19:34:29 +03:00
|
|
|
RUN cargo install cargo-criterion
|
2021-02-08 20:59:21 +03:00
|
|
|
# sccache
|
2021-02-25 05:00:00 +03:00
|
|
|
RUN cargo install sccache
|
2021-02-08 22:06:32 +03:00
|
|
|
RUN sccache -V
|
2021-02-22 00:09:17 +03:00
|
|
|
ENV RUSTC_WRAPPER=/usr/local/cargo/bin/sccache
|
|
|
|
ENV SCCACHE_DIR=/earthbuild/sccache_dir
|
|
|
|
ENV CARGO_INCREMENTAL=0 # no need to recompile package when using new function
|
2021-02-05 21:48:02 +03:00
|
|
|
|
2021-02-25 05:00:00 +03:00
|
|
|
copy-dirs:
|
2022-07-13 16:51:32 +03:00
|
|
|
FROM +install-zig-llvm-valgrind
|
2022-07-09 12:15:58 +03:00
|
|
|
COPY --dir crates examples Cargo.toml Cargo.lock version.txt www ./
|
2021-02-22 03:11:25 +03:00
|
|
|
|
2021-10-03 18:26:11 +03:00
|
|
|
# compile everything needed for benchmarks and output a self-contained dir from which benchmarks can be run.
|
2021-06-09 19:52:34 +03:00
|
|
|
prep-bench-folder:
|
2021-08-24 13:34:22 +03:00
|
|
|
FROM +copy-dirs
|
2022-06-15 13:24:41 +03:00
|
|
|
# to make use of avx, avx2, sse2, sse4.2... instructions
|
|
|
|
ENV RUSTFLAGS="-C link-arg=-fuse-ld=lld -C target-cpu=native"
|
2021-06-09 19:52:34 +03:00
|
|
|
ARG BENCH_SUFFIX=branch
|
2021-05-17 20:44:03 +03:00
|
|
|
RUN cargo criterion -V
|
2022-07-01 21:35:15 +03:00
|
|
|
RUN --mount=type=cache,target=$SCCACHE_DIR cd crates/cli && cargo criterion --no-run
|
2022-07-02 11:41:14 +03:00
|
|
|
RUN mkdir -p bench-folder/crates/compiler/builtins/bitcode/src
|
2021-06-09 19:52:34 +03:00
|
|
|
RUN mkdir -p bench-folder/target/release/deps
|
|
|
|
RUN mkdir -p bench-folder/examples/benchmarks
|
|
|
|
RUN cp examples/benchmarks/*.roc bench-folder/examples/benchmarks/
|
|
|
|
RUN cp -r examples/benchmarks/platform bench-folder/examples/benchmarks/
|
2022-07-02 11:41:14 +03:00
|
|
|
RUN cp crates/compiler/builtins/bitcode/src/str.zig bench-folder/crates/compiler/builtins/bitcode/src
|
2021-06-09 19:52:34 +03:00
|
|
|
RUN cp target/release/roc bench-folder/target/release
|
|
|
|
# copy the most recent time bench to bench-folder
|
|
|
|
RUN cp target/release/deps/`ls -t target/release/deps/ | grep time_bench | head -n 1` bench-folder/target/release/deps/time_bench
|
|
|
|
SAVE ARTIFACT bench-folder AS LOCAL bench-folder-$BENCH_SUFFIX
|