-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run the orchestrator unit tests in CI
Rework the build to use a separate Dockerfile — it was simply too complicated to have the nested scripts in YAML.
- Loading branch information
1 parent
13e53f9
commit 710e3f5
Showing
5 changed files
with
81 additions
and
83 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
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
FROM rust:alpine | ||
|
||
RUN apk add musl-dev openssl-dev openssl-libs-static | ||
|
||
# Adding -C relocation-model=static due to | ||
# https://github.com/rust-lang/rust/issues/95926 | ||
|
||
# Adding this to find the statically-built version | ||
ENV OPENSSL_NO_PKG_CONFIG=1 OPENSSL_STATIC=1 OPENSSL_DIR=/usr/ | ||
|
||
RUN mkdir /output | ||
|
||
COPY compiler/base/asm-cleanup /compiler/base/asm-cleanup | ||
COPY compiler/base/orchestrator /compiler/base/orchestrator | ||
COPY compiler/base/modify-cargo-toml /compiler/base/modify-cargo-toml | ||
COPY ui /ui | ||
|
||
WORKDIR /compiler/base/orchestrator | ||
|
||
# Hackily deleting the binary sources because I don't know how to | ||
# limit `cargo rustc` to just the library unit tests | ||
RUN \ | ||
rm src/bin/*; \ | ||
cargo rustc --tests --locked -- --cfg force_docker -C relocation-model=static; \ | ||
test_bin=$(find target/debug/deps/ -name "orchestrator*" -type f -perm -a=x); \ | ||
mv "${test_bin}" /output/unit_tests_orchestrator; | ||
|
||
WORKDIR /ui | ||
|
||
RUN \ | ||
cargo rustc --tests --locked -- -C relocation-model=static; \ | ||
test_bin=$(find target/debug/deps/ -name "ui*" -type f -perm -a=x); \ | ||
mv "${test_bin}" /output/unit_tests_ui; | ||
|
||
RUN \ | ||
cargo rustc --locked --release -- -C relocation-model=static; \ | ||
mv target/release/ui /output/ui; |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
* | ||
!compiler/base/asm-cleanup/** | ||
compiler/base/asm-cleanup/target | ||
!compiler/base/orchestrator/** | ||
compiler/base/orchestrator/target | ||
!compiler/base/modify-cargo-toml/** | ||
compiler/base/modify-cargo-toml/target | ||
!ui/** | ||
ui/frontend | ||
ui/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
|
||
IMAGE_NAME=backend-build | ||
OUTPUT_DIR=docker-output | ||
|
||
docker build -t "${IMAGE_NAME}" -f ci/Dockerfile . | ||
|
||
mkdir -p "${OUTPUT_DIR}" | ||
|
||
container_id=$(docker create "${IMAGE_NAME}") | ||
for f in unit_tests_orchestrator unit_tests_ui ui; do | ||
docker cp "${container_id}:/output/${f}" "${OUTPUT_DIR}" | ||
done | ||
docker rm -f "${container_id}" |
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