Skip to content

Commit

Permalink
Merge pull request #93 from cmu-sei/next
Browse files Browse the repository at this point in the history
v3.7.0
  • Loading branch information
sei-mkaar authored Jan 12, 2023
2 parents 8da35cb + f7f7a38 commit cc1bb2d
Show file tree
Hide file tree
Showing 83 changed files with 3,646 additions and 501 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# app settings
.git
.github
.vs
.vscode

# compiled
bin
obj
20 changes: 20 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,30 @@ on:
branches:
- dev
- test
- next

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use .NET Core SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
- name: Run unit tests
run: dotnet test src/Gameboard.Tests.Unit --no-restore
- name: Run integration tests
run: dotnet test src/Gameboard.Tests.Integration --no-restore

build:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
#multi-stage target: dev
#
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS dev
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS dev

ENV ASPNETCORE_URLS=http://*:5000 \
ASPNETCORE_ENVIRONMENT=DEVELOPMENT
Expand All @@ -15,7 +15,7 @@ CMD ["dotnet", "run"]
#
#multi-stage target: prod
#
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS prod
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS prod
ARG commit
ENV COMMIT=$commit
COPY --from=dev /app/dist /app
Expand Down
30 changes: 30 additions & 0 deletions Gameboard.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C148F187-E60
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gameboard", "src\Gameboard.Api\Gameboard.Api.csproj", "{A2715FCD-D078-4E96-81C3-B833640921C5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gameboard.Tests.Unit", "src\Gameboard.Tests.Unit\Gameboard.Tests.Unit.csproj", "{BAEF960F-857E-4CDA-9D9D-D2F6F1C40E0C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gameboard.Tests.Integration", "src\Gameboard.Tests.Integration\Gameboard.Tests.Integration.csproj", "{7598696F-417B-4062-A69A-85CD50D067FE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -32,8 +36,34 @@ Global
{A2715FCD-D078-4E96-81C3-B833640921C5}.Release|x64.Build.0 = Release|Any CPU
{A2715FCD-D078-4E96-81C3-B833640921C5}.Release|x86.ActiveCfg = Release|Any CPU
{A2715FCD-D078-4E96-81C3-B833640921C5}.Release|x86.Build.0 = Release|Any CPU
{BAEF960F-857E-4CDA-9D9D-D2F6F1C40E0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BAEF960F-857E-4CDA-9D9D-D2F6F1C40E0C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BAEF960F-857E-4CDA-9D9D-D2F6F1C40E0C}.Debug|x64.ActiveCfg = Debug|Any CPU
{BAEF960F-857E-4CDA-9D9D-D2F6F1C40E0C}.Debug|x64.Build.0 = Debug|Any CPU
{BAEF960F-857E-4CDA-9D9D-D2F6F1C40E0C}.Debug|x86.ActiveCfg = Debug|Any CPU
{BAEF960F-857E-4CDA-9D9D-D2F6F1C40E0C}.Debug|x86.Build.0 = Debug|Any CPU
{BAEF960F-857E-4CDA-9D9D-D2F6F1C40E0C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BAEF960F-857E-4CDA-9D9D-D2F6F1C40E0C}.Release|Any CPU.Build.0 = Release|Any CPU
{BAEF960F-857E-4CDA-9D9D-D2F6F1C40E0C}.Release|x64.ActiveCfg = Release|Any CPU
{BAEF960F-857E-4CDA-9D9D-D2F6F1C40E0C}.Release|x64.Build.0 = Release|Any CPU
{BAEF960F-857E-4CDA-9D9D-D2F6F1C40E0C}.Release|x86.ActiveCfg = Release|Any CPU
{BAEF960F-857E-4CDA-9D9D-D2F6F1C40E0C}.Release|x86.Build.0 = Release|Any CPU
{7598696F-417B-4062-A69A-85CD50D067FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7598696F-417B-4062-A69A-85CD50D067FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7598696F-417B-4062-A69A-85CD50D067FE}.Debug|x64.ActiveCfg = Debug|Any CPU
{7598696F-417B-4062-A69A-85CD50D067FE}.Debug|x64.Build.0 = Debug|Any CPU
{7598696F-417B-4062-A69A-85CD50D067FE}.Debug|x86.ActiveCfg = Debug|Any CPU
{7598696F-417B-4062-A69A-85CD50D067FE}.Debug|x86.Build.0 = Debug|Any CPU
{7598696F-417B-4062-A69A-85CD50D067FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7598696F-417B-4062-A69A-85CD50D067FE}.Release|Any CPU.Build.0 = Release|Any CPU
{7598696F-417B-4062-A69A-85CD50D067FE}.Release|x64.ActiveCfg = Release|Any CPU
{7598696F-417B-4062-A69A-85CD50D067FE}.Release|x64.Build.0 = Release|Any CPU
{7598696F-417B-4062-A69A-85CD50D067FE}.Release|x86.ActiveCfg = Release|Any CPU
{7598696F-417B-4062-A69A-85CD50D067FE}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{A2715FCD-D078-4E96-81C3-B833640921C5} = {C148F187-E600-4044-8944-2E9E52575B07}
{BAEF960F-857E-4CDA-9D9D-D2F6F1C40E0C} = {C148F187-E600-4044-8944-2E9E52575B07}
{7598696F-417B-4062-A69A-85CD50D067FE} = {C148F187-E600-4044-8944-2E9E52575B07}
EndGlobalSection
EndGlobal
37 changes: 18 additions & 19 deletions src/Gameboard.Api/Data/DataStartupExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
// Released under a MIT (SEI)-style license. See LICENSE.md in the project root for license information.

using System;
using Microsoft.EntityFrameworkCore;
using Gameboard.Api.Data;
using Gameboard.Api.Data.Abstractions;
using System.Reflection;
using System.Linq;
using System.Reflection;
using Gameboard.Api.Data;
using Microsoft.EntityFrameworkCore;

namespace Microsoft.Extensions.DependencyInjection
{
Expand All @@ -22,25 +21,25 @@ string connstr
{

case "sqlserver":
// services.AddEntityFrameworkSqlServer();
services.AddDbContext<GameboardDbContext, GameboardDbContextSqlServer>(
builder => builder.UseSqlServer(connstr)
);
break;
// services.AddEntityFrameworkSqlServer();
services.AddDbContext<GameboardDbContext, GameboardDbContextSqlServer>(
builder => builder.UseSqlServer(connstr)
);
break;

case "postgresql":
// services.AddEntityFrameworkNpgsql();
services.AddDbContext<GameboardDbContext, GameboardDbContextPostgreSQL>(
builder => builder.UseNpgsql(connstr)
);
break;
// services.AddEntityFrameworkNpgsql();
services.AddDbContext<GameboardDbContext, GameboardDbContextPostgreSQL>(
builder => builder.UseNpgsql(connstr)
);
break;

default:
// services.AddEntityFrameworkInMemoryDatabase();
services.AddDbContext<GameboardDbContext, GameboardDbContextInMemory>(
builder => builder.UseInMemoryDatabase("Gameboard_Db")
);
break;
// services.AddEntityFrameworkInMemoryDatabase();
services.AddDbContext<GameboardDbContext, GameboardDbContextInMemory>(
builder => builder.UseInMemoryDatabase("Gameboard_Db")
);
break;
}

// Auto-discover from EntityStore and IEntityStore pattern
Expand Down
1 change: 1 addition & 0 deletions src/Gameboard.Api/Data/Entities/ArchivedChallenge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class ArchivedChallenge : IEntity
public DateTimeOffset LastScoreTime { get; set; }
public DateTimeOffset LastSyncTime { get; set; }
public bool HasGamespaceDeployed { get; set; }
public string State { get; set; }
public int Points { get; set; }
public int Score { get; set; }
public long Duration { get; set; }
Expand Down
1 change: 1 addition & 0 deletions src/Gameboard.Api/Data/Entities/Challenge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;

namespace Gameboard.Api.Data
{
Expand Down
6 changes: 3 additions & 3 deletions src/Gameboard.Api/Data/Entities/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ public class Player : IEntity
public Game Game { get; set; }
public ICollection<Challenge> Challenges { get; set; } = new List<Challenge>();
[NotMapped] public bool IsManager => Role == PlayerRole.Manager;
[NotMapped] public bool IsLive =>
[NotMapped]
public bool IsLive =>
SessionBegin > DateTimeOffset.MinValue &&
SessionBegin < DateTimeOffset.UtcNow &&
SessionEnd > DateTimeOffset.UtcNow
;
SessionEnd > DateTimeOffset.UtcNow;

// Control delete behavior with relationships
public ICollection<Feedback> Feedback { get; set; } = new List<Feedback>();
Expand Down
Loading

0 comments on commit cc1bb2d

Please sign in to comment.