diff --git a/.github/workflows/createrelease.yml b/.github/workflows/createrelease.yml index b872ebd1..a21d52e1 100644 --- a/.github/workflows/createrelease.yml +++ b/.github/workflows/createrelease.yml @@ -5,7 +5,7 @@ on: types: [published] jobs: - buildlinux: + build: name: "Release" env: ASPNETCORE_ENVIRONMENT: "Production" @@ -15,11 +15,6 @@ jobs: steps: - uses: actions/checkout@v2.3.4 - - name: Install NET 9 - uses: actions/setup-dotnet@v4.0.1 - with: - dotnet-version: '9.0.x' - - name: Get the version id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} @@ -51,7 +46,7 @@ jobs: - name: Publish UI if: ${{ github.event.release.prerelease == false }} - run: dotnet publish "EstateManagementUI\EstateManagementUI.csproj" --configuration Release --output publishOutput -r linux-x64 --self-contained + run: dotnet publish "EstateManagementUI\EstateManagementUI.csproj" --configuration Release --output publishOutput -r win-x64 --self-contained - name: Build Release Package run: | @@ -65,8 +60,8 @@ jobs: path: estatemanagementui.zip deploystaging: - runs-on: [stagingserver,linux] - needs: buildlinux + runs-on: [stagingserver,windows] + needs: build environment: staging name: "Deploy to Staging" @@ -75,77 +70,31 @@ jobs: uses: actions/download-artifact@v4.1.8 with: name: estatemanagementui - path: /tmp/estatemanagementui # Download to a temporary directory - - name: Remove existing service (if applicable) + - name: Remove existing Windows service run: | - SERVICE_NAME="estatemanagementui" - if systemctl is-active --quiet "$SERVICE_NAME"; then - echo "Stopping existing service..." - sudo systemctl stop "$SERVICE_NAME" - fi - if systemctl is-enabled --quiet "$SERVICE_NAME"; then - echo "Disabling existing service..." - sudo systemctl disable "$SERVICE_NAME" - fi - if [ -f "/etc/systemd/system/${SERVICE_NAME}.service" ]; then - echo "Removing existing service unit file..." - sudo rm "/etc/systemd/system/${SERVICE_NAME}.service" - sudo systemctl daemon-reload - fi - + $serviceName = "Transaction Processing - Estate Management UI" + # Check if the service exists + if (Get-Service -Name $serviceName -ErrorAction SilentlyContinue) { + Stop-Service -Name $serviceName + sc.exe delete $serviceName + } + - name: Unzip the files run: | - sudo mkdir -p /opt/txnproc/transactionprocessing/estatemanagementui - sudo unzip -o /tmp/estatemanagementui/estatemanagementui.zip -d /opt/txnproc/transactionprocessing/estatemanagementui - - # IMPORTANT: Add a step to ensure the .NET runtime is installed on the server - # This assumes it's not already there. If your base image already has it, you can skip this. - - name: Install .NET Runtime - run: | - # Example for Ubuntu. Adjust based on your .NET version (e.g., 8.0, 7.0) - # and if you need the SDK or just the runtime. - # This uses Microsoft's package repository for the latest versions. - wget https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb - sudo dpkg -i packages-microsoft-prod.deb - rm packages-microsoft-prod.deb - sudo apt update - sudo apt install -y aspnetcore-runtime-9.0 - - - name: Install and Start as a Linux service + Expand-Archive -Path estatemanagementui.zip -DestinationPath "C:\txnproc\transactionprocessing\estatemanagementui" -Force + + - name: Install as a Windows service run: | - SERVICE_NAME="estatemanagementui" - # The WorkingDirectory is crucial for .NET apps to find appsettings.json and other files - WORKING_DIRECTORY="/opt/txnproc/transactionprocessing/estatemanagementui" - DLL_NAME="EstateManagementUI.dll" # Your application's DLL - SERVICE_DESCRIPTION="Transaction Processing - Estate Management UI" - - # Create a systemd service file - echo "[Unit]" | sudo tee /etc/systemd/system/${SERVICE_NAME}.service - echo "Description=${SERVICE_DESCRIPTION}" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service - echo "After=network.target" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service - echo "" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service - echo "[Service]" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service - # IMPORTANT: Use 'dotnet' to run your DLL - echo "ExecStart=/usr/bin/dotnet ${WORKING_DIRECTORY}/${DLL_NAME}" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service - echo "WorkingDirectory=${WORKING_DIRECTORY}" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service - echo "Restart=always" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service - echo "User=youruser" # IMPORTANT: Change to a dedicated, less privileged user - echo "Group=yourgroup" # IMPORTANT: Change to a dedicated, less privileged group - echo "Environment=ASPNETCORE_ENVIRONMENT=Production" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service # Example - echo "" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service - echo "[Install]" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service - echo "WantedBy=multi-user.target" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service - - # Reload systemd, enable, and start the service - sudo systemctl daemon-reload - sudo systemctl enable "$SERVICE_NAME" - sudo systemctl start "$SERVICE_NAME" - sudo systemctl status "$SERVICE_NAME" --no-pager # For debugging/verification + $serviceName = "Transaction Processing - Estate Management UI" + $servicePath = "C:\txnproc\transactionprocessing\estatemanagementui\EstateManagementUI.exe" + + New-Service -Name $serviceName -BinaryPathName $servicePath -Description $serviceName -DisplayName $serviceName -StartupType Automatic + Start-Service -Name $serviceName deployproduction: - runs-on: [productionserver,linux] - needs: [buildlinux, deploystaging] + runs-on: [productionserver, windows] + needs: [build, deploystaging] environment: production name: "Deploy to Production" @@ -154,70 +103,24 @@ jobs: uses: actions/download-artifact@v4.1.8 with: name: estatemanagementui - path: /tmp/estatemanagementui # Download to a temporary directory - - name: Remove existing service (if applicable) + - name: Remove existing Windows service run: | - SERVICE_NAME="estatemanagementui" - if systemctl is-active --quiet "$SERVICE_NAME"; then - echo "Stopping existing service..." - sudo systemctl stop "$SERVICE_NAME" - fi - if systemctl is-enabled --quiet "$SERVICE_NAME"; then - echo "Disabling existing service..." - sudo systemctl disable "$SERVICE_NAME" - fi - if [ -f "/etc/systemd/system/${SERVICE_NAME}.service" ]; then - echo "Removing existing service unit file..." - sudo rm "/etc/systemd/system/${SERVICE_NAME}.service" - sudo systemctl daemon-reload - fi - + $serviceName = "Transaction Processing - Estate Management UI" + # Check if the service exists + if (Get-Service -Name $serviceName -ErrorAction SilentlyContinue) { + Stop-Service -Name $serviceName + sc.exe delete $serviceName + } + - name: Unzip the files run: | - sudo mkdir -p /opt/txnproc/transactionprocessing/estatemanagementui - sudo unzip -o /tmp/estatemanagementui/estatemanagementui.zip -d /opt/txnproc/transactionprocessing/estatemanagementui - - # IMPORTANT: Add a step to ensure the .NET runtime is installed on the server - # This assumes it's not already there. If your base image already has it, you can skip this. - - name: Install .NET Runtime - run: | - # Example for Ubuntu. Adjust based on your .NET version (e.g., 8.0, 7.0) - # and if you need the SDK or just the runtime. - # This uses Microsoft's package repository for the latest versions. - wget https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb - sudo dpkg -i packages-microsoft-prod.deb - rm packages-microsoft-prod.deb - sudo apt update - sudo apt install -y aspnetcore-runtime-9.0 - - - name: Install and Start as a Linux service + Expand-Archive -Path estatemanagementui.zip -DestinationPath "C:\txnproc\transactionprocessing\estatemanagementui" -Force + + - name: Install as a Windows service run: | - SERVICE_NAME="estatemanagementui" - # The WorkingDirectory is crucial for .NET apps to find appsettings.json and other files - WORKING_DIRECTORY="/opt/txnproc/transactionprocessing/estatemanagementui" - DLL_NAME="EstateManagementUI.dll" # Your application's DLL - SERVICE_DESCRIPTION="Transaction Processing - Estate Management UI" - - # Create a systemd service file - echo "[Unit]" | sudo tee /etc/systemd/system/${SERVICE_NAME}.service - echo "Description=${SERVICE_DESCRIPTION}" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service - echo "After=network.target" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service - echo "" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service - echo "[Service]" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service - # IMPORTANT: Use 'dotnet' to run your DLL - echo "ExecStart=/usr/bin/dotnet ${WORKING_DIRECTORY}/${DLL_NAME}" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service - echo "WorkingDirectory=${WORKING_DIRECTORY}" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service - echo "Restart=always" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service - echo "User=youruser" # IMPORTANT: Change to a dedicated, less privileged user - echo "Group=yourgroup" # IMPORTANT: Change to a dedicated, less privileged group - echo "Environment=ASPNETCORE_ENVIRONMENT=Production" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service # Example - echo "" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service - echo "[Install]" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service - echo "WantedBy=multi-user.target" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service - - # Reload systemd, enable, and start the service - sudo systemctl daemon-reload - sudo systemctl enable "$SERVICE_NAME" - sudo systemctl start "$SERVICE_NAME" - sudo systemctl status "$SERVICE_NAME" --no-pager # For debugging/verification + $serviceName = "Transaction Processing - Estate Management UI" + $servicePath = "C:\txnproc\transactionprocessing\estatemanagementui\EstateManagementUI.exe" + + New-Service -Name $serviceName -BinaryPathName $servicePath -Description $serviceName -DisplayName $serviceName -StartupType Automatic + Start-Service -Name $serviceName \ No newline at end of file diff --git a/.github/workflows/nightlybuild.yml b/.github/workflows/nightlybuild.yml index 9dc5a6ee..a662cd54 100644 --- a/.github/workflows/nightlybuild.yml +++ b/.github/workflows/nightlybuild.yml @@ -16,12 +16,7 @@ jobs: steps: - uses: actions/checkout@v2.3.4 - - - name: Install NET 9 - uses: actions/setup-dotnet@v4.0.1 - with: - dotnet-version: '9.0.x' - + - name: Restore Nuget Packages run: dotnet restore EstateManagementUI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }} diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index 7f6e686e..97e9c693 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -17,11 +17,6 @@ jobs: steps: - uses: actions/checkout@v2.3.4 - - name: Install NET 9 - uses: actions/setup-dotnet@v4.0.1 - with: - dotnet-version: '9.0.x' - - name: Restore Nuget Packages run: dotnet restore EstateManagementUI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }} @@ -45,11 +40,6 @@ jobs: steps: - uses: actions/checkout@v2.3.4 - - name: Install NET 9 - uses: actions/setup-dotnet@v4.0.1 - with: - dotnet-version: '9.0.x' - - name: Trust Certificate run: | sudo apt-get install expect @@ -104,11 +94,6 @@ jobs: steps: - uses: actions/checkout@v2.3.4 - - name: Install NET 9 - uses: actions/setup-dotnet@v4.0.1 - with: - dotnet-version: '9.0.x' - - name: Trust Certificate run: | sudo apt-get install expect @@ -163,11 +148,6 @@ jobs: steps: - uses: actions/checkout@v2.3.4 - - name: Install NET 9 - uses: actions/setup-dotnet@v4.0.1 - with: - dotnet-version: '9.0.x' - - name: Trust Certificate run: | sudo apt-get install expect diff --git a/EstateManagementUI.BusinessLogic.Tests/EstateManagementUI.BusinessLogic.Tests.csproj b/EstateManagementUI.BusinessLogic.Tests/EstateManagementUI.BusinessLogic.Tests.csproj index 24044449..f699725a 100644 --- a/EstateManagementUI.BusinessLogic.Tests/EstateManagementUI.BusinessLogic.Tests.csproj +++ b/EstateManagementUI.BusinessLogic.Tests/EstateManagementUI.BusinessLogic.Tests.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable None @@ -11,12 +11,12 @@ - + - - - - + + + + diff --git a/EstateManagementUI.BusinessLogic/EstateManagementUI.BusinessLogic.csproj b/EstateManagementUI.BusinessLogic/EstateManagementUI.BusinessLogic.csproj index 81e9e634..8ed1083e 100644 --- a/EstateManagementUI.BusinessLogic/EstateManagementUI.BusinessLogic.csproj +++ b/EstateManagementUI.BusinessLogic/EstateManagementUI.BusinessLogic.csproj @@ -1,29 +1,29 @@  - net9.0 + net10.0 enable enable - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + - - + + diff --git a/EstateManagementUI.IntegrationTests/Common/Hooks.cs b/EstateManagementUI.IntegrationTests/Common/Hooks.cs index b89687a6..b504ff67 100644 --- a/EstateManagementUI.IntegrationTests/Common/Hooks.cs +++ b/EstateManagementUI.IntegrationTests/Common/Hooks.cs @@ -1,5 +1,4 @@ -using System.Diagnostics.Contracts; -using System.Drawing; +using Google.Protobuf.Reflection; using OpenQA.Selenium; using OpenQA.Selenium.Chrome; using OpenQA.Selenium.Edge; @@ -7,6 +6,8 @@ using Reqnroll; using Reqnroll.BoDi; using Shared.IntegrationTesting; +using System.Diagnostics.Contracts; +using System.Drawing; namespace EstateManagementUI.IntegrationTests.Common { @@ -56,9 +57,10 @@ private async Task CreateWebDriver(){ case null: case "Chrome": { - ChromeOptions options = new ChromeOptions(); - - options = options.WithNoSandBox() + Environment.SetEnvironmentVariable("SE_MANAGER", "0"); + ChromeOptions options = new(); + + options = options.WithNoSandBox() .WithAcceptInsecureCertificate() .WithDisableDevShmUsage() .WithDisableExtensions() @@ -66,8 +68,8 @@ private async Task CreateWebDriver(){ .WithDisableInfobars() .WithHeadless(isCi) .WithWindowSize(1920, 1080); - - webDriver = new ChromeDriver(options); + var service = ChromeDriverService.CreateDefaultService("/usr/bin"); + webDriver = new ChromeDriver(service, options); break; } diff --git a/EstateManagementUI.IntegrationTests/EstateManagementUI.IntegrationTests.csproj b/EstateManagementUI.IntegrationTests/EstateManagementUI.IntegrationTests.csproj index 0d603eea..4f843513 100644 --- a/EstateManagementUI.IntegrationTests/EstateManagementUI.IntegrationTests.csproj +++ b/EstateManagementUI.IntegrationTests/EstateManagementUI.IntegrationTests.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable @@ -27,29 +27,29 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - + + + + + - - + + - - - - - - + + + + + + - + - + - + - + diff --git a/EstateManagementUI.Testing/EstateManagementUI.Testing.csproj b/EstateManagementUI.Testing/EstateManagementUI.Testing.csproj index 044b8f50..12daa613 100644 --- a/EstateManagementUI.Testing/EstateManagementUI.Testing.csproj +++ b/EstateManagementUI.Testing/EstateManagementUI.Testing.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable None @@ -14,8 +14,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + all diff --git a/EstateManagementUI.UITests/EstateManagementUI.UITests.csproj b/EstateManagementUI.UITests/EstateManagementUI.UITests.csproj index 4517cc77..efd39681 100644 --- a/EstateManagementUI.UITests/EstateManagementUI.UITests.csproj +++ b/EstateManagementUI.UITests/EstateManagementUI.UITests.csproj @@ -1,7 +1,7 @@ - net9.0 + net10.0 enable enable None @@ -10,11 +10,10 @@ - - - - - + + + + diff --git a/EstateManagementUI.ViewModels/EstateManagementUI.ViewModels.csproj b/EstateManagementUI.ViewModels/EstateManagementUI.ViewModels.csproj index fcdb73a8..6fdb95e8 100644 --- a/EstateManagementUI.ViewModels/EstateManagementUI.ViewModels.csproj +++ b/EstateManagementUI.ViewModels/EstateManagementUI.ViewModels.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable None enable diff --git a/EstateManagementUI/Dockerfile b/EstateManagementUI/Dockerfile index d669c7a6..0688e374 100644 --- a/EstateManagementUI/Dockerfile +++ b/EstateManagementUI/Dockerfile @@ -2,7 +2,7 @@ FROM stuartferguson/txnprocbase AS base WORKDIR /app # This stage is used to build the service project -FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src COPY ["EstateManagementUI/NuGet.Config", "."] diff --git a/EstateManagementUI/EstateManagementUI.csproj b/EstateManagementUI/EstateManagementUI.csproj index 9afb5210..e6648cd1 100644 --- a/EstateManagementUI/EstateManagementUI.csproj +++ b/EstateManagementUI/EstateManagementUI.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable Regular 246afedf-f035-44d4-b568-e928505d5060 @@ -40,17 +40,17 @@ - + - - - + + + - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive