Skip to content

Commit

Permalink
Artifact uploading enabled - test logging enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebazzz committed Oct 19, 2019
1 parent 4cbd53a commit 13084ed
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 7 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,10 @@ jobs:
MOZ_HEADLESS: 1
CIRCLECI: 1
run: ${{ matrix.script_name }} --target=test --verbosity=verbose

- name: Upload artifacts
uses: actions/upload-artifact@v1
continue-on-error: true
with:
name: logs
path: build/testresults
4 changes: 4 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ after_build:
test_script:
- cmd: build.cmd --target=Test
deploy: off
artifacts:
- path: build\testresults\*.trx
name: test logs
type: zip
48 changes: 41 additions & 7 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ var verbosity = Argument<Verbosity>("verbosity", Verbosity.Minimal);
//////////////////////////////////////////////////////////////////////

var baseName = "Return";
var buildDir = Directory("./build") + Directory(configuration);
var buildDir = Directory("./build");
var testResultsDir = buildDir + Directory("./testresults");
var publishDir = Directory("./build/publish");
var assemblyInfoFile = Directory($"./src/{baseName}/Properties") + File("AssemblyInfo.cs");
var nodeEnv = configuration == "Release" ? "production" : "development";
Expand Down Expand Up @@ -326,14 +327,47 @@ UbuntuPublishTask("18.04-x64", "ubuntu.18.04-x64", "Ubuntu 18.04 64-bit");
Task("Publish")
.IsDependentOn("Publish-Windows")
.IsDependentOn("Publish-Ubuntu");

void TestTask(string name, string projectName) {
CreateDirectory(testResultsDir);

Task($"Test-CS-{name}")
.IsDependentOn("Restore-NuGet-Packages")
.IsDependentOn("Set-HeadlessEnvironment")
.IsDependentOn("Run-FrontendBuild")
.IsDependeeOf("Test-CS")
.Does(() => {
var logFilePath = MakeAbsolute(testResultsDir + File($"test-{name}-log.trx"));

Information($"Running tests for {projectName} - logging to {logFilePath}");

try {
DotNetCoreTest($"./tests/{projectName}/{projectName}.csproj", new DotNetCoreTestSettings {
ArgumentCustomization = (args) => args.AppendQuoted($"--logger:trx;LogFileName={logFilePath}")
});
} finally {
if (AppVeyor.IsRunningOnAppVeyor && FileExists(logFilePath)) {
var jobId = EnvironmentVariable("APPVEYOR_JOB_ID");
var resultsType = "mstest"; // trx is vstest format

var wc = new System.Net.WebClient();
var url = $"https://ci.appveyor.com/api/testresults/{resultsType}/{jobId}";
var fullTestResultsPath = logFilePath.FullPath;

Information("Uploading test results from {0} to {1}", fullTestResultsPath, url);
wc.UploadFile(url, fullTestResultsPath);
}
}
});
}

TestTask("Unit-Application", "Return.Application.Tests.Unit");
TestTask("Unit-Domain", "Return.Domain.Tests.Unit");
TestTask("Unit-Web", "Return.Web.Tests.Unit");
TestTask("Integration-Web", "Return.Web.Tests.Integration");

Task("Test-CS")
.IsDependentOn("Restore-NuGet-Packages")
.IsDependentOn("Set-HeadlessEnvironment")
.Description("Test backend-end compiled code")
.Does(() => {
DotNetCoreTest($"./Return.sln");
});
.Description("Test backend-end compiled code");

Task("Test")
.IsDependentOn("Test-CS")
Expand Down

0 comments on commit 13084ed

Please sign in to comment.