Skip to content

Commit 4b96959

Browse files
lens0021Ph0enixKM
andcommitted
Update .github/workflows/rust.yml
Co-authored-by: Phoenix Himself <pkaras.it@gmail.com>
1 parent 20f14c9 commit 4b96959

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.github/workflows/rust.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ jobs:
7373
run: cargo build
7474
- name: Run cargo tests
7575
env:
76-
GITHUB_ACTIONS_BASH_CONTAINER: 1
76+
AMBER_TEST_STRATEGY: docker
77+
AMBER_TEST_ARGS:
78+
exec
79+
--workdir /root
80+
--user 405 # a non-root user(guest) for is_root() test
81+
test_container
82+
bash
7783
run: |
7884
docker run --volume $PWD:/root --network host --detach --name test_container ${{ matrix.bash_docker_image }} sleep infinity
7985
# coreutils includes mktemp

src/compiler.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,11 @@ impl AmberCompiler {
324324

325325
#[cfg(not(windows))]
326326
fn find_bash() -> Option<Command> {
327-
if env::var("GITHUB_ACTIONS_BASH_CONTAINER").is_ok() {
327+
if env::var("AMBER_TEST_STRATEGY").is_ok_and(|value| value == "docker") {
328328
let mut command = Command::new("docker");
329-
command.args(["exec", "--workdir", "/root", "--user", "405", "test_container", "bash"]);
329+
let args_string = env::var("AMBER_TEST_ARGS").expect("Please pass docker arguments in AMBER_TEST_ARGS environment variable.");
330+
let args: Vec<&str> = args_string.split_whitespace().collect();
331+
command.args(args);
330332
Some(command)
331333
} else {
332334
let mut command = Command::new("/usr/bin/env");

0 commit comments

Comments
 (0)