Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Blind-Striker committed Apr 17, 2020
1 parent 5dcd548 commit 3b57af7
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "depedencies/localstack-dotnet-client"]
path = depedencies/localstack-dotnet-client
url = https://github.com/localstack-dotnet/localstack-dotnet-client.git
branch = v0.8.0.163
branch = v1.0.0
Binary file added assets/localstack-dotnet-square.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/localstack-dotnet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 45 additions & 11 deletions build.cake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Diagnostics;
using System.Text.RegularExpressions;
using System.Diagnostics;

var target = Argument("target", "default");
var configuration = Argument("config", "Release");
Expand All @@ -10,7 +10,8 @@ var artifactOutput = "./artifacts";
var testResults = "results.trx";
string projectPath = "./src/LocalStack.AwsLocal/LocalStack.AwsLocal.csproj";

Task("default")

Task("Default")
.IsDependentOn("init")
.IsDependentOn("tests");

Expand All @@ -22,15 +23,21 @@ Task("init")
Arguments = "--info"
});

StartProcess("git", new ProcessSettings {
Arguments = "submodule update --init --recursive"
});

if(IsRunningOnUnix())
{
StartProcess("git", new ProcessSettings {
Arguments = "config --global core.autocrlf true"
});

StartProcess("git", new ProcessSettings {
Arguments = "submodule update --init --recursive"
});

StartProcess("mono", new ProcessSettings {
Arguments = "--version"
});

InstallXUnitNugetPackage();
}
});

Expand Down Expand Up @@ -66,13 +73,18 @@ Task("tests")
foreach(string targetFramework in testProj.TargetFrameworks)
{
Warning($"Running {targetFramework.ToUpper()} tests for {testProj.AssemblyName}");

string testFilePrefix = targetFramework.Replace(".","-");

settings.Framework = targetFramework;
settings.ArgumentCustomization = args => args.Append($" --logger \"trx;LogFileName={testFilePrefix}_{testResults}\"");

DotNetCoreTest(testProjectPath, settings);
if(IsRunningOnUnix() && targetFramework == "net461")
{
RunXunitUsingMono(targetFramework, $"{testProj.DirectoryPath}/bin/{configuration}/{targetFramework}/{testProj.AssemblyName}.dll");
}
else
{
string testFilePrefix = targetFramework.Replace(".","-");
settings.ArgumentCustomization = args => args.Append($" --logger \"trx;LogFileName={testFilePrefix}_{testResults}\"");
DotNetCoreTest(testProjectPath, settings);
}
}
}
});
Expand Down Expand Up @@ -109,6 +121,28 @@ RunTarget(target);
/*
/ HELPER METHODS
*/
private void InstallXUnitNugetPackage()
{
NuGetInstallSettings nugetInstallSettings = new NuGetInstallSettings();
nugetInstallSettings.Version = "2.4.1";
nugetInstallSettings.Verbosity = NuGetVerbosity.Normal;
nugetInstallSettings.OutputDirectory = "testrunner";
nugetInstallSettings.WorkingDirectory = ".";

NuGetInstall("xunit.runner.console", nugetInstallSettings);
}

private void RunXunitUsingMono(string targetFramework, string assemblyPath)
{
int exitCode = StartProcess("mono", new ProcessSettings {
Arguments = $"./testrunner/xunit.runner.console.2.4.1/tools/{targetFramework}/xunit.console.exe {assemblyPath}"
});

if(exitCode != 0)
{
throw new InvalidOperationException($"Exit code: {exitCode}");
}
}

private IList<TestProjMetadata> GetProjMetadata()
{
Expand Down
24 changes: 19 additions & 5 deletions build/azure-pipelines.artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,45 @@ trigger:
- master
- releases/*
- feature/*
paths:
exclude:
- README.md
- CONTRIBUTING.md
- LICENSE
pr: none
pool:
name: Hosted Ubuntu 1604
vmImage: ubuntu-18.04
variables:
Version.MajorMinor: 0.8.1
Version.Revision: $[counter(variables['Version.MajorMinor'], 0)]
steps:
- bash: "sudo apt install nuget && mkdir ./testrunner && sudo chmod -R 777 ./testrunner && ls"
displayName: "Init Task"

- task: UseDotNet@2
displayName: ".NET Core 3.1.x"
inputs:
version: "3.1.x"
packageType: sdk

- task: Bash@3
displayName: "Compile & Tests"
inputs:
targetType: filePath
filePath: ./build.sh

- bash: chmod +x ./build.sh && sudo ./build.sh --target=get-version --buildnumber=$BUILD_ID
- bash: echo $(Version.Revision) && chmod +x ./build.sh && sudo ./build.sh --target=get-version --buildnumber=$BUILD_ID
displayName: "Package Version"
env:
BUILD_ID: $(Build.BuildId)
BUILD_ID: $(Version.Revision)

- bash: chmod +x ./build.sh && sudo ./build.sh --target=nuget-pack --buildnumber=$BUILD_ID
displayName: "Nuget Pack"
env:
BUILD_ID: $(Build.BuildId)
BUILD_ID: $(Version.Revision)

- task: PublishBuildArtifacts@1
displayName: "Publish Artifact: LocalStack.AwsLocal"
inputs:
PathtoPublish: artifacts/
ArtifactName: LocalStack.AwsLocal
ArtifactName: LocalStack.AwsLocal
23 changes: 18 additions & 5 deletions build/azure-pipelines.macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,32 @@ trigger:
include:
- "*"
paths:
include:
- "*"
exclude:
- "**/*.md"
- README.md
- CONTRIBUTING.md
- LICENSE
pr:
branches:
include:
- "*"
schedules:
- cron: "0 12 * * 0"
displayName: Weekly Sunday build
branches:
include:
- master
always: true
pool:
name: Hosted macOS
vmImage: macOS-10.14
steps:
- task: UseDotNet@2
displayName: ".NET Core 3.1.x"
inputs:
version: "3.1.x"
packageType: sdk

- task: Bash@3
displayName: 'Compile & Tests'
displayName: "Compile & Tests"
inputs:
targetType: filePath
filePath: ./build.sh
Expand Down
21 changes: 17 additions & 4 deletions build/azure-pipelines.ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,33 @@ trigger:
include:
- "*"
paths:
include:
- "*"
exclude:
- "**/*.md"
- README.md
- CONTRIBUTING.md
- LICENSE
pr:
branches:
include:
- "*"
schedules:
- cron: "0 12 * * 0"
displayName: Weekly Sunday build
branches:
include:
- master
always: true
pool:
name: Hosted Ubuntu 1604
vmImage: ubuntu-18.04
steps:
- bash: "sudo apt install nuget && mkdir ./testrunner && sudo chmod -R 777 ./testrunner && ls"
displayName: "Init Task"

- task: UseDotNet@2
displayName: ".NET Core 3.1.x"
inputs:
version: "3.1.x"
packageType: sdk

- task: Bash@3
displayName: "Compile & Tests"
inputs:
Expand Down
15 changes: 11 additions & 4 deletions build/azure-pipelines.windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,23 @@ trigger:
include:
- "*"
paths:
include:
- "*"
exclude:
- "**/*.md"
- README.md
- CONTRIBUTING.md
- LICENSE
pr:
branches:
include:
- "*"
schedules:
- cron: "0 12 * * 0"
displayName: Weekly Sunday build
branches:
include:
- master
always: true
pool:
name: Hosted VS2017
vmImage: windows-2019
steps:
- task: PowerShell@2
displayName: "Compile & Tests"
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<Authors>LocalStack.NET, Deniz İrgin</Authors>
<Company>LocalStack.NET</Company>
<Owners>LocalStack.NET</Owners>
<PackageIconUrl>https://raw.githubusercontent.com/localstack-dotnet/localstack-dotnet-client/master/assets/localstack-dotnet-square.png</PackageIconUrl>
<PackageProjectUrl>https://github.com/localstack-dotnet/localstack-awscli-local</PackageProjectUrl>
<PackageIcon>localstack-dotnet-square.png</PackageIcon>
<Version>0.8.0</Version>
</PropertyGroup>
</Project>
5 changes: 3 additions & 2 deletions src/LocalStack.AwsLocal/LocalStack.AwsLocal.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<AssemblyName>LocalStack.AwsLocal</AssemblyName>
<RootNamespace>LocalStack.AwsLocal</RootNamespace>
Expand All @@ -18,7 +18,7 @@
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
</PropertyGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Target Name="PreBuild" AfterTargets="PreBuildEvent">
<ItemGroup>
<LicenseFile Include="../../LICENSE" />
</ItemGroup>
Expand All @@ -29,6 +29,7 @@
<None Include="LICENSE.txt" Pack="true" PackagePath="">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="../../assets/localstack-dotnet-square.png" Pack="true" PackagePath=""/>
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions src/LocalStack.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LocalStack.AwsLocal", "Loca
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{D9F1CEF9-248C-49EA-BD93-5B5E6FD02967}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalStack.AwsLocal.Tests", "..\tests\LocalStack.AwsLocal.Tests\LocalStack.AwsLocal.Tests.csproj", "{5D6C622C-F940-4851-BFD9-B2755641C6D5}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LocalStack.AwsLocal.Tests", "..\tests\LocalStack.AwsLocal.Tests\LocalStack.AwsLocal.Tests.csproj", "{1109B4DD-BD82-4759-981B-6EB1D474A200}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -19,16 +19,16 @@ Global
{D5116356-24F8-4B01-AB33-64CCFC5F0713}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5116356-24F8-4B01-AB33-64CCFC5F0713}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5116356-24F8-4B01-AB33-64CCFC5F0713}.Release|Any CPU.Build.0 = Release|Any CPU
{5D6C622C-F940-4851-BFD9-B2755641C6D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5D6C622C-F940-4851-BFD9-B2755641C6D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5D6C622C-F940-4851-BFD9-B2755641C6D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5D6C622C-F940-4851-BFD9-B2755641C6D5}.Release|Any CPU.Build.0 = Release|Any CPU
{1109B4DD-BD82-4759-981B-6EB1D474A200}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1109B4DD-BD82-4759-981B-6EB1D474A200}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1109B4DD-BD82-4759-981B-6EB1D474A200}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1109B4DD-BD82-4759-981B-6EB1D474A200}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{5D6C622C-F940-4851-BFD9-B2755641C6D5} = {D9F1CEF9-248C-49EA-BD93-5B5E6FD02967}
{1109B4DD-BD82-4759-981B-6EB1D474A200} = {D9F1CEF9-248C-49EA-BD93-5B5E6FD02967}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {479893D2-EC31-4B10-8F7C-DDA704071C4D}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>

<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<LangVersion>latest</LangVersion>
</PropertyGroup>


<ItemGroup>
<PackageReference Include="AWSSDK.Core" Version="3.3.101.11" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" />
<PackageReference Include="Moq" Version="4.10.1" />
<PackageReference Include="AWSSDK.Core" Version="3.3.106.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
<PackageReference Include="xunit.runner.console" Version="2.4.1">
Expand Down

0 comments on commit 3b57af7

Please sign in to comment.