Skip to content

Commit 1190240

Browse files
committed
fix: support isolated CI paper rendering
1 parent c0d8b56 commit 1190240

3 files changed

Lines changed: 32 additions & 10 deletions

File tree

.github/workflows/documentation.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ jobs:
3030
- name: Install the pinned browser renderer
3131
run: cargo xtask browser-install
3232
- name: Compile and validate the site and technical manuscript
33+
env:
34+
# The disposable hosted runner cannot use Chrome's Linux namespace sandbox.
35+
NUIF_CHROME_NO_SANDBOX: "1"
3336
run: cargo xtask docs-paper
3437
- name: Retain the compiled site and validation report
3538
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

docs/PUBLISHING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ mdBook server. `docs-paper` builds the site and prints the generated technical
2525
manuscript to `target/docs-site/downloads/nuif-research-manuscript.pdf` through
2626
the repository's pinned Chrome for Testing binary.
2727

28+
`docs-paper` keeps Chrome's process sandbox enabled by default. A disposable,
29+
externally isolated CI runner that cannot create Chrome's Linux namespace may
30+
set `NUIF_CHROME_NO_SANDBOX=1`; do not use that override for routine local
31+
rendering.
32+
2833
The pinned renderer can be installed through:
2934

3035
```sh

xtask/src/documentation.rs

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,30 @@ pub(crate) fn paper() -> Result<(), String> {
192192
"--print-to-pdf={}",
193193
absolute_path(output)?.to_string_lossy()
194194
);
195-
let status = Command::new(chrome_for_testing()?)
196-
.args([
197-
"--headless=new",
198-
"--disable-gpu",
199-
"--disable-dev-shm-usage",
200-
"--hide-scrollbars",
201-
"--no-pdf-header-footer",
202-
output_argument.as_str(),
203-
source_url.as_str(),
204-
])
195+
let mut command = Command::new(chrome_for_testing()?);
196+
command.args([
197+
"--headless=new",
198+
"--disable-gpu",
199+
"--disable-dev-shm-usage",
200+
"--hide-scrollbars",
201+
"--no-pdf-header-footer",
202+
]);
203+
match std::env::var("NUIF_CHROME_NO_SANDBOX") {
204+
Ok(value) if value == "1" => {
205+
command.arg("--no-sandbox");
206+
}
207+
Ok(value) => {
208+
return Err(format!(
209+
"NUIF_CHROME_NO_SANDBOX must be 1 when set, got {value:?}"
210+
));
211+
}
212+
Err(std::env::VarError::NotPresent) => {}
213+
Err(std::env::VarError::NotUnicode(_)) => {
214+
return Err("NUIF_CHROME_NO_SANDBOX must be valid UTF-8".to_owned());
215+
}
216+
}
217+
let status = command
218+
.args([output_argument.as_str(), source_url.as_str()])
205219
.status()
206220
.map_err(|error| format!("could not start Chrome for Testing: {error}"))?;
207221
if !status.success() {

0 commit comments

Comments
 (0)