Skip to content

Commit a6ff724

Browse files
fle-bachNicolas ERNY
authored and
Nicolas ERNY
committed
Test Intergration with a console app who use an ApiReactive (#91)
* add directory .circle and file config.yml * XCOMP-1299: Add link for test with circleci * XCOMP-1299: passed travis to circleci * XCOMP-1299: Add right cmd in config.yml * add directory with integration tests * Test: add new integration test hello world with reactiveapi * add task CrossPlateformBuild * delete task crossplatformbuild, add functions in utilities.cake * add new task dependence * views ls config * delete ./ for path to test * add save in cache and persist_to_workspace * add tab requires * add info path restore and generate * path save docker * test * comment XCRuntime.zip * add isdepend task * add new file NuGet.Config * rename directory Projets to Projects * add compile projet helloWorld * delete start reactive * add -addin Cake.XComponent- * order depend task * cake component dll * version filehelpers * addin neget package Cake * back up * cut test integration * up .net Framework 6.1 and add Cake.Xcomponent reference * delete reference Cake.Xcomponent * delete Nuget.config unused * build.cake: add dll reactiveApi - utilities.cake: delete function unused - .csproj: add reference reactiveApi * modif helloworld exercice * delete generate directory * delete directory xcassemblies - add buildHelloWorld in build.cake and task clean tmp files * change debug to Release * addin NUnit update * .zip XCruntime * .zip XCruntime corrected -/- * copy XCruntime Dockerfile * HelloWorldDeployement.xml config rabbitmq server * reference .cake for rabbitmq (merge) * Update README.md * resolve comment PR - wixVersion,distrubition,iscommunityedition unused - badge xcomponent * delete code unused #break * delete directory and files autogenerate and modif .gitignore for tools folder * delete folder auto-generate and modif .gitignore for ignore this folder * add info .zip don't push * delete folder Scripts generate by Xcomponent and add in .gitignore * rename cache yml circleci and optimise restore nugetPackage
1 parent ef71fb7 commit a6ff724

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2247
-32
lines changed

.circleci/config.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
version: 2
2+
references:
3+
restore_repo: &restore_repo
4+
restore_cache:
5+
name: Restore checked out code
6+
keys:
7+
- v1-reactivexcomponent-net-repo-{{ .Branch }}-{{ .Revision }}
8+
- v1-reactivexcomponent-net-repo-{{ .Branch }}-
9+
- v1-reactivexcomponent-net-repo-
10+
11+
restore_nuget: &restore_nuget
12+
restore_cache:
13+
name: Restore nuget cache
14+
keys:
15+
- v1-nuget-{{ .Branch }}-{{ checksum "shasum.tmp" }}
16+
- v1-nuget-{{ .Branch }}-
17+
- v1-nuget-
18+
19+
generate_nuget_shasum: &generate_nuget_shasum
20+
run:
21+
name: Generate cache shasum
22+
command: find . -name "packages.config" -exec shasum {} \+ | sort -n > shasum.tmp
23+
24+
save_nuget: &save_nuget
25+
save_cache:
26+
name: Save nuget cache
27+
key: v1-nuget-{{ .Branch }}-{{ checksum "shasum.tmp" }}
28+
paths:
29+
- /home/circleci/.nuget
30+
31+
jobs:
32+
checkout_code:
33+
docker:
34+
- image: circleci/node:10.12
35+
steps:
36+
- *restore_repo
37+
- checkout
38+
- save_cache:
39+
key: v1-reactivexcomponent-net-repo-{{ .Branch }}-{{ .Revision }}
40+
paths:
41+
- .
42+
43+
build_sh_reactiveapi:
44+
docker:
45+
- image: xcomponent/mono-git:1.3.0
46+
steps:
47+
- *restore_repo
48+
- *generate_nuget_shasum
49+
- *restore_nuget
50+
- run:
51+
name: ReactiveApi - Build All
52+
command: ./build.sh -t All
53+
- run:
54+
name: ReactiveApi - Build BuildIntegrationTests
55+
command: ./build.sh -t BuildIntegrationTests
56+
- run:
57+
name: ReactiveApi - Build PackageDockerIntegrationTests
58+
command: ./build.sh -t PackageDockerIntegrationTests
59+
- *save_nuget
60+
- persist_to_workspace:
61+
root: /home/circleci/project
62+
paths:
63+
- docker
64+
reactiveapi_integrationtests:
65+
docker:
66+
- image: circleci/node:10.12
67+
steps:
68+
- setup_remote_docker
69+
- *restore_repo
70+
- attach_workspace:
71+
at: /home/circleci/project
72+
- run:
73+
name: Run docker compose for reactiveapi integration tests
74+
command: |
75+
cd ./docker/integration_tests/dockerScripts
76+
docker-compose -f ./docker-compose-reactiveapi.yml up --exit-code-from clientapp
77+
78+
workflows:
79+
version: 2
80+
xcomponent_reactive_api:
81+
jobs:
82+
- checkout_code
83+
- build_sh_reactiveapi:
84+
requires:
85+
- checkout_code
86+
- reactiveapi_integrationtests:
87+
requires:
88+
- build_sh_reactiveapi

.gitignore

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ x86/
2020
bld/
2121
[Bb]in/
2222
[Oo]bj/
23+
[Ll]ib/
2324

2425
# Visual Studio 2015 cache/options directory
2526
.vs/
@@ -239,14 +240,7 @@ _Pvt_Extensions
239240
.fake/
240241

241242
# Cake - C# Make
242-
tools/Addins
243-
tools/Cake
244-
tools/Cake.XComponent
245-
tools/NUnit.Runners*
246-
tools/XComponent.MSBuild.Tasks
247-
tools/nuget.exe
248-
tools/packages.config.md5sum
249-
tools/ILRepack
243+
tools
250244

251245
# Test Results
252246
TestResults.xml
@@ -256,3 +250,15 @@ nuget/
256250

257251
# Merging assemblies
258252
packaging/
253+
254+
# Build.cake .zip generated
255+
**/*.zip
256+
257+
# XComponent generated stuff
258+
**/xcassemblies
259+
docker/integration_tests/XCProjects/HelloWorldV5/Scripts
260+
docker/integration_tests/XCProjects/HelloWorldV5/generated
261+
docker/integration_tests/XCProjects/HelloWorldV5/*/Common
262+
docker/integration_tests/XCProjects/HelloWorldV5/*/StateMachine
263+
docker/integration_tests/XCProjects/HelloWorldV5/*/UserReference
264+
**/index.txt

.travis.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
[![ReactiveXComponent.Net Nuget](https://img.shields.io/nuget/v/ReactiveXComponent.Net.svg)](https://www.nuget.org/packages/ReactiveXComponent.Net) [![ReactiveXComponent.Net Downloads](https://img.shields.io/nuget/dt/ReactiveXComponent.Net.svg)](https://www.nuget.org/packages/ReactiveXComponent.Net) [![Build Status](https://travis-ci.org/xcomponent/ReactiveXComponent.Net.svg?branch=master)](https://travis-ci.org/xcomponent/ReactiveXComponent.Net) [![](http://slack.xcomponent.com/badge.svg)](http://slack.xcomponent.com/)
2+
[![ReactiveXComponent.Net Nuget](https://img.shields.io/nuget/v/ReactiveXComponent.Net.svg)](https://www.nuget.org/packages/ReactiveXComponent.Net) [![ReactiveXComponent.Net Downloads](https://img.shields.io/nuget/dt/ReactiveXComponent.Net.svg)](https://www.nuget.org/packages/ReactiveXComponent.Net) [![CircleCI](https://circleci.com/gh/xcomponent/ReactiveXComponent.Net.svg?style=svg)](https://circleci.com/gh/xcomponent/ReactiveXComponent.Net) [![](http://slack.xcomponent.com/badge.svg)](http://slack.xcomponent.com/)
33

44
# .Net Reactive XComponent API
55

@@ -99,4 +99,3 @@ Default value: *False*
9999

100100
## License
101101
Apache License V2
102-

build.cake

Lines changed: 86 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
1-
#tool "nuget:?package=NUnit.Runners&version=3.7.0&include=./**/*"
1+
#tool "nuget:?package=NUnit.ConsoleRunner&version=3.9.0"
22
#tool "nuget:?package=ILRepack"
3-
#addin "Cake.FileHelpers&version=2.0.0"
4-
#addin "Cake.Incubator&version=1.6.0"
3+
#addin "Cake.FileHelpers&version=3.1.0"
4+
#addin "Cake.Incubator&version=3.0.0"
5+
#addin "Cake.DoInDirectory&version=3.2.0"
56
#load "cake.scripts/utilities.cake"
67

78
var target = Argument("target", "Build");
8-
var buildConfiguration = Argument("buildConfiguration", "Release");
9+
var buildConfiguration = Argument("buildConfiguration", "Debug");
910
var version = Argument("buildVersion", "1.0.0-build1");
11+
var vsVersion = Argument("vsVersion", "VS2017");
1012
var apiKey = Argument("nugetKey", "");
1113
var setAssemblyVersion = Argument<bool>("setAssemblyVersion", false);
1214

15+
var XComponentVersion = "6.0.3";
16+
17+
Setup(context=> {
18+
DoInDirectory(@"tools", () => {
19+
NuGetInstall("XComponent.Build.Community", new NuGetInstallSettings{ Version=XComponentVersion, ExcludeVersion=true });
20+
});
21+
});
22+
1323
Task("Clean")
1424
.Does(() =>
1525
{
@@ -24,17 +34,31 @@ Task("Clean")
2434
}
2535

2636
CleanSolution("ReactiveXComponent.sln", buildConfiguration);
27-
});
2837

29-
Task("RestoreNugetPackages")
30-
.Does(() =>
31-
{
32-
NuGetRestore("ReactiveXComponent.sln", new NuGetRestoreSettings { NoCache = true });
38+
var pathHelloWorldIntegrationTest = "./docker/integration_tests/XCProjects/HelloWorldV5/";
39+
if (DirectoryExists(pathHelloWorldIntegrationTest + "xcr"))
40+
{
41+
CleanDirectory(pathHelloWorldIntegrationTest + "xcr");
42+
}
43+
if (DirectoryExists(pathHelloWorldIntegrationTest + "generated"))
44+
{
45+
CleanDirectory(pathHelloWorldIntegrationTest + "generated");
46+
}
47+
if (DirectoryExists(pathHelloWorldIntegrationTest + "rxcAssemblies"))
48+
{
49+
CleanDirectory(pathHelloWorldIntegrationTest + "rxcAssemblies");
50+
}
51+
if (DirectoryExists(pathHelloWorldIntegrationTest + "CreateInstancesReactiveApi/CreateInstances/xcassemblies"))
52+
{
53+
CleanDirectory(pathHelloWorldIntegrationTest + "CreateInstancesReactiveApi/CreateInstances/xcassemblies");
54+
}
55+
CleanSolution(pathHelloWorldIntegrationTest + "CreateInstancesReactiveApi/CreateInstances.sln", buildConfiguration);
3356
});
3457

3558
Task("Build")
3659
.Does(() =>
3760
{
61+
NuGetRestore("ReactiveXComponent.sln", new NuGetRestoreSettings { NoCache = true });
3862
BuildSolution(@"./ReactiveXComponent.sln", buildConfiguration, setAssemblyVersion, version);
3963
});
4064

@@ -121,12 +145,64 @@ Task("PushPackage")
121145

122146
Task("All")
123147
.IsDependentOn("Clean")
124-
.IsDependentOn("RestoreNugetPackages")
125148
.IsDependentOn("Build")
126149
.IsDependentOn("Test")
127150
.IsDependentOn("CreatePackage")
128151
.Does(() =>
129152
{
130153
});
131154

155+
Task("BuildHelloWorld")
156+
.Does(() =>
157+
{
158+
NuGetRestore("./docker/integration_tests/XCProjects/HelloWorldV5/CreateInstancesReactiveApi/CreateInstances.sln", new NuGetRestoreSettings { NoCache = true });
159+
var exitCode = 0;
160+
var helloWorldProjectPathParam = " --project=\"./docker/integration_tests/XCProjects/HelloWorldV5/HelloWorldV5_Model.xcml\"";
161+
162+
var mono = "mono";
163+
var xcbuild = "./tools/XComponent.Build.Community/tools/XCBuild/xcbuild.exe";
164+
var cleanArgs = " --compilationmode=Debug --clean --env=Dev --vs=";
165+
var buildArgs = " --compilationmode=Debug --build --env=Dev --vs=";
166+
167+
if (IsRunningOnUnix()) {
168+
exitCode = StartProcess(mono, xcbuild + cleanArgs + vsVersion + helloWorldProjectPathParam + GetXCBuildExtraParam());
169+
StartProcess(mono, xcbuild + buildArgs + vsVersion + helloWorldProjectPathParam + GetXCBuildExtraParam());
170+
} else {
171+
exitCode = StartProcess(xcbuild, cleanArgs + vsVersion + helloWorldProjectPathParam + GetXCBuildExtraParam());
172+
StartProcess(xcbuild, buildArgs + vsVersion + helloWorldProjectPathParam + GetXCBuildExtraParam());
173+
}
174+
if (exitCode != 0) {
175+
throw new Exception();
176+
}
177+
});
178+
179+
Task("BuildIntegrationTests")
180+
.IsDependentOn("BuildHelloWorld")
181+
.Does(() =>
182+
{
183+
var rxcAssembliesPatterns = new string[]
184+
{
185+
"./packaging/ReactiveXComponent.dll"
186+
};
187+
188+
var pathrxcAssembliesDirectory = "./docker/integration_tests/XCProjects/HelloWorldV5/rxcAssemblies";
189+
var rxcAssemblies = GetFiles(rxcAssembliesPatterns);
190+
191+
CreateDirectory(pathrxcAssembliesDirectory);
192+
CopyFiles(rxcAssemblies, pathrxcAssembliesDirectory);
193+
var buildSettings = new Settings { Configuration = buildConfiguration, VSVersion = vsVersion };
194+
195+
CrossPlatformBuild(@"./docker/integration_tests/XCProjects/HelloWorldV5/CreateInstancesReactiveApi/CreateInstances.sln", buildSettings);
196+
});
197+
198+
Task("PackageDockerIntegrationTests")
199+
.Does(() =>
200+
{
201+
Zip("./tools/XComponent.Build.Community/tools/XCBuild/XCRuntime", "./docker/integration_tests/dockerScripts/XCContainer/XCRuntime.zip");
202+
Zip("./docker/integration_tests/XCProjects/HelloWorldV5/xcr/xcassemblies", "./docker/integration_tests/dockerScripts/XCContainer/HelloWorldV5XCassemblies.zip");
203+
Zip("./docker/integration_tests/XCProjects/HelloWorldV5/CreateInstancesReactiveApi/CreateInstances/bin/Debug", "./docker/integration_tests/dockerScripts/AppsContainer/CreateInstanceReactiveApi.zip");
204+
205+
});
206+
207+
132208
RunTarget(target);

cake.scripts/utilities.cake

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#addin "Cake.Incubator&version=3.0.0"
2+
#addin "Cake.VsixSignTool&version=1.2.0"
3+
14
var FormatAssemblyVersion = new Func<string, string>(currentVersion =>
25
{
36
var result = string.Empty;
@@ -169,4 +172,87 @@ var BuildSolution = new Action<string, string, bool, string>((solutionPath, conf
169172

170173
MSBuild(solutionPath, msBuildSettings);
171174
}
172-
});
175+
});
176+
177+
public class Settings {
178+
public string Configuration { get; set; }
179+
public string Target { get; set; }
180+
public string VersionNumber { get; set; }
181+
public bool? IsCommunityEdition { get; set; }
182+
public string VSVersion {get; set; }
183+
}
184+
185+
Func<bool> IsRunningOnOsx = () =>
186+
{
187+
return DirectoryExists("/Applications");
188+
};
189+
190+
Func<bool> IsRunningOnLinux = () =>
191+
{
192+
return IsRunningOnUnix() && !IsRunningOnOsx();
193+
};
194+
195+
Func<string> GetXCBuildExtraParam = () => {
196+
if (IsRunningOnLinux())
197+
{
198+
return " --monoPath=\"/usr/lib/mono/4.5/Facades/\"";
199+
}
200+
if (IsRunningOnOsx())
201+
{
202+
return " --monoPath=\"/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/4.5/Facades/\"";
203+
}
204+
205+
return "";
206+
};
207+
208+
public MSBuildSettings GetDefaultMSBuildSettings()
209+
{
210+
if (IsRunningOnLinux()){
211+
return new MSBuildSettings { ToolPath = new FilePath("/usr/bin/msbuild")};
212+
}
213+
return new MSBuildSettings();
214+
}
215+
216+
public void CrossPlatformBuild(string filePath, Settings settings)
217+
{
218+
if (settings == null)
219+
{
220+
MSBuild(filePath, GetDefaultMSBuildSettings());
221+
}
222+
else
223+
{
224+
var msbuildSettings = GetDefaultMSBuildSettings();
225+
226+
if(!string.IsNullOrEmpty(settings.Target))
227+
{
228+
msbuildSettings.WithTarget(settings.Target);
229+
}
230+
231+
if(!string.IsNullOrEmpty(settings.Configuration))
232+
{
233+
msbuildSettings.SetConfiguration(settings.Configuration);
234+
}
235+
236+
if (settings.IsCommunityEdition.HasValue)
237+
{
238+
string assemblyProduct = settings.IsCommunityEdition.Value ? "\"XComponent Community Edition\"" : "\"XComponent Workgroup Edition\"";
239+
msbuildSettings.WithProperty("AssemblyProduct", assemblyProduct);
240+
if (settings.IsCommunityEdition.Value)
241+
{
242+
msbuildSettings.WithProperty("DefineConstants", "CommunityEdition");
243+
}
244+
}
245+
246+
if (!string.IsNullOrEmpty(settings.VersionNumber))
247+
{
248+
msbuildSettings.WithProperty("VersionNumber", settings.VersionNumber);
249+
}
250+
251+
if (!string.IsNullOrEmpty(settings.VSVersion))
252+
{
253+
msbuildSettings.WithProperty("VSVersion", settings.VSVersion);
254+
}
255+
256+
MSBuild(filePath, msbuildSettings);
257+
}
258+
}

0 commit comments

Comments
 (0)