-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(interop-tests): build test binary inside container (#3441)
Building inside the container allows Windows and MacOS users to also build this binary. Thanks to a new feature from docker, `--mount=type=cache`, rebuilding layers is fast without any additional hacks.
- Loading branch information
Showing
6 changed files
with
29 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1 @@ | ||
# This Docker ignore file aims to optimise the build process of the interop tests. | ||
# The Dockerfile in ./interop-tests/Dockerfile copies a locally built binary into the container and | ||
# thus does not need anything else to be present in the working directory. | ||
* | ||
|
||
# CI will build and copy over the release binary. | ||
!target/release/ping | ||
|
||
# Locally, we might want to build it as `debug` binary to accelerate the build process. | ||
!target/debug/ping | ||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
FROM ubuntu:22.04 | ||
ARG TEST_BINARY | ||
COPY $TEST_BINARY /usr/local/bin/testplan | ||
LABEL org.opencontainers.image.source https://github.com/libp2p/rust-libp2p | ||
# syntax=docker/dockerfile:1.5-labs | ||
FROM rust:1.67.0 | ||
|
||
# Setup protoc. TODO this breaks reproducibility and uses an old version of protoc. | ||
# In the future protobuf generated files will be checked in, so we can remove this | ||
WORKDIR /protoc-setup | ||
RUN apt-get update && apt-get install -y cmake protobuf-compiler | ||
|
||
# Run with access to the target cache to speed up builds | ||
WORKDIR /workspace | ||
ADD . . | ||
RUN --mount=type=cache,target=./target \ | ||
--mount=type=cache,target=/usr/local/cargo/registry \ | ||
cargo build --package interop-tests | ||
|
||
RUN --mount=type=cache,target=./target \ | ||
mv ./target/debug/ping /usr/local/bin/testplan | ||
|
||
ENV RUST_BACKTRACE=1 | ||
ENTRYPOINT ["testplan"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters