mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 06:17:10 +01:00
Show artifact download progress
This commit is contained in:
parent
8819b4b3d4
commit
da9cc2c0d9
2 changed files with 5 additions and 4 deletions
|
|
@ -67,7 +67,7 @@ export class ArtifactProvider implements InputProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const art of artifacts) {
|
for (const art of artifacts) {
|
||||||
await downloadArtifact(this.octokit, art.id, art.name, this.token)
|
await downloadArtifact(this.octokit, art.id, art.name, art.size_in_bytes, this.token)
|
||||||
const reportName = this.getReportName(art.name)
|
const reportName = this.getReportName(art.name)
|
||||||
const files: FileContent[] = []
|
const files: FileContent[] = []
|
||||||
const zip = new Zip(art.name)
|
const zip = new Zip(art.name)
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ export async function downloadArtifact(
|
||||||
octokit: InstanceType<typeof GitHub>,
|
octokit: InstanceType<typeof GitHub>,
|
||||||
artifactId: number,
|
artifactId: number,
|
||||||
fileName: string,
|
fileName: string,
|
||||||
|
size: number,
|
||||||
token: string
|
token: string
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
core.startGroup(`Downloading artifact ${fileName}`)
|
core.startGroup(`Downloading artifact ${fileName}`)
|
||||||
|
|
@ -72,9 +73,9 @@ export async function downloadArtifact(
|
||||||
const fileWriterStream = createWriteStream(fileName)
|
const fileWriterStream = createWriteStream(fileName)
|
||||||
|
|
||||||
core.info(`Downloading ${url}`)
|
core.info(`Downloading ${url}`)
|
||||||
downloadStream.on('downloadProgress', ({transferred, total, percent}) => {
|
downloadStream.on('downloadProgress', ({transferred}) => {
|
||||||
const percentage = Math.round(percent * 100)
|
const percentage = Math.round(transferred / size * 100)
|
||||||
core.info(`Progress: ${transferred}/${total} (${percentage}%)`)
|
core.info(`Progress: ${transferred}/${size} (${percentage}%)`)
|
||||||
})
|
})
|
||||||
await asyncStream(downloadStream, fileWriterStream)
|
await asyncStream(downloadStream, fileWriterStream)
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue