From c70daf4e21a6642a3c7bfc27b7187fbe0cd0f884 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 | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index ce011a2da2..2339c71a92 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -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 @@ -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..675ee7592d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,6 +84,7 @@ jobs: - name: build uses: ./.github/actions/build with: + SUDO: "" TARGET: '${{ matrix.target }}' TOOL: cross RUSTFLAGS: --cfg qemu -D warnings @@ -92,6 +93,7 @@ jobs: uses: ./.github/actions/test with: TARGET: '${{ matrix.target }}' + SUDO: "" TOOL: cross RUSTFLAGS: --cfg qemu -D warnings