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
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
build-test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
- uses: actions/checkout@v5
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- run: dotnet restore BiStudent.slnx
Expand All @@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
needs: build-test
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- run: docker build -f BiStudent.Server/Dockerfile -t bistudent-server .
- name: Smoke test
run: |
Expand All @@ -43,13 +43,13 @@ jobs:
needs: build-test
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
- uses: actions/checkout@v5
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- run: dotnet publish BiStudent/BiStudent.csproj -c Release -r win-x64 --self-contained true -o out/BiStudent-Client
- run: dotnet publish BiStudent.Server/BiStudent.Server.csproj -c Release -r win-x64 --self-contained true -o out/BiStudent-Server
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v5
with:
name: BiStudent-win-x64
path: out/
3 changes: 2 additions & 1 deletion BiStudent.Server/BiStudent.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<PackageReference Include="OpenCvSharp4.official.runtime.linux-x64" Version="4.13.0.20260627" />
</ItemGroup>
<ItemGroup>
<Content Update="seed\*.csv" CopyToOutputDirectory="PreserveNewest" />
<Content Include="seed\students.demo.csv" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
<Content Include="seed\students.local.csv" Condition="Exists('seed\students.local.csv')" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="Never" />
</ItemGroup>
</Project>
9 changes: 7 additions & 2 deletions BiStudent.Server/Services/SeedService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace BiStudent.Server.Services;

public sealed class SeedService(AppDbContext db, IConfiguration configuration, IWebHostEnvironment environment,
IPasswordHasher<Teacher> hasher, ScheduleService schedule)
IPasswordHasher<Teacher> hasher, ScheduleService schedule, ILogger<SeedService> logger)
{
public async Task SeedAsync()
{
Expand All @@ -25,7 +25,12 @@ public async Task SeedAsync()
Path.Combine(AppContext.BaseDirectory, "seed", "students.local.csv"),
Path.Combine(environment.ContentRootPath, "seed", "students.demo.csv"),
Path.Combine(AppContext.BaseDirectory, "seed", "students.demo.csv")
}.FirstOrDefault(File.Exists) ?? throw new FileNotFoundException("Не найден список студентов для демо.");
}.FirstOrDefault(File.Exists);
if (path is null)
{
logger.LogWarning("Список студентов для демо (seed/students.demo.csv) не найден: создан только преподаватель.");
return;
}
foreach (var raw in await File.ReadAllLinesAsync(path))
{
var parts = raw.Split(';').Select(x => x.Trim()).ToArray();
Expand Down
Loading