From e9c7e7114e7936e38389074f1b5005e4b27a0e8e Mon Sep 17 00:00:00 2001 From: Tim Heuer Date: Fri, 3 Jul 2020 09:30:16 -0700 Subject: [PATCH] Adding CI and fixing up a readme (#1) * Adding some initial deploy assets * modifying readme and package ref for validation * Attempting to fix arm location ***NO_CI*** * Adding back location * Fixing deploy template --- .devcontainer/devcontainer.json | 6 +++ .github/workflows/build-CI.yml | 30 ++++++++++++++ .vscode/launch.json | 29 +++++++++++++ .vscode/tasks.json | 42 +++++++++++++++++++ Client/CarChecker.Client.csproj | 6 +-- README.md | 24 +++++++++++ deploy.json | 73 +++++++++++++++++++++++++++++++++ deploy.parameters.json | 9 ++++ nuget.config | 11 ----- 9 files changed, 216 insertions(+), 14 deletions(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .github/workflows/build-CI.yml create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json create mode 100644 README.md create mode 100644 deploy.json create mode 100644 deploy.parameters.json delete mode 100644 nuget.config diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..ab619c4 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,6 @@ +{ + "extensions": [ + "ms-vscode.csharp", + "formulahendry.dotnet-test-explorer" + ] + } \ No newline at end of file diff --git a/.github/workflows/build-CI.yml b/.github/workflows/build-CI.yml new file mode 100644 index 0000000..b98301a --- /dev/null +++ b/.github/workflows/build-CI.yml @@ -0,0 +1,30 @@ +name: Build Blazor App + +on: [push, pull_request] + +jobs: + build: + if: github.event_name == 'push' && contains(toJson(github.event.commits), '***NO_CI***') == false && contains(toJson(github.event.commits), '[ci skip]') == false && contains(toJson(github.event.commits), '[skip ci]') == false + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.300 + + - name: Restore + run: dotnet restore + + - name: Build with dotnet + run: dotnet build --configuration Release --no-restore + + - name: Publish with dotnet + run: dotnet publish --configuration Release -o published_app --no-build + + - name: Publish artifacts + uses: actions/upload-artifact@v2 + with: + name: webapp + path: published_app diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..9ae60e4 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,29 @@ +{ + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "version": "0.2.0", + "configurations": [ + { + "name": ".NET Core Launch (Blazor Standalone)", + "type": "coreclr", + "request": "launch", + "program": "dotnet", + "args": ["run"], + "cwd": "${workspaceFolder}/Server", + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + { + "name": ".NET Core Debug Blazor Web Assembly in Chrome", + "type": "pwa-chrome", + "request": "launch", + "timeout": 30000, + // If you have changed the default port / launch URL make sure to update the expectation below + "url": "https://localhost:5001", + "webRoot": "${workspaceFolder}/Server", + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..b362881 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,42 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/Server/CarChecker.Server.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/Server/CarChecker.Server.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/Server/CarChecker.Server.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/Client/CarChecker.Client.csproj b/Client/CarChecker.Client.csproj index a4b3c36..cab4ef0 100644 --- a/Client/CarChecker.Client.csproj +++ b/Client/CarChecker.Client.csproj @@ -9,13 +9,13 @@ - + - - + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..24bb567 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# CarChecker - a Blazor sample app +This is a sample application for [Blazor](https://blazor.net) which was presented at Build 2020. You can view the on-demand walk-through for this on Channel 9: [Modern Web UI with Blazor WebAssembly](https://aka.ms/blazor-in-action). + +To use this it's best to have Visual Studio 2019 and the latest .NET SDK for the Blazor release which you can read about here: [Blazor WebAssembly 3.2.0 now available](https://devblogs.microsoft.com/aspnet/blazor-webassembly-3-2-0-now-available/). + +## What this sample has: +This is a great sample which has a lot of Blazor + ASP.NET integrations such as: +- client-side debugging with Visual Studio +- Authentication / Authorization +- input validation +- data integration/sync +- Blazor components +- code sharing +- JavaScript interop +- Localization / internationalization +- Progressive Web App (PWA) + +## Deploy to Azure +You can create the resource (Free SKU App Service) in Azure quickly by clicking below and then can use Visual Studio to select the App Service and deploy the code to it later. + +[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Ftimheuer%2FCarChecker%2Fmaster%2Fdeploy.json) + +### Remarks +This sample makes use of a preview package for Validation. \ No newline at end of file diff --git a/deploy.json b/deploy.json new file mode 100644 index 0000000..acb709f --- /dev/null +++ b/deploy.json @@ -0,0 +1,73 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "webAppName": { + "type": "string", + "defaultValue": "[concat('BlazorApp-', uniqueString(resourceGroup().id))]", + "metadata":{ + "description": "That name is the name of our application. It has to be unique. Type a name followed by your resource group name. (-)" + } + }, + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata":{ + "description": "Location for all resources." + } + } + }, + "variables": { + "alwaysOn": false, + "sku": "Free", + "skuCode": "F1", + "workerSize": "0", + "workerSizeId": 0, + "numberOfWorkers": "1", + "currentStack": "dotnetcore", + "netFrameworkVersion": "v4.0", + "hostingPlanName": "[concat('hpn-', resourceGroup().name)]" + }, + "resources": [ + { + "apiVersion": "2018-02-01", + "name": "[parameters('webAppName')]", + "type": "Microsoft.Web/sites", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Web/serverfarms/', variables('hostingPlanName'))]" + ], + "properties": { + "name": "[parameters('webAppName')]", + "siteConfig": { + "metadata": [ + { + "name": "CURRENT_STACK", + "value": "[variables('currentStack')]" + } + ], + "netFrameworkVersion": "[variables('netFrameworkVersion')]", + "alwaysOn": "[variables('alwaysOn')]" + }, + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]", + "clientAffinityEnabled": true + } + }, + { + "apiVersion": "2018-02-01", + "name": "[variables('hostingPlanName')]", + "type": "Microsoft.Web/serverfarms", + "location": "[parameters('location')]", + "properties": { + "name": "[variables('hostingPlanName')]", + "workerSize": "[variables('workerSize')]", + "workerSizeId": "[variables('workerSizeId')]", + "numberOfWorkers": "[variables('numberOfWorkers')]" + }, + "sku": { + "Tier": "[variables('sku')]", + "Name": "[variables('skuCode')]" + } + } + ] +} \ No newline at end of file diff --git a/deploy.parameters.json b/deploy.parameters.json new file mode 100644 index 0000000..ae0841e --- /dev/null +++ b/deploy.parameters.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "webAppName": { + "value": "GEN-UNIQUE" + } + } +} \ No newline at end of file diff --git a/nuget.config b/nuget.config deleted file mode 100644 index 8d6e3a2..0000000 --- a/nuget.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - -