cake-build / cake-action

:cake::octocat: Run Cake (C# Make) scripts in your GitHub Actions workflows.
https://cakebuild.net
MIT License
45 stars 13 forks source link

The action never finishes #47

Closed johanparmar closed 1 year ago

johanparmar commented 1 year ago

Hi,

I'm running into issues that the following script hangs sometimes when trying to run the cake script step. The action never finishes

name: push-master
run-name: ${{ github.actor }} is pushing to master
on: 
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
jobs:
  push-master:
    runs-on: ubuntu-latest
    steps:
      - name: Get the source
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Install .NET SDK 7.0.x
        uses: actions/setup-dotnet@v3
        with:
          dotnet-version: '7.0.x'
      - name: run cake script
        uses: cake-build/cake-action@master

Any ideas what might be reason

ecampidoglio commented 1 year ago

@johanparmar Could you post the contents of the build script as well as the build log from GitHub Actions?

johanparmar commented 1 year ago

Hi, Thanks for your help! Here comes the build script


var target = Argument("target", "Test");
var configuration = Argument("configuration", "Release");

//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////

Task("Clean")
    .WithCriteria(c => HasArgument("rebuild"))
    .Does(() =>
{
     DotNetClean("./AlgoCharging.sln",  new DotNetCleanSettings
       {
           Configuration = configuration,
       });    
});

Task("Build")
    .IsDependentOn("Clean")
    .Does(() =>
{
    DotNetBuild("./AlgoCharging.sln", new DotNetBuildSettings
    {
        Configuration = configuration,
    });
});

Task("Test")
    .IsDependentOn("Build")
    .Does(() =>
{
    DotNetTest("./AlgoCharging.sln", new DotNetTestSettings
    {
        Configuration = configuration,
        NoBuild = true,
    });
});

//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////

RunTarget(target);

github actions log.txt

johanparmar commented 1 year ago

FYI

I had to cancel the workflow because it never ends. I have started suspect that it is something with the tests when they are run in GitHub action. I never see this when I run the cake script locally.

ecampidoglio commented 1 year ago

@johanparmar By looking at the build log, I would guess that the MongoDB tests are the culprit. If the tests pass locally but hang when running on GitHub Actions, it might be some networking problem. Are you perhaps trying to connect to a MongoDB instance as part of your tests?

johanparmar commented 1 year ago

We have some tests that access the DB but should be skipped . I also see that we have mixed unit and xunit. I'll check this and let you know how it goes. Thanks!

johanparmar commented 1 year ago

Hi,

I have tried it again making sure I skip the database tests by skipping them but I still get the same issue. I can see in the attached log that the first test project (CapacityOptimizer.UnitTests) is never run til the end before another one starts. After all test projects has been run except for the one mentioned above it hangs again and I have to cancel the workflow. I have attached the log file as well

github actions log.txt

johanparmar commented 1 year ago

I ran the the action again and then it worked. Attaching the log file here

github actions log_succesful.txt

johanparmar commented 1 year ago

Hi, The issue I was experiencing did not have todo with the cake-action. I found solution here: https://github.com/dotnet/sdk/issues/27106 which basically disables parallel execution of tests

Thanks for assistance !