Skip to content

Commit

Permalink
Hopefully fixed now
Browse files Browse the repository at this point in the history
  • Loading branch information
CorruptComputer committed Aug 23, 2024
1 parent b4651ec commit 8d7cd78
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 23 deletions.
11 changes: 2 additions & 9 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,11 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Tool Restore
run: |
cd Bones.Api;
dotnet tool restore;
cd ..;
cd Bones.WebUI;
dotnet tool restore;
cd ..;

- name: Build
run: dotnet build --no-incremental
env:
BUILD_ENVIRONMENT: 'GitHub'

- name: Test
run: dotnet test --no-build
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Tool Restore
run: |
cd Bones.Api;
dotnet tool restore;
cd ..;
cd Bones.WebUI;
dotnet tool restore;
cd ..;

- name: Set up JDK 21
uses: actions/setup-java@v4
Expand All @@ -49,9 +40,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
BUILD_ENVIRONMENT: 'GitHub'
run: |
dotnet tool install --global dotnet-sonarscanner
dotnet-sonarscanner begin /k:"CorruptComputer_Bones" /o:"corruptcomputer" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths=./Tests/*.UnitTests/TestResults/*/coverage.opencover.xml
dotnet build --no-incremental
dotnet test --collect:"XPlat Code Coverage;Format=opencover"
dotnet test --no-build --collect:"XPlat Code Coverage;Format=opencover"
dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
2 changes: 1 addition & 1 deletion Bones.Api/Bones.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.1" />
</ItemGroup>

<Target Name="CreateSwaggerJson" AfterTargets="Build" Condition="$(Configuration)=='Debug'">
<Target Name="CreateSwaggerJson" AfterTargets="Build" Condition="$(Configuration) == 'Debug' And $(BUILD_ENVIRONMENT) != 'GitHub'">
<Exec Command="dotnet swagger tofile --output ./OpenApi/swagger.json $(OutputPath)$(AssemblyName).dll develop" WorkingDirectory="$(ProjectDir)" />
</Target>

Expand Down
1 change: 1 addition & 0 deletions Bones.Database/BonesDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)

optionsBuilder.UseNpgsql(connectionString, options =>
{
options.MigrationsHistoryTable("__EFMigrationsHistory", "System");
options.MigrationsAssembly(typeof(BonesDbContext).Assembly.FullName);
options.EnableRetryOnFailure();
});
Expand Down
5 changes: 4 additions & 1 deletion Bones.Database/Extensions/ServiceProviderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ public static void MigrateBonesDb(this IServiceProvider serviceProvider)
if (!useInMemoryDb)
{
BonesDbContext db = scope.ServiceProvider.GetRequiredService<BonesDbContext>();
db.Database.Migrate();
if (db.Database.GetPendingMigrations().Any())
{
db.Database.Migrate();
}
}

// We don't need to await this, it's fine to just execute in the background
Expand Down

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

2 changes: 1 addition & 1 deletion Bones.WebUI/Bones.WebUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</PackageReference>
</ItemGroup>

<Target Name="GenerateApiClients" BeforeTargets="BeforeBuild" >
<Target Name="GenerateApiClients" BeforeTargets="BeforeBuild" Condition="$(Configuration) == 'Debug' And $(BUILD_ENVIRONMENT) != 'GitHub'">
<Message Text="Generating API Clients" Importance="High" />
<Exec Command="dotnet nswag run nswag.json" />
</Target>
Expand Down

0 comments on commit 8d7cd78

Please sign in to comment.