This commit is contained in:
Julian 2022-02-10 18:44:55 +01:00 committed by A. J. Kaptijn
parent a882f5b774
commit 5f540e5020

View file

@ -24,6 +24,7 @@ import fs from 'fs'
//import fetch from 'node-fetch' //import fetch from 'node-fetch'
import bent from 'bent' import bent from 'bent'
import { cwd } from 'process'; import { cwd } from 'process';
import Zip from 'adm-zip'
async function main(): Promise<void> { async function main(): Promise<void> {
try { try {
@ -120,7 +121,11 @@ class TestReporter {
let version: string | null = null; let version: string | null = null;
if (input.versionArtifactPath) { if (input.versionArtifactPath) {
version = fs.readFileSync(input.versionArtifactPath).toString(); const zip = new Zip(input.versionArtifactPath)
const entry = zip.getEntry('version.txt')
version = zip.readAsText(entry);
core.info(`Using EVA version ${version}, current directory: ${cwd()}`) core.info(`Using EVA version ${version}, current directory: ${cwd()}`)
} }
@ -129,7 +134,7 @@ class TestReporter {
try { try {
const post = bent(this.resultsEndpoint, 'POST', {}, 200); const post = bent(this.resultsEndpoint, 'POST', {}, 200);
await post(`TestResults?Secret=${this.resultsEndpointSecret}${version ? "&EVAVersion=" + version : ''}`, readStream); const response = await post(`TestResults?Secret=${this.resultsEndpointSecret}${version ? "&EVAVersion=" + version : ''}`, readStream);
core.info(`Uploaded TRX files: ${a}`) core.info(`Uploaded TRX files: ${a}`)
} catch (ex) { } catch (ex) {
core.warning(`Could not upload file ${a}: ${ex}`) core.warning(`Could not upload file ${a}: ${ex}`)