Use a on_failure build step to call Push-AppveyorArtifact.
on_failure:
- ps: Get-ChildItem *.received.* -recurse | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
See also Pushing artifacts from scripts.
Use a if: failure() condition to upload any *.received.*
files if the build fails.
- name: Upload Test Results
if: failure()
uses: actions/upload-artifact@v2
with:
name: verify-test-results
path: |
**/*.received.*
In some scenarios, as part of a build, the test assemblies are copied to a different directory or machine to be run. In this case custom code will be required to derive the path to the .verified.
files. This can be done using DerivePathInfo.
For example a possible implementation for AppVeyor could be:
if (BuildServerDetector.Detected)
{
var buildDirectory = Environment.GetEnvironmentVariable("APPVEYOR_BUILD_FOLDER")!;
VerifierSettings.DerivePathInfo(
(sourceFile, projectDirectory, type, method) =>
{
var testDirectory = Path.GetDirectoryName(sourceFile)!;
var testDirectorySuffix = testDirectory.Replace(projectDirectory, string.Empty);
return new(directory: Path.Combine(buildDirectory, testDirectorySuffix));
});
}