Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to GitHub Actions and Azure App Service.net + .NET and dependency updates #97

Merged
merged 4 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions .github/workflows/build-and-stage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Build and stage
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_VERSION: '8.0'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
checks: write
contents: read
statuses: write

jobs:
build:
name: Build and publish app
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.

- name: Set up .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Set up dependency caching for faster builds
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: dotnet restore
run: dotnet restore

- name: dotnet build
run: dotnet build --no-restore /p:TreatWarningsAsErrors=True

- name: dotnet test
run: dotnet test --logger trx --results-directory "${{ runner.temp }}" --no-build

- name: dotnet test
uses: NasAmin/[email protected]
with:
TRX_PATH: "${{ runner.temp }}"
REPO_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

- name: dotnet publish
run: dotnet publish src/InitializrService/Steeltoe.InitializrService.csproj -o publish

- name: Upload artifact for deployment job
if: ${{ github.event_name != 'pull_request' }}
uses: actions/upload-artifact@v4
with:
name: published-app
path: publish

deploy:
name: Deploy
environment: production
needs:
- build
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: published-app

- name: Log into Azure CLI with service principal
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: ${{ vars.AZURE_WEBAPP_NAME }}
package: '.'
slot-name: 'production'
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ obj/

# JetBrains Rider state
/.idea/

# code coverage
coverage*.*
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project>

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Condition="!Exists('packages.config')">
<Version>3.4.*</Version>
<Version>3.6.*</Version>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
WORKDIR /source

COPY . .
RUN dotnet restore
RUN dotnet publish -c release -o /srv --no-restore

FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine
WORKDIR /srv
RUN apk add bash
RUN curl https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh > wait-for-it \
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

Steeltoe Initializr Service reference implementation

[![Build Status](https://dev.azure.com/SteeltoeOSS/Steeltoe/_apis/build/status/Initializr/SteeltoeOSS.InitializrService?branchName=main)](https://dev.azure.com/SteeltoeOSS/Steeltoe/_build/latest?definitionId=31&branchName=main)

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=InitializrService&metric=alert_status)](https://sonarcloud.io/dashboard?id=InitializrService)

## Using the Server

_InitializrService_ provides 4 REST/HTTP endpoints:

* `api/`
* `api/about`
* `api/config`
Expand Down Expand Up @@ -58,6 +55,7 @@ The returned document includes _all_ configuration. Sub-endpoints are availabl
`api/config/projectMetadata` can be used by smart clients, such as [_InitializrWeb_](https://github.com/SteeltoeOSS/InitializrWeb), to assist in creating user interfaces.

The following endpoints can be used by CLI users to determine what project configuration options are available:

* `api/config/archiveTypes`
* `api/config/dependencies`
* `api/config/dotNetFrameworks`
Expand Down Expand Up @@ -125,13 +123,13 @@ $ http https://start.steeltoe.io/api/project dotNetFramework=netcoreapp3.1 depen
The Initializr API configuration is a JSON document provided by a [Spring Cloud Config Server](https://cloud.spring.io/spring-cloud-config/multi/multi__spring_cloud_config_server.html) or a local file.
The former is recommended for production deployments; the latter is intended primarily for local development.


### Using Spring Cloud Config Server

The Initializr API uses the [Steeltoe Config Server Provider](https://docs.steeltoe.io/api/v3/configuration/config-server-provider.html) to get configuration from a Spring Cloud Config Server.

The _InitializrAPI_ running at https://start.steeltoe.io/api/ uses a Spring Cloud Config Server backended at https://github.com/SteeltoeOSS/InitializrConfig.
The _InitializrAPI_ running at <https://start.steeltoe.io/api/> uses a Spring Cloud Config Server backended at <https://github.com/SteeltoeOSS/InitializrConfig>.
The following `appsettings.json` sample snippet is part of the _InitializrService_'s configuration:

```json
...,
"spring": {
Expand All @@ -155,6 +153,7 @@ See the Steeltoe Config Server Provider documentation for other configuration op
_**Note**_: configuring a local file overrides any Spring Cloud Config Server configuration

The following `appsettings.json` sample snippet configures the use of a local configuration file:

```json
...,
"Initializr": {
Expand Down
47 changes: 28 additions & 19 deletions Steeltoe.InitializrService.sln
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30320.27
# Visual Studio Version 17
VisualStudioVersion = 17.9.34414.90
MinimumVisualStudioVersion = 15.0.26124.0
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Steeltoe.InitializrService", "src\InitializrService\Steeltoe.InitializrService.csproj", "{7597F74D-528E-448B-BBE8-994092F04CA4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Steeltoe.InitializrService.Config", "src\InitializrService.Config\Steeltoe.InitializrService.Config.csproj", "{ACE6FEE1-9CEA-4A95-9D76-C62A41947C8F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Steeltoe.InitializrService.Test.Utils", "test\InitializrService.Test.Utils\Steeltoe.InitializrService.Test.Utils.csproj", "{EC08DC14-11D5-40D3-8908-BDB0D789F48D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Steeltoe.InitializrService.Test.Utils", "test\InitializrService.Test.Utils\Steeltoe.InitializrService.Test.Utils.csproj", "{EC08DC14-11D5-40D3-8908-BDB0D789F48D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Steeltoe.InitializrService.Test.Unit", "test\InitializrService.Test.Unit\Steeltoe.InitializrService.Test.Unit.csproj", "{EA849C8F-7118-45DB-BBF2-D36CE1FD43B4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Steeltoe.InitializrService.Test.Integration", "test\InitializrService.Test.Integration\Steeltoe.InitializrService.Test.Integration.csproj", "{24A2AB13-F4C4-4C88-B67D-D280610240B8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Steeltoe.InitializrService.Test.Integration", "test\InitializrService.Test.Integration\Steeltoe.InitializrService.Test.Integration.csproj", "{24A2AB13-F4C4-4C88-B67D-D280610240B8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F80B44AC-7383-40DA-B353-16163BF279F1}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
azure-pipelines.yaml = azure-pipelines.yaml
codecov.yml = codecov.yml
Directory.Build.props = Directory.Build.props
docker-compose.yaml = docker-compose.yaml
Dockerfile = Dockerfile
Steeltoe.InitializrService.sln.DotSettings = Steeltoe.InitializrService.sln.DotSettings
LICENSE = LICENSE
README.md = README.md
Steeltoe.InitializrService.sln.DotSettings = Steeltoe.InitializrService.sln.DotSettings
stylecop.json = stylecop.json
Version.props = Version.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{51C72D02-A6C4-48EA-B735-EAE2CEDE69CC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{3B483F2E-42EE-4DE5-84B6-92F0D09D94FD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -62,6 +64,18 @@ Global
{ACE6FEE1-9CEA-4A95-9D76-C62A41947C8F}.Release|x64.Build.0 = Release|Any CPU
{ACE6FEE1-9CEA-4A95-9D76-C62A41947C8F}.Release|x86.ActiveCfg = Release|Any CPU
{ACE6FEE1-9CEA-4A95-9D76-C62A41947C8F}.Release|x86.Build.0 = Release|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Debug|x64.ActiveCfg = Debug|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Debug|x64.Build.0 = Debug|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Debug|x86.ActiveCfg = Debug|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Debug|x86.Build.0 = Debug|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Release|Any CPU.Build.0 = Release|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Release|x64.ActiveCfg = Release|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Release|x64.Build.0 = Release|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Release|x86.ActiveCfg = Release|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Release|x86.Build.0 = Release|Any CPU
{EA849C8F-7118-45DB-BBF2-D36CE1FD43B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EA849C8F-7118-45DB-BBF2-D36CE1FD43B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA849C8F-7118-45DB-BBF2-D36CE1FD43B4}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand All @@ -86,22 +100,17 @@ Global
{24A2AB13-F4C4-4C88-B67D-D280610240B8}.Release|x64.Build.0 = Release|Any CPU
{24A2AB13-F4C4-4C88-B67D-D280610240B8}.Release|x86.ActiveCfg = Release|Any CPU
{24A2AB13-F4C4-4C88-B67D-D280610240B8}.Release|x86.Build.0 = Release|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Debug|x64.ActiveCfg = Debug|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Debug|x64.Build.0 = Debug|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Debug|x86.ActiveCfg = Debug|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Debug|x86.Build.0 = Debug|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Release|Any CPU.Build.0 = Release|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Release|x64.ActiveCfg = Release|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Release|x64.Build.0 = Release|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Release|x86.ActiveCfg = Release|Any CPU
{EC08DC14-11D5-40D3-8908-BDB0D789F48D}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{7597F74D-528E-448B-BBE8-994092F04CA4} = {51C72D02-A6C4-48EA-B735-EAE2CEDE69CC}
{ACE6FEE1-9CEA-4A95-9D76-C62A41947C8F} = {51C72D02-A6C4-48EA-B735-EAE2CEDE69CC}
{EC08DC14-11D5-40D3-8908-BDB0D789F48D} = {3B483F2E-42EE-4DE5-84B6-92F0D09D94FD}
{EA849C8F-7118-45DB-BBF2-D36CE1FD43B4} = {3B483F2E-42EE-4DE5-84B6-92F0D09D94FD}
{24A2AB13-F4C4-4C88-B67D-D280610240B8} = {3B483F2E-42EE-4DE5-84B6-92F0D09D94FD}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F773FB5B-7619-4DA7-AA07-919DA1A5181C}
EndGlobalSection
Expand Down
3 changes: 2 additions & 1 deletion Steeltoe.InitializrService.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002ECodeCleanup_002EFileHeader_002EFileHeaderSettingsMigrate/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Initializr/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Steeltoe/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">Licensed to the .NET Foundation under one or more agreements.
Expand Down
2 changes: 1 addition & 1 deletion Version.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>

<PropertyGroup>
<GoogleAnalyticsTrackerVersion>6.0.7</GoogleAnalyticsTrackerVersion>
<GoogleAnalyticsTrackerVersion>7.0.1</GoogleAnalyticsTrackerVersion>
<SteeltoeVersion>3.2.*</SteeltoeVersion>
<YamlDotNetVersion>8.1.2</YamlDotNetVersion>
</PropertyGroup>
Expand Down
Loading
Loading