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

Refactor and adjust CircleCi build #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
93 changes: 83 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,94 @@
version: 2.1

jobs:
pack-and-publish-nuget:
docker:
- image: mcr.microsoft.com/dotnet/sdk:3.1
parameters:
template-path:
description: Path of the template Project that needs building
type: string
nuget-output-path:
description: Output location of Nuget NUPKG
type: string
default: nupk_output
pre-release:
description: Is Pre-release?
type: boolean
default: true
steps:
- run:
if [ -z "$CIRCLE_TAG" ]
then
echo "No Git tag present, will do nothing"
else
VERSION_SUFFIX_TIMESTAMP="$(date '+%Y%m%d%H%M%S')"
VERSION="${CIRCLE_TAG//v/}"
dotnet pack -c Release --no-build -p:PackageVersion=$VERSION<<#parameters.pre-release>>-beta.$VERSION_SUFFIX_TIMESTAMP<</parameters.pre-release>> -o ./<<parameters.nuget-output-path>> <<parameters.template-path>>
for f in ./<<parameters.nuget-output-path>>/*.nupkg; do dotnet nuget push $f -s https://www.myget.org/F/unidays-release/api/v2/package -k $NUGET_APIKEY; done
fi

build-templates:
docker:
- image: unidays/dotnet-core-sdk-nuget:2.2
- image: mcr.microsoft.com/dotnet/sdk:3.1
parameters:
template-path:
description: Path of Project/Solution that houses the templates
type: string
workspace_root:
type: string
default: .
steps:
- checkout
- run:
name: Build and test templates
command: dotnet test -c Release
name: Create Environment
command: |
cd << parameters.workspace_root >>
dotnet tool install --tool-path . trx2junit
- run:
name: Package templates
command: nuget pack ./UD.Lambda.Templates.nuspec
name: Build and test
working_directory: << parameters.workspace_root >>
command: |
dotnet build << parameters.template-path >> -c Release
dotnet test -c Release -l trx -r ./artifacts
- persist_to_workspace:
root: << parameters.workspace_root >>
paths:
- << parameters.template-path >>
- obj
- bin
- run:
name: Push package to MyGet
command: find . -iname "*.nupkg" -exec dotnet nuget push '{}' -s https://www.myget.org/F/unidays-release/api/v2/package -k $MYGET_API_KEY \;
name: Convert test results
working_directory: << parameters.workspace_root >>
command: ./trx2junit ./artifacts/*.trx
when: always
- store_test_results:
path: << parameters.workspace_root >>/artifacts/

workflows:
version: 2
build-publish:
version: 2.1
build-templates-prerelease:
jobs:
- build-templates:
template-path: UD.Lambda.Templates.csproj
filters:
branches:
ignore: master
- pack-and-publish-nuget:
template-path: UD.Lambda.Templates.csproj
pre-release: true
requires:
- build-templates

build-templates-release:
jobs:
- build-templates
- build-templates:
template-path: UD.Lambda.Templates.csproj
filters:
branches:
only: master
- pack-and-publish-nuget:
template-path: UD.Lambda.Templates.csproj
pre-release: false
requires:
- build-templates
14 changes: 0 additions & 14 deletions Dockerfile

This file was deleted.

31 changes: 31 additions & 0 deletions UD.Lambda.Templates.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<PackageType>Template</PackageType>
<PackageVersion>1.0</PackageVersion>
<PackageId>UD.AWS.Lambda.Templates</PackageId>
<Title>UNiDAYS AWS Lambda Templates</Title>
<Authors>UNiDAYS</Authors>
<Description>UNiDAYS AWS Lambda Templates</Description>
<PackageTags>dotnet-new;templates;contoso</PackageTags>

<TargetFramework>netstandard2.1</TargetFramework>

<IncludeContentInPack>true</IncludeContentInPack>
<IncludeBuildOutput>false</IncludeBuildOutput>
<ContentTargetFolders>content</ContentTargetFolders>
<NoWarn>$(NoWarn);NU5128</NoWarn>
</PropertyGroup>

<ItemGroup>
<Content Include="templates\**\*" Exclude="templates\**\bin\**;templates\**\obj\**" />
<Compile Remove="**\*" />
</ItemGroup>

<ItemGroup>
<None Remove=".editorconfig" />
<None Remove="Dockerfile" />
<None Remove=".gitignore" />
</ItemGroup>

</Project>
18 changes: 0 additions & 18 deletions UD.Lambda.Templates.nuspec

This file was deleted.

15 changes: 6 additions & 9 deletions UD.Lambda.Templates.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.421
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{08E96C36-CDEE-45F3-BB50-8DE04E5A8C58}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "templates", "templates", "{F384A961-D8B7-4E95-A949-3E7302F90886}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LambdaFunction", "LambdaFunction", "{DC74BE0A-8629-45CF-A7AA-476CF7C737F1}"
Expand All @@ -20,8 +18,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{B54E5C78-9
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionProject.Tests", "templates\LambdaFunction\test\FunctionProject.Tests\FunctionProject.Tests.csproj", "{21F2D09D-D998-4B4D-9380-1F7EC59A6BD4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UD.Lambda.Templates", "build\UD.Lambda.Templates.csproj", "{6192DFD1-5A71-46F8-9D22-FA0CD342CBD7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ApiFunction", "ApiFunction", "{711205CA-D423-4C35-9AA3-F980D0ED36CA}"
ProjectSection(SolutionItems) = preProject
templates\ApiFunction\.template.config\template.json = templates\ApiFunction\.template.config\template.json
Expand All @@ -35,6 +31,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionProject", "template
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionProject.Tests", "templates\ApiFunction\test\FunctionProject.Tests\FunctionProject.Tests.csproj", "{F2B2B0EA-348D-4166-982F-D98BEB2A5135}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UD.Lambda.Templates", "UD.Lambda.Templates.csproj", "{B649AF74-EFA7-4F3C-8C77-4366C887A33B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -49,10 +47,6 @@ Global
{21F2D09D-D998-4B4D-9380-1F7EC59A6BD4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{21F2D09D-D998-4B4D-9380-1F7EC59A6BD4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{21F2D09D-D998-4B4D-9380-1F7EC59A6BD4}.Release|Any CPU.Build.0 = Release|Any CPU
{6192DFD1-5A71-46F8-9D22-FA0CD342CBD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6192DFD1-5A71-46F8-9D22-FA0CD342CBD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6192DFD1-5A71-46F8-9D22-FA0CD342CBD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6192DFD1-5A71-46F8-9D22-FA0CD342CBD7}.Release|Any CPU.Build.0 = Release|Any CPU
{301BDD24-C417-4648-88C9-D4FF410CC834}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{301BDD24-C417-4648-88C9-D4FF410CC834}.Debug|Any CPU.Build.0 = Debug|Any CPU
{301BDD24-C417-4648-88C9-D4FF410CC834}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -61,6 +55,10 @@ Global
{F2B2B0EA-348D-4166-982F-D98BEB2A5135}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F2B2B0EA-348D-4166-982F-D98BEB2A5135}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F2B2B0EA-348D-4166-982F-D98BEB2A5135}.Release|Any CPU.Build.0 = Release|Any CPU
{B649AF74-EFA7-4F3C-8C77-4366C887A33B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B649AF74-EFA7-4F3C-8C77-4366C887A33B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B649AF74-EFA7-4F3C-8C77-4366C887A33B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B649AF74-EFA7-4F3C-8C77-4366C887A33B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -71,7 +69,6 @@ Global
{D5680F23-8678-4D57-8F26-25F64FF63009} = {BB552E0C-24AE-48A3-8370-BC3718AF31B2}
{B54E5C78-933E-4BD3-B619-67F34D358398} = {DC74BE0A-8629-45CF-A7AA-476CF7C737F1}
{21F2D09D-D998-4B4D-9380-1F7EC59A6BD4} = {B54E5C78-933E-4BD3-B619-67F34D358398}
{6192DFD1-5A71-46F8-9D22-FA0CD342CBD7} = {08E96C36-CDEE-45F3-BB50-8DE04E5A8C58}
{711205CA-D423-4C35-9AA3-F980D0ED36CA} = {F384A961-D8B7-4E95-A949-3E7302F90886}
{779D8E98-30A3-419E-B2A5-EE93E0854C46} = {711205CA-D423-4C35-9AA3-F980D0ED36CA}
{98E30D9E-FF89-4095-A25C-5CC3FFDD84AB} = {711205CA-D423-4C35-9AA3-F980D0ED36CA}
Expand Down
24 changes: 0 additions & 24 deletions build/UD.Lambda.Templates.csproj

This file was deleted.

6 changes: 3 additions & 3 deletions templates/ApiFunction/.template.config/template.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"$schema": "http://json.schemastore.org/template",
"author": "UD",
"author": "UNiDAYS",
"classifications": [
"AWS",
"Lambda",
"Function"
],
"name": "Api Function",
"name": "API Function",
"identity": "UD.Lambda.Template.ApiFunction",
"groupIdentity": "UD.Lambda.Template.ApiFunction.CSharp",
"shortName": "ud.ApiFunction",
"shortName": "UD.ApiFunction",
"tags": {
"language": "C#",
"type": "project"
Expand Down
22 changes: 11 additions & 11 deletions templates/ApiFunction/src/FunctionProject/FunctionProject.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifiers>linux-x64</RuntimeIdentifiers>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AWSProjectType>Lambda</AWSProjectType>
Expand All @@ -12,16 +12,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="1.2.0" />
<PackageReference Include="Amazon.Lambda.Core" Version="1.1.0" />
<PackageReference Include="Amazon.Lambda.Logging.AspNetCore" Version="2.2.0" />
<PackageReference Include="Amazon.Lambda.Serialization.Json" Version="1.5.0" />
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.3.6" />
<PackageReference Include="Kralizek.Lambda.Template" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.2.0" />
<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="2.4.0" />
<PackageReference Include="Amazon.Lambda.Core" Version="2.0.0" />
<PackageReference Include="Amazon.Lambda.Logging.AspNetCore" Version="3.1.0" />
<PackageReference Include="Amazon.Lambda.Serialization.Json" Version="2.0.0" />
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.7.0.1" />
<PackageReference Include="Kralizek.Lambda.Template" Version="4.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.1.16" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.16" />
<PackageReference Include="Microsoft.Extensions.Http" Version="3.1.16" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.1.16" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>8</LangVersion>
<OutputType>Library</OutputType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="1.1.0" />
<PackageReference Include="Amazon.Lambda.TestUtilities" Version="1.1.0" />
<PackageReference Include="Amazon.Lambda.SQSEvents" Version="1.1.0" />
<PackageReference Include="FluentAssertions" Version="5.5.3" />
<PackageReference Include="Amazon.Lambda.Core" Version="2.0.0" />
<PackageReference Include="Amazon.Lambda.TestUtilities" Version="2.0.0" />
<PackageReference Include="Amazon.Lambda.SQSEvents" Version="2.0.0" />
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="NSubstitute" Version="3.1.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion templates/LambdaFunction/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"name": "Lambda Function",
"identity": "UD.Lambda.Template.LambdaFunction",
"groupIdentity": "UD.Lambda.Template.LambdaFunction.CSharp",
"shortName": "ud.LambdaFunction",
"shortName": "UD.LambdaFunction",
"tags": {
"language": "C#",
"type": "project"
Expand Down
26 changes: 13 additions & 13 deletions templates/LambdaFunction/src/FunctionProject/FunctionProject.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifiers>linux-x64</RuntimeIdentifiers>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AWSProjectType>Lambda</AWSProjectType>
Expand All @@ -12,16 +12,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="1.1.0" />
<PackageReference Include="Amazon.Lambda.Logging.AspNetCore" Version="2.2.0" />
<PackageReference Include="Amazon.Lambda.Serialization.Json" Version="1.5.0" />
<PackageReference Include="Amazon.Lambda.SQSEvents" Version="1.1.0" />
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.3.6" />
<PackageReference Include="Kralizek.Lambda.Template" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.2.0" />
<PackageReference Include="Amazon.Lambda.Core" Version="2.0.0" />
<PackageReference Include="Amazon.Lambda.Logging.AspNetCore" Version="3.1.0" />
<PackageReference Include="Amazon.Lambda.Serialization.Json" Version="2.0.0" />
<PackageReference Include="Amazon.Lambda.SQSEvents" Version="2.0.0" />
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.7.0.1" />
<PackageReference Include="Kralizek.Lambda.Template" Version="4.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.1.16" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.16" />
<PackageReference Include="Microsoft.Extensions.Http" Version="3.1.16" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.1.16" />
</ItemGroup>

<ItemGroup>
Expand All @@ -33,4 +33,4 @@
</Content>
</ItemGroup>

</Project>
</Project>
Loading