Skip to content

Commit 604775e

Browse files
authored
Запуск юнит-тестов в CI
* ci: run tests for duely * build: go build ignore for example * ci: go services tests * ci: rename jobs to test * fix: fmt.Errorf format * ci: unit tests file paths filter * build: add tests to Duely.sln * build: pin dotnet-ef version * ci: simpler dotnet test
1 parent eb05809 commit 604775e

File tree

7 files changed

+70
-2
lines changed

7 files changed

+70
-2
lines changed

.github/workflows/duely.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Duely
2+
on:
3+
pull_request:
4+
paths:
5+
- Duely/**
6+
defaults:
7+
run:
8+
shell: bash
9+
working-directory: Duely
10+
jobs:
11+
Test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Setup .NET 8.0.x
16+
uses: actions/setup-dotnet@v4
17+
with:
18+
dotnet-version: "8.0.x"
19+
- name: Run tests
20+
run: dotnet test Duely.sln

.github/workflows/exesh.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Exesh
2+
on:
3+
pull_request:
4+
paths:
5+
- Exesh/**
6+
defaults:
7+
run:
8+
shell: bash
9+
working-directory: Exesh
10+
jobs:
11+
Test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Setup Go
16+
uses: actions/setup-go@v6
17+
with:
18+
go-version: "^1.24.0"
19+
- name: Run tests
20+
run: go test -v ./...

.github/workflows/taski.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Taski
2+
on:
3+
pull_request:
4+
paths:
5+
- Taski/**
6+
defaults:
7+
run:
8+
shell: bash
9+
working-directory: Taski
10+
jobs:
11+
Test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Setup Go
16+
uses: actions/setup-go@v6
17+
with:
18+
go-version: "^1.24.0"
19+
- name: Run tests
20+
run: go test -v ./...

Duely/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RUN dotnet build Duely.sln -c Release --no-restore
1010
RUN dotnet publish src/Duely/Duely.csproj -c Release -o /out --no-build
1111

1212
FROM base AS migration
13-
RUN dotnet tool install --global dotnet-ef
13+
RUN dotnet tool install --global dotnet-ef --version 9.0.10
1414
RUN dotnet build Duely.sln -c Release --no-restore
1515
RUN dotnet publish src/Duely/Duely.csproj -c Release -o /migration-out --no-build
1616

Duely/Duely.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duely.Domain.Services", "sr
2222
EndProject
2323
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duely.Application.BackgroundJobs", "src\Duely.Application.BackgroundJobs\Duely.Application.BackgroundJobs.csproj", "{B1A348B2-0D59-489D-8EB6-230620CA5F35}"
2424
EndProject
25+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Duely.Application.Tests", "tests\Duely.Application.Tests\Duely.Application.Tests.csproj", "{34A5A4A8-2D11-43DE-AB69-F0839089600D}"
26+
EndProject
2527
Global
2628
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2729
Debug|Any CPU = Debug|Any CPU
@@ -72,5 +74,9 @@ Global
7274
{B1A348B2-0D59-489D-8EB6-230620CA5F35}.Debug|Any CPU.Build.0 = Debug|Any CPU
7375
{B1A348B2-0D59-489D-8EB6-230620CA5F35}.Release|Any CPU.ActiveCfg = Release|Any CPU
7476
{B1A348B2-0D59-489D-8EB6-230620CA5F35}.Release|Any CPU.Build.0 = Release|Any CPU
77+
{34A5A4A8-2D11-43DE-AB69-F0839089600D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
78+
{34A5A4A8-2D11-43DE-AB69-F0839089600D}.Debug|Any CPU.Build.0 = Debug|Any CPU
79+
{34A5A4A8-2D11-43DE-AB69-F0839089600D}.Release|Any CPU.ActiveCfg = Release|Any CPU
80+
{34A5A4A8-2D11-43DE-AB69-F0839089600D}.Release|Any CPU.Build.0 = Release|Any CPU
7581
EndGlobalSection
7682
EndGlobal

Exesh/example/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//go:build ignore
2+
13
package main
24

35
import (

Taski/internal/usecase/task/usecase/random/usecase.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func NewUseCase(log *slog.Logger) *UseCase {
2222
func (uc *UseCase) Random(query Query) (taskID task.ID, err error) {
2323
// temp: hardcode only one existing task id
2424
if err = taskID.FromString("7d971f50363cf0aebbd87d971f50363cf0aebbd8"); err != nil {
25-
err = fmt.Errorf("failed to parse task id: %w")
25+
err = fmt.Errorf("failed to parse task id: %w", err)
2626
return
2727
}
2828
return

0 commit comments

Comments
 (0)