Skip to content

Commit

Permalink
Merge pull request #275 from DFE-Digital/feature/reference-nuget-regi…
Browse files Browse the repository at this point in the history
…stry

added a ref to the nuget registry
  • Loading branch information
chrisdexnimble authored Jun 27, 2023
2 parents 49e6a30 + dc9df88 commit 10a71b2
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/build-and-push-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
context: .
file: Dockerfile
build-args: COMMIT_SHA=${{ needs.set-env.outputs.checked-out-sha }}
secrets: github_token=${{ secrets.GITHUB_TOKEN }}
tags: |
${{ secrets.AZURE_ACR_URL }}/${{ env.DOCKER_IMAGE }}:${{ needs.set-env.outputs.branch }}
${{ secrets.AZURE_ACR_URL }}/${{ env.DOCKER_IMAGE }}:${{ needs.set-env.outputs.release }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
run: |
cp .env.development.local.example .env.development.local
cp .env.database.example .env.database
docker-compose -f docker-compose.yml -p app build
docker-compose -f docker-compose.yml -p app build --secrets github_token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"dotnet.defaultSolution": "Dfe.Academies.Academisation.sln"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
namespace Dfe.Academies.Academisation.Service.UnitTest.Extensions;
using Dfe.Academies.Academisation.Service.Extensions;
using Xunit;

/// <summary>
/// The string extensions tests.
/// </summary>
public class StringExtensionsTests
{
/// <summary>
/// The to title case tests.
/// </summary>
public class ToTitleCaseTests
{
/// <summary>
/// Givens the string_ should convert to title case.
/// </summary>
/// <param name="givenString">The given string.</param>
/// <param name="expectedStringAsTitleCase">The expected string as title case.</param>
[Theory]
[InlineData(null, null)]
[InlineData("", "")]
[InlineData("All Title Case", "All Title Case")]
[InlineData("all lower case", "All Lower Case")]
public void GivenString_ShouldConvertToTitleCase(string givenString, string expectedStringAsTitleCase)
{
string? result = givenString?.ToTitleCase();
Assert.Equal(expectedStringAsTitleCase, result);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<ItemGroup>
<PackageReference Include="Ardalis.GuardClauses" Version="4.0.1" />
<PackageReference Include="AutoMapper" Version="12.0.1" />
<PackageReference Include="Dfe.Academisation.ExtensionMethods" Version="1.2.0" />
<PackageReference Include="MediatR" Version="12.0.1" />
</ItemGroup>

Expand Down
18 changes: 18 additions & 0 deletions Dfe.Academies.Academisation.Service/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace Dfe.Academies.Academisation.Service.Extensions;
using Dfe.Academisation.ExtensionMethods;

/// <summary>
/// The string extensions.
/// </summary>
internal static class StringExtensions
{
/// <summary>
/// Title cases a string. Not used, just added to test nuget reference.
/// </summary>
/// <param name="string">The string.</param>
/// <returns>A string.</returns>
public static string ToTitleCase(this string @string)
{
return Dfe.Academisation.ExtensionMethods.StringExtensions.ToTitleCase(@string);
}
}
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ COPY ./Dfe.Academies.Academisation.Service/ ./Dfe.Academies.Academisation.Servic
COPY ./Dfe.Academies.Academisation.WebApi/ ./Dfe.Academies.Academisation.WebApi/
COPY ./Dfe.Academies.Academisation.sln/ ./Dfe.Academies.Academisation.sln

RUN --mount=type=secret,id=github_token dotnet nuget add source --username USERNAME --password $(cat /run/secrets/github_token) --store-password-in-clear-text --name github "https://nuget.pkg.github.com/DFE-Digital/index.json"
RUN dotnet restore Dfe.Academies.Academisation.WebApi
RUN dotnet build Dfe.Academies.Academisation.WebApi

Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ services:
webapi:
build:
context: .
secrets:
- github_token
command: /bin/bash -c "./docker-entrypoint.sh dotnet Dfe.Academies.Academisation.WebApi.dll"
ports:
- 80:80/tcp
Expand Down

0 comments on commit 10a71b2

Please sign in to comment.