Skip to content

Commit 834542b

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

File tree

3 files changed

+35
-9
lines changed

3 files changed

+35
-9
lines changed

.github/workflows/ci.yml

+18-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,20 @@ jobs:
4646
command: sweep
4747
args: --stamp
4848

49-
- name: Launch postgres and min.io
49+
- name: pull needed docker images
5050
run: |
5151
cp .env.sample .env
52+
. .env
53+
# pull is faster without the cache, see also the docs for the
54+
# layer caching action
55+
docker-compose pull
56+
57+
# - name: restore docker layer cache
58+
# uses: satackey/[email protected]
59+
# continue-on-error: true
60+
61+
- name: Launch postgres and min.io
62+
run: |
5263
. .env
5364
mkdir -p ${CRATESFYI_PREFIX}/public-html
5465
docker-compose up -d db s3
@@ -63,10 +74,15 @@ jobs:
6374
- name: fast tests
6475
run: cargo test --workspace --locked
6576

77+
- name: create small build-environment
78+
run: |
79+
docker build -t buildenv - < dockerfiles/Dockerfile-small-build-env
80+
6681
- name: slow tests
6782
env:
6883
DOCSRS_INCLUDE_DEFAULT_TARGETS: true
69-
run: cargo test --workspace --locked -- --ignored
84+
DOCS_RS_LOCAL_DOCKER_IMAGE: buildenv
85+
run: cargo test --workspace --locked -- --ignored --nocapture
7086

7187
- name: Clean up the database
7288
run: docker-compose down --volumes
+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"]

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)