diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c215fdb..52d0d40 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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: | @@ -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/ diff --git a/BiStudent.Server/BiStudent.Server.csproj b/BiStudent.Server/BiStudent.Server.csproj index 5600c81..46c1ac0 100644 --- a/BiStudent.Server/BiStudent.Server.csproj +++ b/BiStudent.Server/BiStudent.Server.csproj @@ -18,6 +18,7 @@ - + + diff --git a/BiStudent.Server/Services/SeedService.cs b/BiStudent.Server/Services/SeedService.cs index d5557a0..017b1ad 100644 --- a/BiStudent.Server/Services/SeedService.cs +++ b/BiStudent.Server/Services/SeedService.cs @@ -7,7 +7,7 @@ namespace BiStudent.Server.Services; public sealed class SeedService(AppDbContext db, IConfiguration configuration, IWebHostEnvironment environment, - IPasswordHasher hasher, ScheduleService schedule) + IPasswordHasher hasher, ScheduleService schedule, ILogger logger) { public async Task SeedAsync() { @@ -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();