From 0e5306d539ab237efc12b5435d4015dfdd68ba8c Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Tue, 19 Dec 2023 15:02:38 -0700 Subject: [PATCH] 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: https://github.com/cross-rs/cross/issues/526 --- .github/actions/test/action.yml | 7 ++++++- .github/workflows/ci.yml | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index ce011a2da2..e4b7ea455f 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -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 @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b84767897..9b592ad1c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,6 +92,7 @@ jobs: uses: ./.github/actions/test with: TARGET: '${{ matrix.target }}' + SUDO: "" TOOL: cross RUSTFLAGS: --cfg qemu -D warnings