Update continuous-integration-workflow.yml #2085
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: Continuous Integration | ||
| on: [push] | ||
| env: | ||
| BuildParameters.RestoreBuildProjects: '**/*.csproj' | ||
| BuildParameters.TestProjects: '**/*[Tt]ests/*.csproj' | ||
| jobs: | ||
| build: | ||
| name: Build and test | ||
| runs-on: windows-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: Setup .NET Core SDK 6.0 | ||
| uses: actions/setup-dotnet@v3 | ||
| with: | ||
| dotnet-version: 6.0.x | ||
| - name: Add Azure artifact | ||
| run: dotnet nuget add source 'https://pkgs.dev.azure.com/e-LfH/_packaging/LearningHubFeed/nuget/v3/index.json' --name 'LearningHubFeed' --username 'kevin.whittaker' --password ${{ secrets.AZURE_DEVOPS_PAT }} --store-password-in-clear-text | ||
| - name: Use Node 12.19 with Yarn | ||
| 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 | ||
| working-directory: ./LearningHub.Nhs.WebUI | ||
| - name: Typescript build WebUI | ||
| run: yarn build:webpack | ||
| working-directory: ./LearningHub.Nhs.WebUI | ||
| - name: Typescript install AdminUI | ||
| run: yarn install | ||
| working-directory: ./AdminUI/LearningHub.Nhs.AdminUI | ||
| - name: Typescript build AdminUI | ||
| run: yarn build:webpack | ||
| working-directory: ./AdminUI/LearningHub.Nhs.AdminUI | ||
| - name: Setup MSBuild | ||
| uses: microsoft/[email protected] | ||
| - name: Build SQL Server Database Project | ||
| run: | | ||
| # Enable strict error handling | ||
| $ErrorActionPreference = 'Stop' | ||
| # Initialize an error collection | ||
| $errors = @() | ||
| # List all .sqlproj files | ||
| $sqlproj_files = Get-ChildItem -Path . -Filter *.sqlproj -Recurse | ||
| 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 { | ||
| msbuild "$($sqlproj_file.FullName)" /p:Configuration=Release | ||
| if (!$?) { | ||
| $errors = "Failed to build $($sqlproj_file.FullName)" | ||
| } | ||
| } catch { | ||
| $errors += $_.Exception.Message | ||
| } | ||
| } | ||
| } | ||
| # Display any accumulated errors | ||
| if ($errors.Count -gt 0) { | ||
| Write-Error "SQL Project Build Errors:" | ||
| $errors | ForEach-Object { Write-Error $_ } | ||
| } | ||
| # Exit with failure if there are errors | ||
| if ($errors.Count -gt 0) { | ||
| exit 1 | ||
| } | ||
| - name: Build Solution Excluding SQL Project | ||
| run: | | ||
| # 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$' } | ||
| 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 { | ||
| dotnet build "$($csproj_file.FullName)" --configuration Release | ||
| if (!$?) { | ||
| $errors = "Failed to build $($csproj_file.FullName)" | ||
| } | ||
| } catch { | ||
| $errors += $_.Exception.Message | ||
| } | ||
| } | ||
| } | ||
| # Display any accumulated errors | ||
| if ($errors.Count -gt 0) { | ||
| Write-Error "Solution Build Errors:" | ||
| $errors | ForEach-Object { Write-Error $_ } | ||
| } | ||
| # Exit with failure if there are errors | ||
| if ($errors.Count -gt 0) { | ||
| exit 1 | ||
| } | ||
| # - name: Test | ||
| # run: dotnet test ${{ env.BuildParameters.TestProjects }} | ||