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 Jan 6, 2024
1 parent 413e365 commit 230030c
Show file tree
Hide file tree
Showing 2 changed files with 8 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 to "sudo" to run the build with sudo, or leave undefined to run as the current user'
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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ jobs:
- name: build
uses: ./.github/actions/build
with:
SUDO: ""
TARGET: '${{ matrix.target }}'
TOOL: cross
RUSTFLAGS: --cfg qemu -D warnings
Expand All @@ -92,6 +93,7 @@ jobs:
uses: ./.github/actions/test
with:
TARGET: '${{ matrix.target }}'
SUDO: ""
TOOL: cross
RUSTFLAGS: --cfg qemu -D warnings

Expand Down

0 comments on commit 230030c

Please sign in to comment.