Skip to content

Commit 230030c

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 413e365 commit 230030c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.github/actions/test/action.yml

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

8+
SUDO:
9+
description: 'Set to "sudo" to run the build with sudo, or leave undefined to run as the current user'
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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ jobs:
8484
- name: build
8585
uses: ./.github/actions/build
8686
with:
87+
SUDO: ""
8788
TARGET: '${{ matrix.target }}'
8889
TOOL: cross
8990
RUSTFLAGS: --cfg qemu -D warnings
@@ -92,6 +93,7 @@ jobs:
9293
uses: ./.github/actions/test
9394
with:
9495
TARGET: '${{ matrix.target }}'
96+
SUDO: ""
9597
TOOL: cross
9698
RUSTFLAGS: --cfg qemu -D warnings
9799

0 commit comments

Comments
 (0)