Skip to content

Commit 0e5306d

Browse files
committed
Use "sudo" to run tests on github workflows.
Because several of the tests require root privileges. But don't use sudo with cross. It fails due to a known issue upstream: cross-rs/cross#526
1 parent 4fa0418 commit 0e5306d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.github/actions/test/action.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ inputs:
55
TARGET:
66
required: true
77

8+
SUDO:
9+
description: 'Set it to an empty string to run the tests as the current user, leave it with the default value to test with "sudo"'
10+
required: false
11+
default: sudo --preserve-env=HOME
12+
813
TOOL:
914
description: 'Tool used to involve the test command, can be cargo or cross'
1015
required: false
@@ -24,4 +29,4 @@ runs:
2429
2530
- name: test
2631
shell: bash
27-
run: ${{ inputs.TOOL }} test --target ${{ inputs.TARGET }} --all-features
32+
run: ${{ inputs.SUDO }} $(which ${{ inputs.TOOL }}) test --target ${{ inputs.TARGET }} --all-features

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ jobs:
9292
uses: ./.github/actions/test
9393
with:
9494
TARGET: '${{ matrix.target }}'
95+
SUDO: ""
9596
TOOL: cross
9697
RUSTFLAGS: --cfg qemu -D warnings
9798

0 commit comments

Comments
 (0)