starship/tests/Dockerfile

59 lines
1.6 KiB
Docker
Raw Normal View History

FROM rust
# Install Tarpaulin (code coverage tool)
# https://github.com/xd009642/tarpaulin
COPY --from=xd009642/tarpaulin /usr/local/cargo/bin/cargo-tarpaulin /usr/local/cargo/bin/cargo-tarpaulin
2019-04-28 17:34:46 +00:00
# Install Node.js
ENV NODE_VERSION 12.0.0
ENV PATH /root/.nvm/versions/node/v$NODE_VERSION/bin:$PATH
RUN curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
2019-04-28 17:34:46 +00:00
# Check that Node.js was correctly installed
2019-05-12 03:58:45 +00:00
RUN node --version
# Install Go
ENV GO_VERSION 1.10.0
ENV GOENV_ROOT /root/.goenv
ENV PATH $GOENV_ROOT/bin:$GOENV_ROOT/shims:$PATH
RUN git clone https://github.com/syndbg/goenv.git $GOENV_ROOT \
&& eval "$(goenv init -)" \
&& goenv install $GO_VERSION \
&& goenv global $GO_VERSION
2019-05-12 03:58:45 +00:00
# Check that Go was correctly installed
RUN go version
# Install Python
ENV PYTHON_VERSION 3.6.8
ENV PYENV_ROOT /root/.pyenv
ENV PATH $PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH
RUN curl https://pyenv.run | bash \
&& pyenv install $PYTHON_VERSION \
&& pyenv global $PYTHON_VERSION
# Check that Python was correctly installed
RUN python --version
2019-04-28 17:34:46 +00:00
# Create blank project
RUN USER=root cargo new --bin starship
WORKDIR /starship
# We want dependencies cached, so copy those first
2019-05-12 03:58:45 +00:00
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
2019-04-28 17:34:46 +00:00
# Cargo.toml will fail to parse without my_benchmark
RUN mkdir benches
RUN touch benches/my_benchmark.rs
# This is a dummy build to get dependencies cached
RUN cargo build --release
2019-04-28 17:34:46 +00:00
# Delete the dummy build
RUN rm -rf /starship
# Create the directory for the real source files
RUN mkdir starship
WORKDIR /starship
# Instrument coverage tooling and run the full test suite
CMD ["cargo", "tarpaulin", "--ignored", "--out", "Xml"]