Skip to content

Commit

Permalink
devops: add github action for o2-auth(sso)
Browse files Browse the repository at this point in the history
Merge pull request #85 from live-dev999/live-dev999/issue84
  • Loading branch information
live-dev999 authored Nov 11, 2021
2 parents 7924431 + e825e7a commit 0400ba1
Show file tree
Hide file tree
Showing 204 changed files with 187 additions and 45 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/o2-auth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: .NET

on:
push:
branches:
- master
- dev
pull_request:
branches:
- master
- dev

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.2.x
- name: Restore dependencies
run: dotnet restore
working-directory: src/Services/auth
- name: Build
run: dotnet build --no-restore
working-directory: src/Services/auth

- name: Unit Tests
run: dotnet test Tests.O2NextGen.Auth.Web.csproj --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutput=TestResults/Tests.O2NextGen.Auth.Web.info /p:CoverletOutputFormat=lcov
working-directory: src/Services/auth/Tests/Tests.O2NextGen.Auth.Web/

- name: Integration Tests
run: dotnet test src/Services/auth/Tests/IntegrationTests.O2NextGen.Auth.Web/IntegrationTests.O2NextGen.Auth.Web.csproj --no-build --verbosity normal /p:MergeWith=src/Services/auth/Tests/Tests.O2NextGen.Auth.Web/TestResults/Tests.O2NextGen.Auth.Web.info /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov

- name: Publish coverage report to coveralls.io
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: src/Services/auth/Tests/IntegrationTests.O2NextGen.Auth.Web/TestResults/coverage.info
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private string GenerateQrCodeUri(string email, string unformattedKey)
{
return string.Format(
AuthenticatorUriFormat,
_urlEncoder.Encode("O2NextGen.Auth.Sample"),
_urlEncoder.Encode("O2NextGen.Auth.Web.Sample"),
_urlEncoder.Encode(email),
unformattedKey);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
</PropertyGroup>


<PropertyGroup Condition=" '$(RunConfiguration)' == 'O2NextGen.Auth.Sample' " />
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.App" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - O2NextGen.Auth.Sample</title>
<title>@ViewData["Title"] - O2NextGen.Auth.Web.Sample</title>

<environment include="Development">
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
Expand All @@ -21,7 +21,7 @@
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container">
<a class="navbar-brand" asp-area="" asp-page="/Index">O2NextGen.Auth.Sample</a>
<a class="navbar-brand" asp-area="" asp-page="/Index">O2NextGen.Auth.Web.Sample</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
Expand Down Expand Up @@ -49,7 +49,7 @@

<footer class="border-top footer text-muted">
<div class="container">
&copy; 2021 - O2NextGen.Auth.Sample - <a asp-area="" asp-page="/Privacy">Privacy</a>
&copy; 2021 - O2NextGen.Auth.Web.Sample - <a asp-area="" asp-page="/Privacy">Privacy</a>
</div>
</footer>

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.ToTable("AspNetUserTokens");
});

modelBuilder.Entity("O2NextGen.Auth.Data.O2User", b =>
modelBuilder.Entity("O2NextGen.Auth.Web.Data.O2User", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
Expand Down Expand Up @@ -190,15 +190,15 @@ protected override void BuildModel(ModelBuilder modelBuilder)

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("O2NextGen.Auth.Data.O2User")
b.HasOne("O2NextGen.Auth.Web.Data.O2User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("O2NextGen.Auth.Data.O2User")
b.HasOne("O2NextGen.Auth.Web.Data.O2User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
Expand All @@ -211,15 +211,15 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("O2NextGen.Auth.Data.O2User")
b.HasOne("O2NextGen.Auth.Web.Data.O2User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("O2NextGen.Auth.Data.O2User")
b.HasOne("O2NextGen.Auth.Web.Data.O2User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<RootNamespace>O2NextGen.Auth</RootNamespace>
</PropertyGroup>

<ItemGroup>
Expand Down
52 changes: 52 additions & 0 deletions src/Services/auth/O2NextGen.Auth.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.810.11
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "O2NextGen.Auth.Web", "O2NextGen.Auth.Web\O2NextGen.Auth.Web.csproj", "{9558F553-05AB-44CE-A7D7-C44AB970A358}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "O2NextGen.Auth.Reference", "O2NextGen.Auth.Sample\O2NextGen.Auth.Reference.csproj", "{286B8419-F5B7-443D-BDE6-509AC83052ED}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{F27FA45B-F416-44AE-8A24-91AA3C4EBA39}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntegrationTests.O2NextGen.Auth.Web", "Tests\IntegrationTests.O2NextGen.Auth.Web\IntegrationTests.O2NextGen.Auth.Web.csproj", "{297099E8-8227-4BC2-A537-2B8FAF41BB17}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.O2NextGen.Auth.Web", "Tests\Tests.O2NextGen.Auth.Web\Tests.O2NextGen.Auth.Web.csproj", "{D0C86E83-9BAB-446C-906C-1AD166084612}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Temp", "Temp", "{1B2A171B-C30F-4CE1-9D02-F4CDC4C395FA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9558F553-05AB-44CE-A7D7-C44AB970A358}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9558F553-05AB-44CE-A7D7-C44AB970A358}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9558F553-05AB-44CE-A7D7-C44AB970A358}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9558F553-05AB-44CE-A7D7-C44AB970A358}.Release|Any CPU.Build.0 = Release|Any CPU
{286B8419-F5B7-443D-BDE6-509AC83052ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{286B8419-F5B7-443D-BDE6-509AC83052ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{286B8419-F5B7-443D-BDE6-509AC83052ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{286B8419-F5B7-443D-BDE6-509AC83052ED}.Release|Any CPU.Build.0 = Release|Any CPU
{297099E8-8227-4BC2-A537-2B8FAF41BB17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{297099E8-8227-4BC2-A537-2B8FAF41BB17}.Debug|Any CPU.Build.0 = Debug|Any CPU
{297099E8-8227-4BC2-A537-2B8FAF41BB17}.Release|Any CPU.ActiveCfg = Release|Any CPU
{297099E8-8227-4BC2-A537-2B8FAF41BB17}.Release|Any CPU.Build.0 = Release|Any CPU
{D0C86E83-9BAB-446C-906C-1AD166084612}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D0C86E83-9BAB-446C-906C-1AD166084612}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D0C86E83-9BAB-446C-906C-1AD166084612}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D0C86E83-9BAB-446C-906C-1AD166084612}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EE27CEA0-1DC1-4C22-ABFF-A6A04EEE728D}
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{297099E8-8227-4BC2-A537-2B8FAF41BB17} = {F27FA45B-F416-44AE-8A24-91AA3C4EBA39}
{D0C86E83-9BAB-446C-906C-1AD166084612} = {F27FA45B-F416-44AE-8A24-91AA3C4EBA39}
{286B8419-F5B7-443D-BDE6-509AC83052ED} = {1B2A171B-C30F-4CE1-9D02-F4CDC4C395FA}
EndGlobalSection
EndGlobal
31 changes: 0 additions & 31 deletions src/Services/auth/O2NextGen.Auth/O2NextGen.Auth.sln

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="coverlet.msbuild" Version="3.1.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\O2NextGen.Auth.Web\O2NextGen.Auth.Web.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using Xunit;

namespace IntegrationTests.O2NextGen.Auth.Web
{
public class UnitTest1
{
[Fact]
public void Test1()
{

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using NUnit.Framework;
using O2NextGen.Auth.Pages;

namespace Tests.O2NextGen.Auth.Web
{
public class InputModelTests
{
[Test]
public void InputModel_Email_Test()
{
RegisterModel.InputModel model = new RegisterModel.InputModel();
model.Email = "demo@demo.com";
Assert.AreEqual("demo@demo.com",model.Email);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.RazorPages" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="coverlet.msbuild" Version="3.1.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\O2NextGen.Auth.Web\O2NextGen.Auth.Web.csproj" />
</ItemGroup>

</Project>

0 comments on commit 0400ba1

Please sign in to comment.