Run the tests with sudo #579
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: FeOS Test | |
| on: [push] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Install Protobuf Compiler | |
| run: sudo apt-get update && sudo apt-get install protobuf-compiler -y | |
| - name: Set up cargo cache | |
| uses: actions/cache@v4 | |
| continue-on-error: false | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: ${{ runner.os }}-cargo- | |
| - name: Run Tests | |
| env: | |
| RUST_BACKTRACE: 1 | |
| SUDO_ENV_VARS: "PATH=$PATH:$HOME/.cargo/bin CARGO_HOME=$HOME/.cargo" | |
| run: | | |
| # Explicitly export variables within a sudo-executed shell command | |
| # This ensures PATH and CARGO_HOME are set correctly *in the context* where make runs. | |
| sudo -E bash -c ' \ | |
| export PATH="$HOME/.cargo/bin:$PATH"; \ | |
| export CARGO_HOME="$HOME/.cargo"; \ | |
| echo "--- Debug Info ---"; \ | |
| echo "User: $(whoami)"; \ | |
| echo "Home: $HOME"; \ | |
| echo "Cargo Home: $CARGO_HOME"; \ | |
| echo "Path: $PATH"; \ | |
| echo "Which Cargo: $(which cargo)"; \ | |
| echo "--- Running Make Test ---"; \ | |
| make test \ | |
| ' |