Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development' into INFSCP01-39-fe…
Browse files Browse the repository at this point in the history
…ature-update-transfer-with-put
  • Loading branch information
Sharif-C committed Dec 18, 2024
2 parents 6857eaa + 1a40eb0 commit 39270eb
Show file tree
Hide file tree
Showing 10 changed files with 147 additions and 81 deletions.
26 changes: 26 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Issue
_[...Jira link of the related issue]_

## Description
A few sentences describing the overall goals of the pull request's commits.

## Type of change

- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] This change requires a documentation update

## Steps to _[...Test or Reproduce]_
Outline the steps to test or reproduce the PR here.

1. _...[step 1]_
2. _...[step 2]_

## Related PRs
List related PRs against other branches and projects:

branch | PR
------ | ------
othother_pr_production | [link]()
other_pr_master | [link]()
85 changes: 66 additions & 19 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,78 @@
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: CargoHub API build
name: CargoHub API CI

on:
push:
branches:
- main
- development
- main
- development
pull_request:
branches:
- main
- development
- main
- development

jobs:
build:
lint:
name: Lint Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Run Code Formatter Verify No Changes
run: dotnet format --verify-no-changes > lint-results.txt 2>&1 --verbosity diagnostic
- name: Upload lint results
uses: actions/upload-artifact@v4
with:
name: Lint results
path: lint-results.txt
retention-days: 5
if: ${{ failure() }}

build:
name: Build Application
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build Project
run: dotnet build > build-results.txt 2>&1 --no-restore -nowarn:8602
- name: Upload build logs
uses: actions/upload-artifact@v4
with:
name: Build results
path: build-results.txt
retention-days: 5
if: ${{ failure() }}

test_and_code_coverage:
name: Run Tests & Generate Code Coverage Report
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Run Tests & Generate Report
run: dotnet test --collect:"XPlat Code Coverage"
- name: ReportGenerator
uses: danielpalme/[email protected]
with:
reports: 'api.Tests/TestResults/*/coverage.cobertura.xml'
targetdir: 'api.Tests/Report'
reporttypes: 'Html'
classfilters: '+EnumUtil' # Temporarily
- name: Upload coverage report artifact
uses: actions/upload-artifact@v4
with:
name: CoverageReport
path: 'api.Tests/Report'
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.vs
.idea
.idea
api.Tests/bin
api.Tests/obj
api.Tests/TestResults
17 changes: 17 additions & 0 deletions api.Tests/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace api.Tests;

public class UnitTest1
{
[Fact]
public void Test_EnumsToString_ReturnsCorrectString()
{
// Arrange
string expectedResult = "Pending, Processing, Cancelled, Completed";

// Act
string result = EnumUtil.EnumsToString<TransferStatus>();

// Assert
Assert.Equal(expectedResult, result);
}
}
27 changes: 27 additions & 0 deletions api.Tests/api.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
</ItemGroup>

<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\api\api.csproj" />
</ItemGroup>

</Project>
53 changes: 0 additions & 53 deletions api/UnitTests.cs/TestLocations.cs

This file was deleted.

8 changes: 0 additions & 8 deletions api/api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

<ItemGroup>
<PackageReference Include="DotNetEnv" Version="3.1.1" />
<PackageReference Include="FluentAssertions" Version="7.0.0" />
<PackageReference Include="EFCore.BulkExtensions" Version="8.0.1" />
<PackageReference Include="FluentValidation" Version="11.10.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
Expand All @@ -26,16 +25,9 @@
</PackageReference>
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.1.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.10" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.1.2" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

</Project>
Empty file added api/build-results.txt
Empty file.
1 change: 1 addition & 0 deletions api/lint-results.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
��
6 changes: 6 additions & 0 deletions projecthr.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "api", "api\api.csproj", "{E85DB806-85D5-4FBE-941A-BD1EF1B92C40}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "api.Tests", "api.Tests\api.Tests.csproj", "{D401C9B1-62B6-4191-ADD9-AC56CEE6E201}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -15,6 +17,10 @@ Global
{E85DB806-85D5-4FBE-941A-BD1EF1B92C40}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E85DB806-85D5-4FBE-941A-BD1EF1B92C40}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E85DB806-85D5-4FBE-941A-BD1EF1B92C40}.Release|Any CPU.Build.0 = Release|Any CPU
{D401C9B1-62B6-4191-ADD9-AC56CEE6E201}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D401C9B1-62B6-4191-ADD9-AC56CEE6E201}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D401C9B1-62B6-4191-ADD9-AC56CEE6E201}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D401C9B1-62B6-4191-ADD9-AC56CEE6E201}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit 39270eb

Please sign in to comment.