roc/Earthfile

90 lines
2.6 KiB
Plaintext
Raw Normal View History

2021-02-02 17:14:27 +03:00
FROM rust:1.49-slim-buster
WORKDIR /earthbuild
2021-02-05 22:34:53 +03:00
# TODO use lld linker
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
2021-02-05 21:48:02 +03:00
# need to cd every time, every command starts at WORKDIR
RUN cd valgrind-3.16.1; ./autogen.sh
RUN cd valgrind-3.16.1; ./configure --disable-dependency-tracking
RUN cd valgrind-3.16.1; make -j`nproc`
RUN cd valgrind-3.16.1; 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-05 21:48:02 +03:00
deps-image:
FROM +install-zig-llvm-valgrind-clippy-rustfmt
SAVE IMAGE roc-deps:latest
2021-02-05 22:34:53 +03:00
copy-dirs-and-cache:
2021-02-03 18:45:04 +03:00
FROM +install-zig-llvm-valgrind-clippy-rustfmt
2021-02-06 16:18:03 +03:00
# cache
COPY --dir sccache_dir ci/sccache ./
# roc dirs
2021-02-03 21:54:25 +03:00
COPY --dir cli compiler docs editor roc_std vendor examples Cargo.toml Cargo.lock ./
2021-02-05 21:48:02 +03:00
test-zig:
FROM +install-zig-llvm-valgrind-clippy-rustfmt
COPY --dir compiler/builtins/bitcode ./
RUN cd bitcode; ./run-tests.sh;
2021-02-03 21:54:25 +03:00
2021-02-05 22:34:53 +03:00
build-rust:
FROM +copy-dirs-and-cache
2021-02-06 16:18:03 +03:00
ARG RUSTC_WRAPPER=/earthbuild/sccache
ARG SCCACHE_DIR=/earthbuild/sccache_dir
2021-02-05 22:34:53 +03:00
RUN cargo build # for clippy
RUN cargo test --release --no-run
check-clippy:
FROM +build-rust
RUN cargo clippy -- -D warnings
check-rustfmt:
FROM +copy-dirs-and-cache
RUN cargo fmt --all -- --check
save-cache:
FROM +build-rust
2021-02-06 16:18:03 +03:00
SAVE ARTIFACT sccache_dir AS LOCAL sccache_dir
2021-02-05 22:34:53 +03:00
2021-02-03 21:54:25 +03:00
test-rust:
2021-02-05 22:34:53 +03:00
FROM +build-rust
2021-02-06 16:18:03 +03:00
ARG RUSTC_WRAPPER=/earthbuild/sccache
ARG SCCACHE_DIR=/earthbuild/sccache_dir
2021-02-02 21:42:24 +03:00
RUN cargo test --release
2021-02-06 16:18:03 +03:00
RUN ./sccache --show-stats
2021-02-05 21:48:02 +03:00
test-all:
2021-02-05 22:34:53 +03:00
BUILD +check-clippy
BUILD +check-rustfmt
BUILD +save-cache
2021-02-05 21:48:02 +03:00
BUILD +test-zig
BUILD +test-rust
2021-02-02 21:42:24 +03:00