Test Dotnet Root #9
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: Test Dotnet Root | |
| on: [workflow_dispatch] | |
| jobs: | |
| test: | |
| runs-on: macos-15-intel | |
| env: | |
| DOTNET_INSTALL_DIR: /Users/runner/custom | |
| DOTNET_ROOT: /conflicting/path | |
| steps: | |
| - name: Print default DOTNET_ROOT | |
| # run: echo "Before:$DOTNET_ROOT" | |
| run: | | |
| echo "DOTNET_INSTALL_DIR: $DOTNET_INSTALL_DIR" | |
| echo "DOTNET_ROOT: $DOTNET_ROOT" | |
| echo "PATH: $PATH" | |
| - name: Validate dotnet info | |
| run: dotnet --info | |
| - name: Clear DOTNET_ROOT from GitHub Actions environment | |
| run: echo "DOTNET_ROOT=" >> $GITHUB_ENV | |
| - name: Print after unset | |
| # run: echo "After unset:$DOTNET_ROOT" | |
| run: | | |
| echo "DOTNET_INSTALL_DIR: $DOTNET_INSTALL_DIR" | |
| echo "DOTNET_ROOT: $DOTNET_ROOT" | |
| echo "PATH: $PATH" | |
| - name: Validate dotnet info | |
| run: dotnet --info | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Show DOTNET_ROOT after setup | |
| run: echo "After setup-dotnet:$DOTNET_ROOT" | |
| - name: Validate dotnet info | |
| run: dotnet --info | |
| - name: Build with dotnet | |
| run: dotnet build --configuration Release | |
| - name: Log environment variables | |
| run: | | |
| echo "DOTNET_INSTALL_DIR: $DOTNET_INSTALL_DIR" | |
| echo "DOTNET_ROOT: $DOTNET_ROOT" | |
| echo "PATH: $PATH" | |
| - name: Test with invalid DOTNET_INSTALL_DIR | |
| env: | |
| DOTNET_INSTALL_DIR: /invalid/path | |
| run: dotnet --info || echo "Expected failure with invalid DOTNET_INSTALL_DIR" |