From f2f0445721f5e3efe98ea22266148c698b3ef288 Mon Sep 17 00:00:00 2001 From: JasonTaylorDev Date: Wed, 15 Nov 2023 20:08:54 +1000 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20Upgrade=20to=20.NET=208?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 180 +++++++++--------- CleanArchitecture.nuspec | 4 +- Directory.Packages.props | 54 +++--- README-template.md | 4 +- README.md | 2 +- global.json | 5 +- src/Web/ClientApp/src/app/web-api-client.ts | 24 +-- src/Web/Web.csproj | 2 +- src/Web/config-react.nswag | 2 +- src/Web/config-webapi.nswag | 2 +- src/Web/config.nswag | 2 +- src/Web/wwwroot/api/specification.json | 35 +--- .../Application.FunctionalTests.csproj | 5 +- .../Application.UnitTests.csproj | 5 +- .../Domain.UnitTests/Domain.UnitTests.csproj | 5 +- .../Infrastructure.IntegrationTests.csproj | 5 +- 16 files changed, 161 insertions(+), 175 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4326a3729..76e1969d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,90 +1,90 @@ -name: Build - -on: - pull_request: - branches: [ main ] - paths-ignore: - - '.scripts/**' - - .gitignore - - CODE_OF_CONDUCT.md - - LICENSE - - README.md - - workflow_call: - inputs: - build-artifacts: - type: boolean - required: true - default: false - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - name: Checkout code - - - name: Cache NuGet packages - uses: actions/cache@v3 - with: - path: ~/.nuget/packages - key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - restore-keys: | - ${{ runner.os }}-nuget- - - #if (!UseApiOnly) - - name: Install Node & cache npm packages - uses: actions/setup-node@v3 - with: - node-version: '18.x' - cache: 'npm' - cache-dependency-path: src/Web/ClientApp/package-lock.json - #endif - - - name: Install .NET - uses: actions/setup-dotnet@v3 - - - name: Restore solution - run: dotnet restore - - - name: Build solution - run: dotnet build --no-restore --configuration Release - - - name: Test solution - run: dotnet test --no-build --configuration Release --filter "FullyQualifiedName!~AcceptanceTests" - - - name: Publish website - if: ${{ inputs.build-artifacts == true }} - run: | - dotnet publish --configuration Release --runtime win-x86 --self-contained --output ./publish - cd publish - zip -r ./publish.zip . - working-directory: ./src/Web/ - - - name: Upload website artifact (website) - if: ${{ inputs.build-artifacts == true }} - uses: actions/upload-artifact@v3 - with: - name: website - path: ./src/Web/publish/publish.zip - if-no-files-found: error - - - name: Create EF Core migrations bundle - if: ${{ inputs.build-artifacts == true }} - run: | - dotnet new tool-manifest - dotnet tool install dotnet-ef --prerelease - dotnet ef migrations bundle --configuration Release -p ./src/Infrastructure/ -s ./src/Web/ -o efbundle.exe - zip -r ./efbundle.zip efbundle.exe - env: - SkipNSwag: True - - - name: Upload EF Core migrations bundle artifact (efbundle) - if: ${{ inputs.build-artifacts == true }} - uses: actions/upload-artifact@v3 - with: - name: efbundle - path: ./efbundle.zip - if-no-files-found: error +name: Build + +on: + pull_request: + branches: [ main ] + paths-ignore: + - '.scripts/**' + - .gitignore + - CODE_OF_CONDUCT.md + - LICENSE + - README.md + + workflow_call: + inputs: + build-artifacts: + type: boolean + required: true + default: false + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + name: Checkout code + + - name: Cache NuGet packages + uses: actions/cache@v3 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} + restore-keys: | + ${{ runner.os }}-nuget- + + #if (!UseApiOnly) + - name: Install Node & cache npm packages + uses: actions/setup-node@v3 + with: + node-version: '18.x' + cache: 'npm' + cache-dependency-path: src/Web/ClientApp/package-lock.json + #endif + + - name: Install .NET + uses: actions/setup-dotnet@v3 + + - name: Restore solution + run: dotnet restore + + - name: Build solution + run: dotnet build --no-restore --configuration Release + + - name: Test solution + run: dotnet test --no-build --configuration Release --filter "FullyQualifiedName!~AcceptanceTests" + + - name: Publish website + if: ${{ inputs.build-artifacts == true }} + run: | + dotnet publish --configuration Release --runtime win-x86 --self-contained --output ./publish + cd publish + zip -r ./publish.zip . + working-directory: ./src/Web/ + + - name: Upload website artifact (website) + if: ${{ inputs.build-artifacts == true }} + uses: actions/upload-artifact@v3 + with: + name: website + path: ./src/Web/publish/publish.zip + if-no-files-found: error + + - name: Create EF Core migrations bundle + if: ${{ inputs.build-artifacts == true }} + run: | + dotnet new tool-manifest + dotnet tool install dotnet-ef + dotnet ef migrations bundle --configuration Release -p ./src/Infrastructure/ -s ./src/Web/ -o efbundle.exe + zip -r ./efbundle.zip efbundle.exe + env: + SkipNSwag: True + + - name: Upload EF Core migrations bundle artifact (efbundle) + if: ${{ inputs.build-artifacts == true }} + uses: actions/upload-artifact@v3 + with: + name: efbundle + path: ./efbundle.zip + if-no-files-found: error diff --git a/CleanArchitecture.nuspec b/CleanArchitecture.nuspec index 19de824ef..f57dd5c05 100644 --- a/CleanArchitecture.nuspec +++ b/CleanArchitecture.nuspec @@ -3,7 +3,7 @@ Clean.Architecture.Solution.Template - 8.0.0-preview.7.2 + 8.0.0 Clean Architecture Solution Template JasonTaylorDev Clean Architecture Solution Template for .NET 8. @@ -11,7 +11,7 @@ A Clean Architecture Solution Template for creating apps using Angular, React, or Web API only with ASP.NET Core. - Update CICD workflow to request required permissions. + Upgrade to .NET 8.0 https://github.com/JasonTaylorDev/CleanArchitecture diff --git a/Directory.Packages.props b/Directory.Packages.props index 12d174864..951735371 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,47 +4,47 @@ true - + - - + + - + - + - - - - - + + + + + - + - - + + - + - + - - - - - - - - - - + + + + + + + + + + - + - + diff --git a/README-template.md b/README-template.md index e2222f722..cbed583c0 100644 --- a/README-template.md +++ b/README-template.md @@ -1,6 +1,6 @@ # CleanArchitecture -The project was generated using the [Clean.Architecture.Solution.Template](https://github.com/jasontaylordev/CleanArchitecture) version 8.0.0-preview.7.2. +The project was generated using the [Clean.Architecture.Solution.Template](https://github.com/jasontaylordev/CleanArchitecture) version 8.0.0. ## Build @@ -42,7 +42,7 @@ dotnet new ca-usecase -n GetTodos -fn TodoLists -ut query -rt TodosVm If you encounter the error *"No templates or subcommands found matching: 'ca-usecase'."*, install the template and try again: ```bash -dotnet new install Clean.Architecture.Solution.Template::8.0.0-preview.7.2 +dotnet new install Clean.Architecture.Solution.Template::8.0.0 ``` ## Test diff --git a/README.md b/README.md index d507ae169..a1ac78552 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ If you find this project useful, please give it a star. Thanks! ⭐ The easiest way to get started is to install the [.NET template](https://www.nuget.org/packages/Clean.Architecture.Solution.Template): ``` -dotnet new install Clean.Architecture.Solution.Template::8.0.0-preview.7.2 +dotnet new install Clean.Architecture.Solution.Template::8.0.0 ``` Once installed, create a new solution using the template. You can choose to use Angular, React, or create a Web API-only solution. Specify the client framework using the `-cf` or `--client-framework` option, and provide the output directory where your project will be created. Here are some examples: diff --git a/global.json b/global.json index 74f79554b..ae5b348d3 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,6 @@ { "sdk": { - "version": "8.0.100-preview.7.23376.3", - "rollForward": "latestMajor", - "allowPrerelease": true + "version": "8.0.100", + "rollForward": "latestMinor" } } \ No newline at end of file diff --git a/src/Web/ClientApp/src/app/web-api-client.ts b/src/Web/ClientApp/src/app/web-api-client.ts index d5025ce74..344241594 100644 --- a/src/Web/ClientApp/src/app/web-api-client.ts +++ b/src/Web/ClientApp/src/app/web-api-client.ts @@ -1,6 +1,6 @@ //---------------------- // -// Generated using the NSwag toolchain v13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v14.0.0.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) // //---------------------- @@ -33,7 +33,7 @@ export class TodoItemsClient implements ITodoItemsClient { constructor(@Inject(HttpClient) http: HttpClient, @Optional() @Inject(API_BASE_URL) baseUrl?: string) { this.http = http; - this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : ""; + this.baseUrl = baseUrl ?? ""; } getTodoItemsWithPagination(listId: number, pageNumber: number, pageSize: number): Observable { @@ -316,7 +316,7 @@ export class TodoListsClient implements ITodoListsClient { constructor(@Inject(HttpClient) http: HttpClient, @Optional() @Inject(API_BASE_URL) baseUrl?: string) { this.http = http; - this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : ""; + this.baseUrl = baseUrl ?? ""; } getTodoLists(): Observable { @@ -533,7 +533,7 @@ export class WeatherForecastsClient implements IWeatherForecastsClient { constructor(@Inject(HttpClient) http: HttpClient, @Optional() @Inject(API_BASE_URL) baseUrl?: string) { this.http = http; - this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : ""; + this.baseUrl = baseUrl ?? ""; } getWeatherForecasts(): Observable { @@ -706,7 +706,7 @@ export interface ITodoItemBriefDto { export class CreateTodoItemCommand implements ICreateTodoItemCommand { listId?: number; - title!: string; + title?: string | undefined; constructor(data?: ICreateTodoItemCommand) { if (data) { @@ -741,12 +741,12 @@ export class CreateTodoItemCommand implements ICreateTodoItemCommand { export interface ICreateTodoItemCommand { listId?: number; - title: string; + title?: string | undefined; } export class UpdateTodoItemCommand implements IUpdateTodoItemCommand { id?: number; - title!: string; + title?: string | undefined; done?: boolean; constructor(data?: IUpdateTodoItemCommand) { @@ -784,7 +784,7 @@ export class UpdateTodoItemCommand implements IUpdateTodoItemCommand { export interface IUpdateTodoItemCommand { id?: number; - title: string; + title?: string | undefined; done?: boolean; } @@ -1052,7 +1052,7 @@ export interface ITodoItemDto { } export class CreateTodoListCommand implements ICreateTodoListCommand { - title!: string; + title?: string | undefined; constructor(data?: ICreateTodoListCommand) { if (data) { @@ -1084,12 +1084,12 @@ export class CreateTodoListCommand implements ICreateTodoListCommand { } export interface ICreateTodoListCommand { - title: string; + title?: string | undefined; } export class UpdateTodoListCommand implements IUpdateTodoListCommand { id?: number; - title!: string; + title?: string | undefined; constructor(data?: IUpdateTodoListCommand) { if (data) { @@ -1124,7 +1124,7 @@ export class UpdateTodoListCommand implements IUpdateTodoListCommand { export interface IUpdateTodoListCommand { id?: number; - title: string; + title?: string | undefined; } export class WeatherForecast implements IWeatherForecast { diff --git a/src/Web/Web.csproj b/src/Web/Web.csproj index eafc97149..b40eced23 100644 --- a/src/Web/Web.csproj +++ b/src/Web/Web.csproj @@ -63,7 +63,7 @@ - + diff --git a/src/Web/config-react.nswag b/src/Web/config-react.nswag index 9e4a9eafa..ca2bafdbc 100644 --- a/src/Web/config-react.nswag +++ b/src/Web/config-react.nswag @@ -1,5 +1,5 @@ { - "runtime": "Net70", + "runtime": "Net80", "defaultVariables": null, "documentGenerator": { "aspNetCoreToOpenApi": { diff --git a/src/Web/config-webapi.nswag b/src/Web/config-webapi.nswag index fd90627a6..e4efbbee8 100644 --- a/src/Web/config-webapi.nswag +++ b/src/Web/config-webapi.nswag @@ -1,5 +1,5 @@ { - "runtime": "Net70", + "runtime": "Net80", "defaultVariables": null, "documentGenerator": { "aspNetCoreToOpenApi": { diff --git a/src/Web/config.nswag b/src/Web/config.nswag index d65ca4def..6ac624776 100644 --- a/src/Web/config.nswag +++ b/src/Web/config.nswag @@ -1,5 +1,5 @@ { - "runtime": "Net70", + "runtime": "Net80", "defaultVariables": null, "documentGenerator": { "aspNetCoreToOpenApi": { diff --git a/src/Web/wwwroot/api/specification.json b/src/Web/wwwroot/api/specification.json index f90c662b6..25393236a 100644 --- a/src/Web/wwwroot/api/specification.json +++ b/src/Web/wwwroot/api/specification.json @@ -1,5 +1,5 @@ { - "x-generator": "NSwag v13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v10.0.0.0))", + "x-generator": "NSwag v14.0.0.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))", "openapi": "3.0.0", "info": { "title": "CleanArchitecture API", @@ -64,7 +64,6 @@ "operationId": "CreateTodoItem", "requestBody": { "x-name": "command", - "description": "", "content": { "application/json": { "schema": { @@ -110,7 +109,6 @@ ], "requestBody": { "x-name": "command", - "description": "", "content": { "application/json": { "schema": { @@ -171,7 +169,6 @@ ], "requestBody": { "x-name": "command", - "description": "", "content": { "application/json": { "schema": { @@ -215,7 +212,6 @@ "operationId": "CreateTodoList", "requestBody": { "x-name": "command", - "description": "", "content": { "application/json": { "schema": { @@ -261,7 +257,6 @@ ], "requestBody": { "x-name": "command", - "description": "", "content": { "application/json": { "schema": { @@ -382,9 +377,6 @@ "CreateTodoItemCommand": { "type": "object", "additionalProperties": false, - "required": [ - "title" - ], "properties": { "listId": { "type": "integer", @@ -392,18 +384,13 @@ }, "title": { "type": "string", - "maxLength": 200, - "minLength": 1, - "nullable": false + "nullable": true } } }, "UpdateTodoItemCommand": { "type": "object", "additionalProperties": false, - "required": [ - "title" - ], "properties": { "id": { "type": "integer", @@ -411,9 +398,7 @@ }, "title": { "type": "string", - "maxLength": 200, - "minLength": 1, - "nullable": false + "nullable": true }, "done": { "type": "boolean" @@ -545,24 +530,16 @@ "CreateTodoListCommand": { "type": "object", "additionalProperties": false, - "required": [ - "title" - ], "properties": { "title": { "type": "string", - "maxLength": 200, - "minLength": 1, - "nullable": false + "nullable": true } } }, "UpdateTodoListCommand": { "type": "object", "additionalProperties": false, - "required": [ - "title" - ], "properties": { "id": { "type": "integer", @@ -570,9 +547,7 @@ }, "title": { "type": "string", - "maxLength": 200, - "minLength": 1, - "nullable": false + "nullable": true } } }, diff --git a/tests/Application.FunctionalTests/Application.FunctionalTests.csproj b/tests/Application.FunctionalTests/Application.FunctionalTests.csproj index c1a27ad2f..06aaeaecd 100644 --- a/tests/Application.FunctionalTests/Application.FunctionalTests.csproj +++ b/tests/Application.FunctionalTests/Application.FunctionalTests.csproj @@ -21,7 +21,10 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Application.UnitTests/Application.UnitTests.csproj b/tests/Application.UnitTests/Application.UnitTests.csproj index b1a14a4c8..3812dff35 100644 --- a/tests/Application.UnitTests/Application.UnitTests.csproj +++ b/tests/Application.UnitTests/Application.UnitTests.csproj @@ -8,7 +8,10 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Domain.UnitTests/Domain.UnitTests.csproj b/tests/Domain.UnitTests/Domain.UnitTests.csproj index aa8f898b9..2f03e561e 100644 --- a/tests/Domain.UnitTests/Domain.UnitTests.csproj +++ b/tests/Domain.UnitTests/Domain.UnitTests.csproj @@ -8,7 +8,10 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Infrastructure.IntegrationTests/Infrastructure.IntegrationTests.csproj b/tests/Infrastructure.IntegrationTests/Infrastructure.IntegrationTests.csproj index e0b419de1..85c5542ea 100644 --- a/tests/Infrastructure.IntegrationTests/Infrastructure.IntegrationTests.csproj +++ b/tests/Infrastructure.IntegrationTests/Infrastructure.IntegrationTests.csproj @@ -9,7 +9,10 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive +