diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 216206ee6..028886a22 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -69,7 +69,7 @@ jobs: echo "Skipping 'auto-merge' workflow check to prevent self-referencing." continue fi - + # If any check is still queued, set ALL_COMPLETED to false if [[ "$status" == "QUEUED" ]]; then ALL_COMPLETED=false diff --git a/.github/workflows/continuous-integration-workflow.yml b/.github/workflows/continuous-integration-workflow.yml index a34089212..dba3120c0 100644 --- a/.github/workflows/continuous-integration-workflow.yml +++ b/.github/workflows/continuous-integration-workflow.yml @@ -22,7 +22,6 @@ jobs: uses: actions/setup-node@v4 with: node-version: '18' - npm: '6.14.8' - name: Typescript install WebUI run: yarn install --network-timeout 600000 --frozen-lockfile @@ -43,26 +42,80 @@ jobs: - name: Setup MSBuild uses: microsoft/setup-msbuild@v1.0.3 - - name: Build SQL Server Database project + - name: Build SQL Server Database Project run: | - # List all .sqlproj files except for .sqlproj + # Enable strict error handling + $ErrorActionPreference = 'Stop' + + # Initialize an error collection + $errors = @() + + # List all .sqlproj files $sqlproj_files = Get-ChildItem -Path . -Filter *.sqlproj -Recurse - - # Build each .csproj file - foreach ($sqlproj_file in $sqlproj_files) { - Write-Host "Building $($sqlproj_file.FullName)" - msbuild "$($sqlproj_file.FullName)" /p:Configuration=Release - } - - name: Build solution excluding SQL project + + if ($sqlproj_files.Count -eq 0) { + $errors += "No .sqlproj files found." + } else { + foreach ($sqlproj_file in $sqlproj_files) { + Write-Host "Building $($sqlproj_file.FullName)" + try { + $output = &msbuild "$($sqlproj_file.FullName)" /p:Configuration=Release /nologo 2>&1 + if (!$?) { + $errors += "Failed to build $($csproj_file.FullName): $output" + } + } catch { + # Capture detailed error information + $errorMessage = "Error building $($sqlproj_file.FullName): $($_.Exception.Message)" + Write-Host $errorMessage + $errors += $errorMessage + } + } + } + + # Display all accumulated errors + if ($errors.Count -gt 0) { + Write-Host "SQL Project Build Errors:" + $errors | ForEach-Object { Write-Host $_ } + exit 1 + } + + - name: Build Solution Excluding SQL Project run: | - # List all .csproj files except for .sqlproj + # Enable strict error handling + $ErrorActionPreference = 'Stop' + + # Initialize an error collection + $errors = @() + + # List all .csproj files except .sqlproj $csproj_files = Get-ChildItem -Path . -Filter *.csproj -Recurse | Where-Object { $_.FullName -notmatch '\\.sqlproj$' } - # Build each .csproj file - foreach ($csproj_file in $csproj_files) { - Write-Host "Building $($csproj_file.FullName)" - dotnet build "$($csproj_file.FullName)" - } + + if ($csproj_files.Count -eq 0) { + $errors += "No .csproj files found." + } else { + foreach ($csproj_file in $csproj_files) { + Write-Host "Building $($csproj_file.FullName)" + try { + $output = &dotnet build "$($csproj_file.FullName)" --configuration Release 2>&1 + if (!$?) { + $errors += "Failed to build $($csproj_file.FullName): $output" + } + } catch { + # Capture detailed error information + $errorMessage = "Error building $($csproj_file.FullName): $($_.Exception.Message)" + Write-Host $errorMessage + $errors += $errorMessage + } + } + } + # Display all accumulated errors + if ($errors.Count -gt 0) { + Write-Host "Solution Build Errors:" + $errors | ForEach-Object { Write-Host $_ } + exit 1 + } + # - name: Test # run: dotnet test ${{ env.BuildParameters.TestProjects }} diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/LearningHub.Nhs.OpenApi.Repositories.Interface.csproj b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/LearningHub.Nhs.OpenApi.Repositories.Interface.csproj index 12c0510c1..f65c61197 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/LearningHub.Nhs.OpenApi.Repositories.Interface.csproj +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/LearningHub.Nhs.OpenApi.Repositories.Interface.csproj @@ -17,7 +17,7 @@ - +