2021-02-02 17:14:27 +03:00
|
|
|
FROM rust:1.49-slim-buster
|
|
|
|
WORKDIR /earthbuild
|
|
|
|
|
|
|
|
# TODO cache cargo packages
|
|
|
|
# TODO lld linker
|
|
|
|
# TODO caching steps
|
2021-02-03 21:54:25 +03:00
|
|
|
# TODO zig tests
|
2021-02-02 17:14:27 +03:00
|
|
|
|
|
|
|
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
|
|
|
|
RUN apt -y install libc++-dev libc++abi-dev libunwind-dev pkg-config libx11-dev zlib1g-dev
|
|
|
|
|
2021-02-03 18:45:04 +03:00
|
|
|
install-zig-llvm-valgrind-clippy-rustfmt:
|
2021-02-02 17:14:27 +03:00
|
|
|
FROM +install-other-libs
|
2021-02-03 18:45:04 +03:00
|
|
|
# zig
|
2021-02-02 17:14:27 +03:00
|
|
|
RUN wget -c https://ziglang.org/download/0.7.1/zig-linux-x86_64-0.7.1.tar.xz --no-check-certificate
|
|
|
|
RUN tar -xf zig-linux-x86_64-0.7.1.tar.xz
|
2021-02-03 18:45:04 +03:00
|
|
|
RUN ln -s /earthbuild/zig-linux-x86_64-0.7.1/zig /usr/bin/zig
|
|
|
|
# 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
|
|
|
|
RUN ./llvm.sh 10
|
|
|
|
RUN ln -s /usr/bin/clang-10 /usr/bin/clang
|
|
|
|
RUN ln -s /usr/bin/lld-10 /usr/bin/lld
|
2021-02-03 18:45:04 +03:00
|
|
|
# valgrind
|
2021-02-02 17:14:27 +03:00
|
|
|
RUN apt -y install autotools-dev cmake automake
|
|
|
|
RUN wget https://sourceware.org/pub/valgrind/valgrind-3.16.1.tar.bz2
|
|
|
|
RUN tar -xf valgrind-3.16.1.tar.bz2
|
|
|
|
RUN mv valgrind-3.16.1/* . # we can't cd so we have to move the files
|
|
|
|
RUN ls
|
|
|
|
RUN ./autogen.sh
|
|
|
|
RUN ./configure --disable-dependency-tracking
|
|
|
|
RUN make -j`nproc`
|
|
|
|
RUN make install
|
2021-02-03 18:45:04 +03:00
|
|
|
# clippy
|
2021-02-02 17:14:27 +03:00
|
|
|
RUN rustup component add clippy
|
2021-02-03 18:45:04 +03:00
|
|
|
# rustfmt
|
2021-02-02 17:14:27 +03:00
|
|
|
RUN rustup component add rustfmt
|
|
|
|
|
2021-02-03 21:54:25 +03:00
|
|
|
build-rust-tests:
|
2021-02-03 18:45:04 +03:00
|
|
|
FROM +install-zig-llvm-valgrind-clippy-rustfmt
|
2021-02-03 21:54:25 +03:00
|
|
|
COPY --dir cli compiler docs editor roc_std vendor examples Cargo.toml Cargo.lock ./
|
|
|
|
RUN cargo test --release --no-run
|
|
|
|
|
|
|
|
test-rust:
|
|
|
|
FROM +build-rust-tests
|
2021-02-02 21:42:24 +03:00
|
|
|
RUN cargo test --release
|
|
|
|
|