Skip to content

Commit 256603d

Browse files
committed
build-test: use local small build-env, dummy crate for test
1 parent de27a1b commit 256603d

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

Diff for: .github/workflows/ci.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,15 @@ jobs:
6363
- name: fast tests
6464
run: cargo test --workspace --locked
6565

66+
- name: create small build-environment
67+
run: |
68+
docker build -t buildenv - < dockerfiles/Dockerfile-small-build-env
69+
6670
- name: slow tests
6771
env:
6872
DOCSRS_INCLUDE_DEFAULT_TARGETS: true
69-
run: cargo test --workspace --locked -- --ignored
73+
DOCS_RS_LOCAL_DOCKER_IMAGE: buildenv
74+
run: cargo test --workspace --locked -- --ignored --nocapture
7075

7176
- name: Clean up the database
7277
run: docker-compose down --volumes

Diff for: dockerfiles/Dockerfile-small-build-env

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM ubuntu:focal
2+
3+
RUN apt-get update
4+
RUN apt-get install -y --no-install-recommends apt-utils build-essential sudo git
5+
6+
CMD ["bash"]

Diff for: src/docbuilder/rustwide_builder.rs

+11-7
Original file line numberDiff line numberDiff line change
@@ -763,8 +763,9 @@ mod tests {
763763
#[ignore]
764764
fn test_build_crate() {
765765
wrapper(|env| {
766-
let crate_ = "log";
767-
let version = "0.4.14";
766+
let crate_ = DUMMY_CRATE_NAME;
767+
let crate_path = crate_.replace("-", "_");
768+
let version = DUMMY_CRATE_VERSION;
768769
let default_target = "x86_64-unknown-linux-gnu";
769770

770771
assert_eq!(env.config().include_default_targets, true);
@@ -821,21 +822,24 @@ mod tests {
821822
let base = format!("rustdoc/{}/{}", crate_, version);
822823

823824
// default target was built and is accessible
824-
assert!(storage.exists(&format!("{}/{}/index.html", base, crate_))?);
825-
assert_success(&format!("/{0}/{1}/{0}", crate_, version), web)?;
825+
assert!(storage.exists(&format!("{}/{}/index.html", base, crate_path))?);
826+
assert_success(&format!("/{}/{}/{}", crate_, version, crate_path), web)?;
826827

827828
// other targets too
828829
for target in DEFAULT_TARGETS {
829830
let target_docs_present =
830-
storage.exists(&format!("{}/{}/{}/index.html", base, target, crate_))?;
831+
storage.exists(&format!("{}/{}/{}/index.html", base, target, crate_path))?;
831832

832-
let target_url = format!("/{0}/{1}/{2}/{0}/index.html", crate_, version, target);
833+
let target_url = format!(
834+
"/{}/{}/{}/{}/index.html",
835+
crate_, version, target, crate_path
836+
);
833837

834838
if target == &default_target {
835839
assert!(!target_docs_present);
836840
assert_redirect(
837841
&target_url,
838-
&format!("/{0}/{1}/{0}/index.html", crate_, version),
842+
&format!("/{}/{}/{}/index.html", crate_, version, crate_path),
839843
web,
840844
)?;
841845
} else {

0 commit comments

Comments
 (0)