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
55 changes: 53 additions & 2 deletions .github/workflows/development.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,57 @@ on:
jobs:
build-and-publish:
runs-on: ubuntu-latest

permissions:
contents: read
checks: write

steps:
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v2

# Step 2: Set up .NET environment
- name: Set up .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0'

# Step 4: Restore dependencies
- name: Restore dependencies for Unit Tests
run: dotnet restore SystemAdmin-UnitTests/SystemAdmin-UnitTests.csproj

# Step 5: Run Unit Tests
- name: Run Unit Tests
run: dotnet test SystemAdmin-UnitTests/SystemAdmin-UnitTests.csproj --logger "trx;LogFileName=unit-test-results.trx" --results-directory ./TestResults --verbosity normal

# Step 6: Restore Dependencies for Functional Tests
- name: Restore dependencies for Functional Tests
run: dotnet restore SystemAdmin-FunctionalTests/SystemAdmin-FunctionalTests.csproj

# Step 7: Run Functional Tests
- name: Run Functional Tests
run: dotnet test SystemAdmin-FunctionalTests/SystemAdmin-FunctionalTests.csproj --logger "trx;LogFileName=functional-test-results.trx" --results-directory ./TestResults --verbosity normal

# Step 8: List Test Result Files
- name: List Test Result Files
run: ls -R ./TestResults

# Step 9: Upload Test Results with Test Reporter
- name: Upload Test Results
uses: dorny/test-reporter@v1
with:
name: Unit and Functional Tests
path: ./TestResults/*.trx
reporter: dotnet-trx

# Step 10: Extract the Version tag from the Docker File
- name: Extract Version Tag
id: extract_version
run: |
VERSION=$(grep 'LABEL version=' SystemAdmin/Dockerfile | sed 's/.*"\(.*\)"/\1/')
echo "VERSION=$VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV

# Step 2: Login to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v2
Expand All @@ -27,17 +72,23 @@ jobs:
# Step 3: Build the Docker image
- name: Build Docker image
run: |
docker build -t ${{ secrets.DOCKER_HUB_USERNAME }}/systemadmin:dev -f ./Dockerfile .
echo "VERSION=$VERSION"
echo "VERSION from GITHUB_ENV is: ${{ env.VERSION }}"
docker build --build-arg AZURE_DEVOPS_PAT=${{ secrets.AZURE_DEVOPS_PAT }} -t ${{ secrets.DOCKER_HUB_USERNAME }}/systemadmin:dev -t ${{ secrets.DOCKER_HUB_USERNAME }}/systemadmin:${{ env.VERSION }} -f ./Dockerfile .

# Step 4: Push Docker image to Docker Hub
- name: Push Docker image to Docker Hub
run: |
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/systemadmin:dev
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/systemadmin:${{ env.VERSION }}

# Step 5: Trigger Azure Release Pipeline
- name: Trigger Azure DevOps Pipeline
uses: Azure/pipelines@v1.2
with:
azure-devops-project-url: ${{ secrets.AZURE_DEVOPS_PROJECT_URL }}
azure-pipeline-name: 'thattonBL.GlobalIntegrationUI'
azure-devops-token: ${{ secrets.AZURE_DEVOPS_PAT }}
azure-pipeline-variables: '{"DOCKER_IMAGE_VERSION": "${{ env.VERSION }}"}'

- uses: actions/checkout@v2
64 changes: 61 additions & 3 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,64 @@ on:
jobs:
build-and-publish:
runs-on: ubuntu-latest

permissions:
contents: read
checks: write

steps:
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v2

# Step 2: Set up .NET environment
- name: Set up .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0'

# Step 3: Authenticate with Azure Artifacts
- name: Authenticate with Azure Artifacts
run: |
echo ${{ secrets.AZURE_DEVOPS_PAT }} | dotnet nuget add source --store-password-in-clear-text \
--name azure-artifacts https://pkgs.dev.azure.com/BritishLibrary-AppDev/Gateway/_packaging/Gateway_Nuget_Feed/nuget/v3/index.json \
--username GitHubActions --password ${{ secrets.AZURE_DEVOPS_PAT }}

# Step 4: Restore dependencies
- name: Restore dependencies for Unit Tests
run: dotnet restore SystemAdmin-UnitTests/SystemAdmin-UnitTests.csproj

# Step 5: Run Unit Tests
- name: Run Unit Tests
run: dotnet test SystemAdmin-UnitTests/SystemAdmin-UnitTests.csproj --logger "trx;LogFileName=unit-test-results.trx" --results-directory ./TestResults --verbosity normal

# Step 6: Restore Dependencies for Functional Tests
- name: Restore dependencies for Functional Tests
run: dotnet restore SystemAdmin-FunctionalTests/SystemAdmin-FunctionalTests.csproj

# Step 7: Run Functional Tests
- name: Run Functional Tests
run: dotnet test SystemAdmin-FunctionalTests/SystemAdmin-FunctionalTests.csproj --logger "trx;LogFileName=functional-test-results.trx" --results-directory ./TestResults --verbosity normal

# Step 8: List Test Result Files
- name: List Test Result Files
run: ls -R ./TestResults

# Step 9: Upload Test Results with Test Reporter
- name: Upload Test Results
uses: dorny/test-reporter@v1
with:
name: Unit and Functional Tests
path: ./TestResults/*.trx
reporter: dotnet-trx

# Step 10: Extract the Version tag from the Docker File
- name: Extract Version Tag
id: extract_version
run: |
VERSION=$(grep 'LABEL version=' SystemAdmin/Dockerfile | sed 's/.*"\(.*\)"/\1/')
echo "VERSION=$VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV

# Step 2: Login to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v2
Expand All @@ -27,17 +79,23 @@ jobs:
# Step 3: Build the Docker image
- name: Build Docker image
run: |
docker build -t ${{ secrets.DOCKER_HUB_USERNAME }}/systemadmin:latest -f ./Dockerfile .
echo "VERSION=$VERSION"
echo "VERSION from GITHUB_ENV is: ${{ env.VERSION }}"
docker build --build-arg AZURE_DEVOPS_PAT=${{ secrets.AZURE_DEVOPS_PAT }} -t ${{ secrets.DOCKER_HUB_USERNAME }}/systemadmin:latest -t ${{ secrets.DOCKER_HUB_USERNAME }}/systemadmin:${{ env.VERSION }} -f ./Dockerfile .

# Step 4: Push Docker image to Docker Hub
- name: Push Docker image to Docker Hub
run: |
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/systemadmin:latest
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/gatewaygrpcservice:${{ env.VERSION }}

# Step 5: Trigger Azure Release Pipeline
- name: Trigger Azure DevOps Pipeline
uses: Azure/pipelines@v1.2
with:
azure-devops-project-url: ${{ secrets.AZURE_DEVOPS_PROJECT_URL }}
azure-pipeline-name: 'thattonBL.GlobalIntegrationUI'
azure-devops-token: ${{ secrets.AZURE_DEVOPS_PAT }}

azure-pipeline-variables: '{"DOCKER_IMAGE_VERSION": "${{ env.VERSION }}"}'

- uses: actions/checkout@v2
24 changes: 24 additions & 0 deletions SystemAdmin-FunctionalTests/SystemAdmin-FunctionalTests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>SystemAdmin_FunctionalTests</RootNamespace>
<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.8.0" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
</ItemGroup>

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

</Project>
12 changes: 12 additions & 0 deletions SystemAdmin-FunctionalTests/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace SystemAdmin_FunctionalTests
{
public class UnitTest1
{
[Fact]
public void PlaceholderTest()
{
var myString = "Someone needs to write some blooming functional tests for this...";
Assert.True(myString.Length > 2);
}
}
}
24 changes: 24 additions & 0 deletions SystemAdmin-UnitTests/SystemAdmin-UnitTests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>SystemAdmin_UnitTests</RootNamespace>
<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.8.0" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
</ItemGroup>

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

</Project>
12 changes: 12 additions & 0 deletions SystemAdmin-UnitTests/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace SystemAdmin_UnitTests
{
public class UnitTest1
{
[Fact]
public void PlaceholderTest()
{
var myString = "Someone needs to write some blooming unit tests for this...";
Assert.True(myString.Length > 2);
}
}
}
22 changes: 17 additions & 5 deletions SystemAdmin.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,30 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34902.65
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SystemAdmin", "SystemAdmin.csproj", "{6D0D51F4-E72E-456E-88FD-E4B96BC0B4B5}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SystemAdmin-FunctionalTests", "SystemAdmin-FunctionalTests\SystemAdmin-FunctionalTests.csproj", "{0B503B40-279B-4055-AE9E-7F89C60C1593}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SystemAdmin-UnitTests", "SystemAdmin-UnitTests\SystemAdmin-UnitTests.csproj", "{A2DCAED5-9363-4A65-9A17-4B56A506BBFD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SystemAdmin", "SystemAdmin\SystemAdmin.csproj", "{7768F08C-D6D9-4C62-818A-CCAD7F992851}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6D0D51F4-E72E-456E-88FD-E4B96BC0B4B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D0D51F4-E72E-456E-88FD-E4B96BC0B4B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D0D51F4-E72E-456E-88FD-E4B96BC0B4B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D0D51F4-E72E-456E-88FD-E4B96BC0B4B5}.Release|Any CPU.Build.0 = Release|Any CPU
{0B503B40-279B-4055-AE9E-7F89C60C1593}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B503B40-279B-4055-AE9E-7F89C60C1593}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B503B40-279B-4055-AE9E-7F89C60C1593}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B503B40-279B-4055-AE9E-7F89C60C1593}.Release|Any CPU.Build.0 = Release|Any CPU
{A2DCAED5-9363-4A65-9A17-4B56A506BBFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A2DCAED5-9363-4A65-9A17-4B56A506BBFD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A2DCAED5-9363-4A65-9A17-4B56A506BBFD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A2DCAED5-9363-4A65-9A17-4B56A506BBFD}.Release|Any CPU.Build.0 = Release|Any CPU
{7768F08C-D6D9-4C62-818A-CCAD7F992851}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7768F08C-D6D9-4C62-818A-CCAD7F992851}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7768F08C-D6D9-4C62-818A-CCAD7F992851}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7768F08C-D6D9-4C62-818A-CCAD7F992851}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
30 changes: 30 additions & 0 deletions SystemAdmin/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
!**/.gitignore
!.git/HEAD
!.git/config
!.git/packed-refs
!.git/refs/heads/**
1 change: 1 addition & 0 deletions Dockerfile → SystemAdmin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ RUN dotnet publish "./SystemAdmin.csproj" -c $BUILD_CONFIGURATION -o /app/publis
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
LABEL version="1.0.0"
ENTRYPOINT ["dotnet", "SystemAdmin.dll"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions SystemAdmin/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"profiles": {
"SystemAdmin": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:49908;http://localhost:49909"
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
}
},
"Urls": {
"BaseUrl": "http://host.docker.internal:59283"
"BaseUrl": "https://localhost:59284"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading