Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/buildwindowsimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
uses: battila7/get-version-action@v2
Expand Down
165 changes: 34 additions & 131 deletions .github/workflows/createrelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
types: [published]

jobs:
buildlinux:
build:
name: "Release"
env:
ASPNETCORE_ENVIRONMENT: "Production"
Expand All @@ -15,11 +15,6 @@
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\//}
Expand Down Expand Up @@ -55,7 +50,7 @@

- name: Publish API
if: ${{ github.event.release.prerelease == false }}
run: dotnet publish "EstateReportingAPI\EstateReportingAPI.csproj" --configuration Release --output publishOutput -r linux-x64 --self-contained
run: dotnet publish "EstateReportingAPI\EstateReportingAPI.csproj" --configuration Release --output publishOutput -r win-x64 --self-contained

- name: Build Release Package
run: |
Expand All @@ -75,159 +70,67 @@
dotnet nuget push Nugets/EstateReportingAPI.Client.${{ steps.get_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.PRIVATEFEED_APIKEY }} --source ${{ secrets.PRIVATEFEED_URL }} --skip-duplicate

deploystaging:
runs-on: [stagingserver, linux]
needs: buildlinux
runs-on: [stagingserver, windows]
needs: build
environment: staging
name: "Deploy to Staging"

steps:
- name: Download the artifact
uses: actions/download-artifact@v4.1.8
with:
name: estatereportingapi
path: /tmp/estatereportingapi # Download to a temporary directory

- name: Remove existing service (if applicable)
- name: Remove existing Windows service
run: |
SERVICE_NAME="estatereportingapi"
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 Reporting"
# 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/estatereportingapi
sudo unzip -o /tmp/estatereportingapi/estatereportingapi.zip -d /opt/txnproc/transactionprocessing/estatereportingapi
Expand-Archive -Path estatereportingapi.zip -DestinationPath "C:\txnproc\transactionprocessing\estatereportingapi" -Force

# 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
- name: Install as a Windows service
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
run: |
SERVICE_NAME="estatereportingapi"
# The WorkingDirectory is crucial for .NET apps to find appsettings.json and other files
WORKING_DIRECTORY="/opt/txnproc/transactionprocessing/estatereportingapi"
DLL_NAME="EstateReportingAPI.dll" # Your application's DLL
SERVICE_DESCRIPTION="Transaction Processing - Estate Reporting API"

# 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 Reporting"
$servicePath = "C:\txnproc\transactionprocessing\estatereportingapi\EstateReportingAPI.exe"

New-Service -Name $serviceName -BinaryPathName $servicePath -Description $serviceName -DisplayName $serviceName -StartupType Automatic
Start-Service -Name $serviceName

deployproduction:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
runs-on: [productionserver, linux]
needs: [buildlinux, deploystaging]
runs-on: [productionserver, windows]
needs: [build, deploystaging]
environment: production
name: "Deploy to Production"

steps:
- name: Download the artifact
uses: actions/download-artifact@v4.1.8
with:
name: estatereportingapi
path: /tmp/estatereportingapi # Download to a temporary directory

- name: Remove existing service (if applicable)
- name: Remove existing Windows service
run: |
SERVICE_NAME="estatereportingapi"
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 Reporting"
# 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/estatereportingapi
sudo unzip -o /tmp/securityservice/estatereportingapi.zip -d /opt/txnproc/transactionprocessing/estatereportingapi

# 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
Expand-Archive -Path estatereportingapi.zip -DestinationPath "C:\txnproc\transactionprocessing\estatereportingapi" -Force

- name: Install and Start as a Linux service
- name: Install as a Windows service
run: |
SERVICE_NAME="estatereportingapi"
# The WorkingDirectory is crucial for .NET apps to find appsettings.json and other files
WORKING_DIRECTORY="/opt/txnproc/transactionprocessing/estatereportingapi"
DLL_NAME="EstateReportingAPI.dll" # Your application's DLL
SERVICE_DESCRIPTION="Transaction Processing - Estate Reporting API"

# 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 Reporting"
$servicePath = "C:\txnproc\transactionprocessing\estatereportingapi\EstateReportingAPI.exe"

New-Service -Name $serviceName -BinaryPathName $servicePath -Description $serviceName -DisplayName $serviceName -StartupType Automatic
Start-Service -Name $serviceName

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI about 2 months ago

To fix this, add an explicit permissions: block near the top level of the workflow file, just after the name: (or right after on:), to restrict the GITHUB_TOKEN permissions. The safest default is permissions: {} (no permissions), but often some minimal permissions are needed, e.g., contents: read for workflows that need read access to the codebase. If jobs require other permissions (such as for uploading releases or working with issues), add only those required permissions. Since this workflow appears to only build, upload artifacts, and (optionally) interact with NuGet feeds (which doesn't use the GITHUB_TOKEN), setting contents: read as the default is safe and minimal. If finer control is needed, set permissions at the job level. The file to update is .github/workflows/createrelease.yml, and the change is at the very top of the file, after the name: line.


Suggested changeset 1
.github/workflows/createrelease.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/createrelease.yml b/.github/workflows/createrelease.yml
--- a/.github/workflows/createrelease.yml
+++ b/.github/workflows/createrelease.yml
@@ -1,4 +1,6 @@
 name: Release
+permissions:
+  contents: read
 
 on:
   release:
EOF
@@ -1,4 +1,6 @@
name: Release
permissions:
contents: read

on:
release:
Copilot is powered by AI and may make mistakes. Always verify output.
7 changes: 1 addition & 6 deletions .github/workflows/nightlybuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,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: Set Up Variables
run: echo "action_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV

Expand Down Expand Up @@ -57,7 +52,7 @@ jobs:
coverage-reports: ./lcov.info
files: ./lcov2.info

- uses: actions/upload-artifact@v4.4.0
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: tracelogs
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,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 EstateReportingAPI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }}

Expand All @@ -36,7 +31,7 @@ jobs:
run: |
dotnet test "EstateReportingAPI.IntegrationTests\EstateReportingAPI.IntegrationTests.csproj"

- uses: actions/upload-artifact@v4.4.0
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: tracelogs
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/pushtomaster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ jobs:
- uses: actions/checkout@v2.3.4
with:
fetch-depth: 0

- name: Install NET 9
uses: actions/setup-dotnet@v4.0.1
with:
dotnet-version: '9.0.x'

- name: Restore Nuget Packages
run: dotnet restore EstateReportingAPI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MediatR" Version="13.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.DynamicLinq" Version="9.6.9" />
<PackageReference Include="Shared" Version="2025.11.11" />
<PackageReference Include="MediatR" Version="14.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.DynamicLinq" Version="10.7.1" />
<PackageReference Include="Shared" Version="2025.12.1" />
<PackageReference Include="TransactionProcessor.Database" Version="2025.10.1" />
</ItemGroup>

Expand Down
6 changes: 3 additions & 3 deletions EstateReportingAPI.Client/EstateReportingAPI.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net9.0</TargetFrameworks>
<TargetFrameworks>net10.0</TargetFrameworks>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);IncludeP2PAssets</TargetsForTfmSpecificBuildOutput>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ClientProxyBase" Version="2025.11.11" />
<PackageReference Include="ClientProxyBase" Version="2025.12.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="Shared.Results" Version="2025.11.11" />
<PackageReference Include="Shared.Results" Version="2025.12.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<DebugType>None</DebugType>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<DebugType>Full</DebugType>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="10.0.1" />
<PackageReference Include="TransactionProcessor.Database" Version="2025.10.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.10" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.10" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -21,13 +22,13 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Shouldly" Version="4.3.0" />
<PackageReference Include="Shared" Version="2025.11.11" />
<PackageReference Include="Shared.Logger" Version="2025.11.11" />
<PackageReference Include="Shared.IntegrationTesting" Version="2025.11.11" />
<PackageReference Include="Shared" Version="2025.12.1" />
<PackageReference Include="Shared.Logger" Version="2025.12.1" />
<PackageReference Include="Shared.IntegrationTesting" Version="2025.12.1" />
<PackageReference Include="Ductus.FluentDocker" Version="2.85.0" />
<PackageReference Include="NLog" Version="6.0.5" />
<PackageReference Include="NLog.Extensions.Logging" Version="6.0.5" />
<PackageReference Include="SecurityService.Client" Version="2025.10.1" />
<PackageReference Include="NLog" Version="6.0.6" />
<PackageReference Include="NLog.Extensions.Logging" Version="6.1.0" />
<PackageReference Include="SecurityService.Client" Version="2025.12.1" />
<PackageReference Include="Lamar" Version="15.0.1" />
<PackageReference Include="Lamar.Microsoft.DependencyInjection" Version="15.0.1" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ namespace EstateReportingAPI.IntegrationTests;
using DataTrasferObjects;
using EstateReportingAPI.DataTransferObjects;
using EstateReportingAPI.Models;
using Microsoft.OpenApi.Services;
using Newtonsoft.Json;
using Shouldly;
using Xunit;
Expand Down
3 changes: 1 addition & 2 deletions EstateReportingAPI.IntegrationTests/xunit.runner.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"maxParallelThreads": 3,
"parallelizeTestCollections": true

"parallelizeTestCollections": true
}
Loading
Loading