Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14f28534ef | ||
|
|
ae026cf7c6 | ||
|
|
3d0da1ea1a | ||
|
|
409d616a6e | ||
|
|
e3c2a88bbf | ||
|
|
c6005c2a3c |
Generated
+6
-6
@@ -8954,9 +8954,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/http-cache-semantics": {
|
"node_modules/http-cache-semantics": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz",
|
||||||
"integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==",
|
"integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/http-proxy-agent": {
|
"node_modules/http-proxy-agent": {
|
||||||
@@ -23868,9 +23868,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"http-cache-semantics": {
|
"http-cache-semantics": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz",
|
||||||
"integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==",
|
"integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"http-proxy-agent": {
|
"http-proxy-agent": {
|
||||||
|
|||||||
Vendored
+4
-1
@@ -111,4 +111,7 @@
|
|||||||
- Added support for verbose logging about cache version during cache miss.
|
- Added support for verbose logging about cache version during cache miss.
|
||||||
|
|
||||||
### 3.1.2
|
### 3.1.2
|
||||||
- Fix issue with symlink restoration on windows.
|
- Fix issue with symlink restoration on windows.
|
||||||
|
|
||||||
|
### 3.1.3
|
||||||
|
- Fix to prevent from setting MYSYS environement variable globally [#1329](https://github.com/actions/toolkit/pull/1329).
|
||||||
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/cache",
|
"name": "@actions/cache",
|
||||||
"version": "3.1.2",
|
"version": "3.1.3",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@actions/cache",
|
"name": "@actions/cache",
|
||||||
"version": "3.1.2",
|
"version": "3.1.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/cache",
|
"name": "@actions/cache",
|
||||||
"version": "3.1.2",
|
"version": "3.1.3",
|
||||||
"preview": true,
|
"preview": true,
|
||||||
"description": "Actions cache lib",
|
"description": "Actions cache lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
+26
-1
@@ -10,7 +10,7 @@ import * as util from 'util'
|
|||||||
import * as utils from './cacheUtils'
|
import * as utils from './cacheUtils'
|
||||||
import {SocketTimeout} from './constants'
|
import {SocketTimeout} from './constants'
|
||||||
import {DownloadOptions} from '../options'
|
import {DownloadOptions} from '../options'
|
||||||
import {retryHttpClientResponse} from './requestUtils'
|
import {retryHttpClientResponse, sleep} from './requestUtils'
|
||||||
|
|
||||||
import {AbortController} from '@azure/abort-controller'
|
import {AbortController} from '@azure/abort-controller'
|
||||||
|
|
||||||
@@ -161,6 +161,28 @@ export class DownloadProgress {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function displayDownloadProgress(message: any, startTime: number): Promise<void> {
|
||||||
|
const socket = message.socket
|
||||||
|
while(!message.complete) {
|
||||||
|
const byteRead = socket.bytesRead
|
||||||
|
const totalBytes = 100000
|
||||||
|
const percentage = (100 * (byteRead / totalBytes)).toFixed(
|
||||||
|
1
|
||||||
|
)
|
||||||
|
const elapsedTime = Date.now() - startTime
|
||||||
|
const downloadSpeed = (
|
||||||
|
byteRead /
|
||||||
|
(1024 * 1024) /
|
||||||
|
(elapsedTime / 1000)
|
||||||
|
).toFixed(1)
|
||||||
|
|
||||||
|
core.info(
|
||||||
|
`Received ${byteRead} of ${totalBytes} (${percentage}%), ${downloadSpeed} MBs/sec`
|
||||||
|
)
|
||||||
|
sleep(100)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Download the cache using the Actions toolkit http-client
|
* Download the cache using the Actions toolkit http-client
|
||||||
*
|
*
|
||||||
@@ -171,6 +193,7 @@ export async function downloadCacheHttpClient(
|
|||||||
archiveLocation: string,
|
archiveLocation: string,
|
||||||
archivePath: string
|
archivePath: string
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
const startTime = Date.now()
|
||||||
const writeStream = fs.createWriteStream(archivePath)
|
const writeStream = fs.createWriteStream(archivePath)
|
||||||
const httpClient = new HttpClient('actions/cache')
|
const httpClient = new HttpClient('actions/cache')
|
||||||
const downloadResponse = await retryHttpClientResponse(
|
const downloadResponse = await retryHttpClientResponse(
|
||||||
@@ -184,6 +207,8 @@ export async function downloadCacheHttpClient(
|
|||||||
core.debug(`Aborting download, socket timed out after ${SocketTimeout} ms`)
|
core.debug(`Aborting download, socket timed out after ${SocketTimeout} ms`)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await displayDownloadProgress(downloadResponse.message, startTime)
|
||||||
|
|
||||||
await pipeResponseToStream(downloadResponse, writeStream)
|
await pipeResponseToStream(downloadResponse, writeStream)
|
||||||
|
|
||||||
// Validate download size.
|
// Validate download size.
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ export function isRetryableStatusCode(statusCode?: number): boolean {
|
|||||||
return retryableStatusCodes.includes(statusCode)
|
return retryableStatusCodes.includes(statusCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sleep(milliseconds: number): Promise<void> {
|
export async function sleep(milliseconds: number): Promise<void> {
|
||||||
return new Promise(resolve => setTimeout(resolve, milliseconds))
|
return new Promise(resolve => setTimeout(resolve, milliseconds))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user