Skip to content

Commit

Permalink
Use "sudo" to run tests on github workflows.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
asomers committed Feb 4, 2024
1 parent 4fa0418 commit 0e5306d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/actions/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ inputs:
TARGET:
required: true

SUDO:
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"'
required: false
default: sudo --preserve-env=HOME

TOOL:
description: 'Tool used to involve the test command, can be cargo or cross'
required: false
Expand All @@ -24,4 +29,4 @@ runs:
- name: test
shell: bash
run: ${{ inputs.TOOL }} test --target ${{ inputs.TARGET }} --all-features
run: ${{ inputs.SUDO }} $(which ${{ inputs.TOOL }}) test --target ${{ inputs.TARGET }} --all-features
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ jobs:
uses: ./.github/actions/test
with:
TARGET: '${{ matrix.target }}'
SUDO: ""
TOOL: cross
RUSTFLAGS: --cfg qemu -D warnings

Expand Down

0 comments on commit 0e5306d

Please sign in to comment.