'Xunit test hangs in GitHub Actions workflow

I have written a GitHub Actions workflow to build and unit test an ASP.NET Core 3.1 MVC app. The workflow makes it as far as building the app successfully (no errors, no warnings), but it hangs when it gets to the unit tests. I've waited 2 hours and it never completes. The workflow file and Actions log are shown below.

Workflow file:


    name: Continuous Integration
    
    on:
      push:
        branches: 
        - Test
    
    jobs:
      build:
        runs-on: ubuntu-latest
        steps:
        - name: Check out code
          uses: actions/checkout@v3
        
        - name: Setup .NET Core 3.1
          uses: xt0rted/[email protected]
          with:
            dotnet-version: '3.1.x'
        - name: Restore dependencies
          run: dotnet restore BookReviews/BookReviews.sln
    
        - name: Build app
          run: dotnet build BookReviews/BookReviews.sln -c Release --no-restore
    
        - name: Run Unit Tests
          run: dotnet test BookReviews/Tests/Tests.csproj -c Release

GitHub Actions log of the unit tests task:

Run dotnet test BookReviews/Tests/Tests.csproj -c Release
dotnet test BookReviews/Tests/Tests.csproj -c Release
shell: /usr/bin/bash -e {0}

 env:  
   DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: true  
   TERM: xterm  
   DOTNET_INSTALL_DIR: /usr/share/dotnet  
   DOTNET_ROOT: /usr/share/dotnet  

 Determining projects to restore...  
 All projects are up-to-date for restore. 

 BookReviews -> /home/runner/work/CS296N-Example-BookReviews/CS296N-Example-  BookReviews/BookReviews/BookReviews/bin/Release/netcoreapp3.1/BookReviews.dll  

 BookReviews -> /home/runner/work/CS296N-Example-BookReviews/CS296N-Example-BookReviews/BookReviews/BookReviews/bin/Release/netcoreapp3.1/BookReviews.Views.dll  

 Tests -> /home/runner/work/CS296N-Example-BookReviews/CS296N-Example-BookReviews/BookReviews/Tests/bin/Release/netcoreapp3.1/Tests.dll  

Test run for /home/runner/work/CS296N-Example-BookReviews/CS296N-Example-BookReviews/BookReviews/Tests/bin/Release/netcoreapp3.1/Tests.dll (.NETCoreApp,Version=v3.1)

Microsoft (R) Test Execution Command Line Tool Version 17.1.0
Copyright (c) Microsoft Corporation. All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source