From 57d4ed78f2245094fe361e40b5e665abc651ca52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Salamon?= Date: Fri, 2 Feb 2024 15:56:36 +0100 Subject: [PATCH 01/11] Update: code style problems on Controller and Service classes --- .../Controllers/WeatherForecastController.cs | 15 ++++++------- .../Services/WeatherForecastService.cs | 21 ++++++++++--------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/CrontabRegistry/Application/Controllers/WeatherForecastController.cs b/src/CrontabRegistry/Application/Controllers/WeatherForecastController.cs index 0b41a79..17df2b8 100644 --- a/src/CrontabRegistry/Application/Controllers/WeatherForecastController.cs +++ b/src/CrontabRegistry/Application/Controllers/WeatherForecastController.cs @@ -6,9 +6,8 @@ namespace CrontabRegistry.Application.Controllers { [ApiController] [Route("[controller]")] - public class WeatherForecastController : ControllerBase - { - private readonly ILogger _logger; + public class WeatherForecastController : ControllerBase{ + private readonly ILogger _logger ; private readonly IWeatherForecastService _weatherForecastService; public WeatherForecastController( @@ -17,13 +16,11 @@ IWeatherForecastService weatherForecastService ) { _logger = logger; - _weatherForecastService = weatherForecastService; - } - + _weatherForecastService = weatherForecastService;} [HttpGet(Name = "GetWeatherForecast")] - public async Task> Get() - { + public async Task >Get (){ return await _weatherForecastService.GenerateWeatherForecast(); } } -} \ No newline at end of file +} + diff --git a/src/CrontabRegistry/Application/Services/WeatherForecastService.cs b/src/CrontabRegistry/Application/Services/WeatherForecastService.cs index 30b4358..e0bbcdd 100644 --- a/src/CrontabRegistry/Application/Services/WeatherForecastService.cs +++ b/src/CrontabRegistry/Application/Services/WeatherForecastService.cs @@ -1,9 +1,9 @@ using CrontabRegistry.Domain.Models; -using CrontabRegistry.Domain.Repositories; -using CrontabRegistry.Domain.Services; +using CrontabRegistry.Domain.Services;using CrontabRegistry.Domain.Repositories; -namespace CrontabRegistry.Application.Services -{ + + +namespace CrontabRegistry.Application.Services{ public class WeatherForecastService : IWeatherForecastService { private readonly IWeatherForecastRepository _weatherForecastRepository; @@ -15,16 +15,17 @@ IWeatherForecastRepository weatherForecastRepository _weatherForecastRepository = weatherForecastRepository; } - public async Task> GenerateWeatherForecast() - { + public async Task> GenerateWeatherForecast(){ var summaries = await _weatherForecastRepository.GetSummaries(); - return Enumerable.Range(1, 5).Select(index => new WeatherForecastModel - { + return Enumerable.Range(1, 5).Select(index => new WeatherForecastModel { Date = DateTime.Now.AddDays(index), TemperatureC = Random.Shared.Next(-20, 55), Summary = summaries[Random.Shared.Next(summaries.Length)] - }).ToArray(); - } + }).ToArray();} } + + + + } From 1629fc9cd0157c832e5457d8c80aa0cda143cfcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Salamon?= Date: Fri, 2 Feb 2024 16:08:28 +0100 Subject: [PATCH 02/11] Add to artifacts code style checks --- .github/workflows/dotnet.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index d8f4f19..b19dd05 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -30,11 +30,18 @@ jobs: - name: Run integration tests if: success() || failure() run: dotnet test --no-build --verbosity normal --logger 'junit' --results-directory './.test-results/integration' ./tests/Integration/Integration.csproj; - - name: Publish artifacts + - name: Publish artifacts generated by tests uses: actions/upload-artifact@v3 if: success() || failure() with: name: test-results path: | .test-results/unit/TestResults.xml - .test-results/integration/TestResults.xml \ No newline at end of file + .test-results/integration/TestResults.xml + - name: Publish artifacts generated by code style checks + uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: code-style-checks-results + path: | + .linter-results/dotnet/ \ No newline at end of file From 85b0a9cdfd9d8e571003d836986a0ea1ff052a14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Salamon?= Date: Sat, 3 Feb 2024 13:06:48 +0100 Subject: [PATCH 03/11] Add action --- .github/workflows/dotnet.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index b19dd05..07b039d 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -30,6 +30,12 @@ jobs: - name: Run integration tests if: success() || failure() run: dotnet test --no-build --verbosity normal --logger 'junit' --results-directory './.test-results/integration' ./tests/Integration/Integration.csproj; + - name: Create Code Style Report + uses: x-coders-team/dotnet-format-results@v1.0.0-poc-9 + id: code-style-html-report + with: + json-results: '[]' + workdir: $(pwd) - name: Publish artifacts generated by tests uses: actions/upload-artifact@v3 if: success() || failure() From f447a6c7a5c63dd9347cb32469a83651efa52bc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Salamon?= Date: Sat, 3 Feb 2024 13:09:48 +0100 Subject: [PATCH 04/11] Add action --- .github/workflows/dotnet.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 07b039d..dd0c132 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -31,6 +31,7 @@ jobs: if: success() || failure() run: dotnet test --no-build --verbosity normal --logger 'junit' --results-directory './.test-results/integration' ./tests/Integration/Integration.csproj; - name: Create Code Style Report + if: success() || failure() uses: x-coders-team/dotnet-format-results@v1.0.0-poc-9 id: code-style-html-report with: From 4f5bdbc4117b792a64dcf21e8c95eb8ecc7968f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Salamon?= Date: Sat, 3 Feb 2024 13:17:53 +0100 Subject: [PATCH 05/11] Add action --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index dd0c132..db39952 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -32,7 +32,7 @@ jobs: run: dotnet test --no-build --verbosity normal --logger 'junit' --results-directory './.test-results/integration' ./tests/Integration/Integration.csproj; - name: Create Code Style Report if: success() || failure() - uses: x-coders-team/dotnet-format-results@v1.0.0-poc-9 + uses: x-coders-team/dotnet-format-results@v1.0.0-poc-10 id: code-style-html-report with: json-results: '[]' From a21cc608ba67cff4bb86a3a3e57e8838aba45316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Salamon?= Date: Sat, 3 Feb 2024 13:19:46 +0100 Subject: [PATCH 06/11] Add action --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index db39952..e95b5db 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -36,7 +36,7 @@ jobs: id: code-style-html-report with: json-results: '[]' - workdir: $(pwd) + runner-workdir: $(pwd) - name: Publish artifacts generated by tests uses: actions/upload-artifact@v3 if: success() || failure() From 03a2b8cedf7e7ff978049ba36cb69c82d72c9317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Salamon?= Date: Sat, 3 Feb 2024 13:25:43 +0100 Subject: [PATCH 07/11] Add action --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index e95b5db..00ff866 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -32,7 +32,7 @@ jobs: run: dotnet test --no-build --verbosity normal --logger 'junit' --results-directory './.test-results/integration' ./tests/Integration/Integration.csproj; - name: Create Code Style Report if: success() || failure() - uses: x-coders-team/dotnet-format-results@v1.0.0-poc-10 + uses: x-coders-team/dotnet-format-results@v1.0.0-poc-11 id: code-style-html-report with: json-results: '[]' From 4ea97745614af192b2fa8d3e5b4e71c26a0441f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Salamon?= Date: Sat, 3 Feb 2024 13:32:10 +0100 Subject: [PATCH 08/11] Add action --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 00ff866..ffd2c04 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -36,7 +36,7 @@ jobs: id: code-style-html-report with: json-results: '[]' - runner-workdir: $(pwd) + runner-workdir: ${{ github.workspace }} - name: Publish artifacts generated by tests uses: actions/upload-artifact@v3 if: success() || failure() From a4ff7b656bf9cd04c6134ee0e18b61364aaa95c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Salamon?= Date: Sat, 3 Feb 2024 14:03:20 +0100 Subject: [PATCH 09/11] Add action --- .github/workflows/dotnet.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index ffd2c04..c324cc2 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -4,6 +4,10 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] +permissions: + contents: read + actions: read + checks: write jobs: Testing: runs-on: ubuntu-latest @@ -32,7 +36,7 @@ jobs: run: dotnet test --no-build --verbosity normal --logger 'junit' --results-directory './.test-results/integration' ./tests/Integration/Integration.csproj; - name: Create Code Style Report if: success() || failure() - uses: x-coders-team/dotnet-format-results@v1.0.0-poc-11 + uses: x-coders-team/dotnet-format-results@beta id: code-style-html-report with: json-results: '[]' From efca84df1bc3af96ff6c26d6d0562ff168a78b6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Salamon?= Date: Sun, 4 Feb 2024 16:55:58 +0100 Subject: [PATCH 10/11] Chnage workflow --- .github/workflows/dotnet.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index c324cc2..567796c 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -38,6 +38,8 @@ jobs: if: success() || failure() uses: x-coders-team/dotnet-format-results@beta id: code-style-html-report + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: json-results: '[]' runner-workdir: ${{ github.workspace }} From 25283ef36ce3f4b9df29848ce2e17b5ba6c30389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Salamon?= Date: Sun, 4 Feb 2024 18:01:36 +0100 Subject: [PATCH 11/11] Chnage workflow --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 567796c..4edab68 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -57,4 +57,4 @@ jobs: with: name: code-style-checks-results path: | - .linter-results/dotnet/ \ No newline at end of file + .linter-results/dotnet/