Skip to content

Commit

Permalink
test: fix regression testing action (#1788)
Browse files Browse the repository at this point in the history
The regression-test GitHub Action was failing for all pull requests due
to not handling the gzipped archive properly.

This resolved it by piping the response body to zlib#createGunzip
first. Also updates the relevant dependencies.

Signed-off-by: Seth Falco <seth@falco.fun>
Co-authored-by: strarsis <strarsis@gmail.com>
Co-authored-by: Bogdan Chadkin <trysound@yandex.ru>
  • Loading branch information
3 people authored Sep 23, 2023
1 parent 73f7002 commit 59ab80e
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 87 deletions.
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
"name": "Bogdan Chadkin",
"email": "trysound@yandex.ru",
"url": "https://github.com/TrySound"
},
{
"name": "Seth Falco",
"email": "seth@falco.fun",
"url": "https://falco.fun/"
}
],
"repository": {
Expand Down Expand Up @@ -121,14 +126,14 @@
"del": "^6.0.0",
"eslint": "^8.24.0",
"jest": "^29.1.2",
"node-fetch": "^2.6.2",
"node-fetch": "^2.7.0",
"pixelmatch": "^5.2.1",
"playwright": "^1.14.1",
"pngjs": "^6.0.0",
"prettier": "^2.7.1",
"rollup": "^2.79.1",
"rollup-plugin-terser": "^7.0.2",
"tar-stream": "^2.2.0",
"tar-stream": "^3.1.6",
"typescript": "^4.8.4"
}
}
12 changes: 8 additions & 4 deletions test/regression-extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ const path = require('path');
const util = require('util');
const zlib = require('zlib');
const stream = require('stream');
const fetch = require('node-fetch');
const { default: fetch } = require('node-fetch');
const tarStream = require('tar-stream');

const pipeline = util.promisify(stream.pipeline);

/**
* @param {string} url
* @param {string} baseDir
* @param {RegExp} include
*/
const extractTarGz = async (url, baseDir, include) => {
const extract = tarStream.extract();
extract.on('entry', async (header, stream, next) => {
Expand All @@ -19,8 +24,7 @@ const extractTarGz = async (url, baseDir, include) => {
const file = path.join(baseDir, header.name);
await fs.promises.mkdir(path.dirname(file), { recursive: true });
await pipeline(stream, fs.createWriteStream(file));
}
if (header.name.endsWith('.svgz')) {
} else if (header.name.endsWith('.svgz')) {
// .svgz -> .svg
const file = path.join(baseDir, header.name.slice(0, -1));
await fs.promises.mkdir(path.dirname(file), { recursive: true });
Expand All @@ -39,7 +43,7 @@ const extractTarGz = async (url, baseDir, include) => {
next();
});
const response = await fetch(url);
await pipeline(response.body, extract);
await pipeline(response.body, zlib.createGunzip(), extract);
};

(async () => {
Expand Down
160 changes: 79 additions & 81 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,13 @@ __metadata:
languageName: node
linkType: hard

"b4a@npm:^1.6.4":
version: 1.6.4
resolution: "b4a@npm:1.6.4"
checksum: 81b086f9af1f8845fbef4476307236bda3d660c158c201db976f19cdce05f41f93110ab6b12fd7a2696602a490cc43d5410ee36a56d6eef93afb0d6ca69ac3b2
languageName: node
linkType: hard

"babel-jest@npm:^29.1.2":
version: 29.1.2
resolution: "babel-jest@npm:29.1.2"
Expand Down Expand Up @@ -1317,24 +1324,6 @@ __metadata:
languageName: node
linkType: hard

"base64-js@npm:^1.3.1":
version: 1.5.1
resolution: "base64-js@npm:1.5.1"
checksum: 669632eb3745404c2f822a18fc3a0122d2f9a7a13f7fb8b5823ee19d1d2ff9ee5b52c53367176ea4ad093c332fd5ab4bd0ebae5a8e27917a4105a4cfc86b1005
languageName: node
linkType: hard

"bl@npm:^4.0.3":
version: 4.1.0
resolution: "bl@npm:4.1.0"
dependencies:
buffer: ^5.5.0
inherits: ^2.0.4
readable-stream: ^3.4.0
checksum: 9e8521fa7e83aa9427c6f8ccdcba6e8167ef30cc9a22df26effcc5ab682ef91d2cbc23a239f945d099289e4bbcfae7a192e9c28c84c6202e710a0dfec3722662
languageName: node
linkType: hard

"boolbase@npm:^1.0.0":
version: 1.0.0
resolution: "boolbase@npm:1.0.0"
Expand Down Expand Up @@ -1398,16 +1387,6 @@ __metadata:
languageName: node
linkType: hard

"buffer@npm:^5.5.0":
version: 5.7.1
resolution: "buffer@npm:5.7.1"
dependencies:
base64-js: ^1.3.1
ieee754: ^1.1.13
checksum: e2cf8429e1c4c7b8cbd30834ac09bd61da46ce35f5c22a78e6c2f04497d6d25541b16881e30a019c6fd3154150650ccee27a308eff3e26229d788bbdeb08ab84
languageName: node
linkType: hard

"builtin-modules@npm:^3.3.0":
version: 3.3.0
resolution: "builtin-modules@npm:3.3.0"
Expand Down Expand Up @@ -1860,7 +1839,7 @@ __metadata:
languageName: node
linkType: hard

"end-of-stream@npm:^1.1.0, end-of-stream@npm:^1.4.1":
"end-of-stream@npm:^1.1.0":
version: 1.4.4
resolution: "end-of-stream@npm:1.4.4"
dependencies:
Expand Down Expand Up @@ -2139,6 +2118,13 @@ __metadata:
languageName: node
linkType: hard

"fast-fifo@npm:^1.1.0, fast-fifo@npm:^1.2.0":
version: 1.3.2
resolution: "fast-fifo@npm:1.3.2"
checksum: 6bfcba3e4df5af7be3332703b69a7898a8ed7020837ec4395bb341bd96cc3a6d86c3f6071dd98da289618cf2234c70d84b2a6f09a33dd6f988b1ff60d8e54275
languageName: node
linkType: hard

"fast-glob@npm:^3.2.9":
version: 3.2.12
resolution: "fast-glob@npm:3.2.12"
Expand Down Expand Up @@ -2248,13 +2234,6 @@ __metadata:
languageName: node
linkType: hard

"fs-constants@npm:^1.0.0":
version: 1.0.0
resolution: "fs-constants@npm:1.0.0"
checksum: 18f5b718371816155849475ac36c7d0b24d39a11d91348cfcb308b4494824413e03572c403c86d3a260e049465518c4f0d5bd00f0371cdfcad6d4f30a85b350d
languageName: node
linkType: hard

"fs-minipass@npm:^2.0.0":
version: 2.1.0
resolution: "fs-minipass@npm:2.1.0"
Expand Down Expand Up @@ -2516,13 +2495,6 @@ __metadata:
languageName: node
linkType: hard

"ieee754@npm:^1.1.13":
version: 1.2.1
resolution: "ieee754@npm:1.2.1"
checksum: 5144c0c9815e54ada181d80a0b810221a253562422e7c6c3a60b1901154184f49326ec239d618c416c1c5945a2e197107aee8d986a3dd836b53dffefd99b5e7e
languageName: node
linkType: hard

"ignore@npm:^5.2.0":
version: 5.2.0
resolution: "ignore@npm:5.2.0"
Expand Down Expand Up @@ -2583,7 +2555,7 @@ __metadata:
languageName: node
linkType: hard

"inherits@npm:2, inherits@npm:^2.0.3, inherits@npm:^2.0.4, inherits@npm:~2.0.3":
"inherits@npm:2, inherits@npm:~2.0.3":
version: 2.0.4
resolution: "inherits@npm:2.0.4"
checksum: 4a48a733847879d6cf6691860a6b1e3f0f4754176e4d71494c41f3475553768b10f84b5ce1d40fbd0e34e6bfbb864ee35858ad4dd2cf31e02fc4a154b724d7f1
Expand Down Expand Up @@ -3592,10 +3564,17 @@ __metadata:
languageName: node
linkType: hard

"node-fetch@npm:^2.6.2":
version: 2.6.2
resolution: "node-fetch@npm:2.6.2"
checksum: de367eae1dfbc0e12283c1cf92256ea7fba7eac8655e2e51ebb217727162396fc6cf24689ef9fc6accf075e3991e2ffaa061f7cfaa958215329649b2297ff06d
"node-fetch@npm:^2.7.0":
version: 2.7.0
resolution: "node-fetch@npm:2.7.0"
dependencies:
whatwg-url: ^5.0.0
peerDependencies:
encoding: ^0.1.0
peerDependenciesMeta:
encoding:
optional: true
checksum: d76d2f5edb451a3f05b15115ec89fc6be39de37c6089f1b6368df03b91e1633fd379a7e01b7ab05089a25034b2023d959b47e59759cb38d88341b2459e89d6e5
languageName: node
linkType: hard

Expand Down Expand Up @@ -4038,6 +4017,13 @@ __metadata:
languageName: node
linkType: hard

"queue-tick@npm:^1.0.1":
version: 1.0.1
resolution: "queue-tick@npm:1.0.1"
checksum: 57c3292814b297f87f792fbeb99ce982813e4e54d7a8bdff65cf53d5c084113913289d4a48ec8bbc964927a74b847554f9f4579df43c969a6c8e0f026457ad01
languageName: node
linkType: hard

"randombytes@npm:^2.1.0":
version: 2.1.0
resolution: "randombytes@npm:2.1.0"
Expand Down Expand Up @@ -4069,17 +4055,6 @@ __metadata:
languageName: node
linkType: hard

"readable-stream@npm:^3.1.1, readable-stream@npm:^3.4.0":
version: 3.6.0
resolution: "readable-stream@npm:3.6.0"
dependencies:
inherits: ^2.0.3
string_decoder: ^1.1.1
util-deprecate: ^1.0.1
checksum: d4ea81502d3799439bb955a3a5d1d808592cf3133350ed352aeaa499647858b27b1c4013984900238b0873ec8d0d8defce72469fb7a83e61d53f5ad61cb80dc8
languageName: node
linkType: hard

"regexpp@npm:^3.2.0":
version: 3.2.0
resolution: "regexpp@npm:3.2.0"
Expand Down Expand Up @@ -4206,7 +4181,7 @@ __metadata:
languageName: node
linkType: hard

"safe-buffer@npm:^5.1.0, safe-buffer@npm:~5.2.0":
"safe-buffer@npm:^5.1.0":
version: 5.2.1
resolution: "safe-buffer@npm:5.2.1"
checksum: b99c4b41fdd67a6aaf280fcd05e9ffb0813654894223afb78a31f14a19ad220bba8aba1cb14eddce1fcfb037155fe6de4e861784eb434f7d11ed58d1e70dd491
Expand Down Expand Up @@ -4401,6 +4376,16 @@ __metadata:
languageName: node
linkType: hard

"streamx@npm:^2.15.0":
version: 2.15.1
resolution: "streamx@npm:2.15.1"
dependencies:
fast-fifo: ^1.1.0
queue-tick: ^1.0.1
checksum: 6f2b4fed68caacd28efbd44d4264f5d3c2b81b0a5de14419333dac57f2075c49ae648df8d03db632a33587a6c8ab7cb9cdb4f9a2f8305be0c2cd79af35742b15
languageName: node
linkType: hard

"string-length@npm:^4.0.1":
version: 4.0.2
resolution: "string-length@npm:4.0.2"
Expand Down Expand Up @@ -4443,15 +4428,6 @@ __metadata:
languageName: node
linkType: hard

"string_decoder@npm:^1.1.1":
version: 1.3.0
resolution: "string_decoder@npm:1.3.0"
dependencies:
safe-buffer: ~5.2.0
checksum: 8417646695a66e73aefc4420eb3b84cc9ffd89572861fe004e6aeb13c7bc00e2f616247505d2dbbef24247c372f70268f594af7126f43548565c68c117bdeb56
languageName: node
linkType: hard

"string_decoder@npm:~1.1.1":
version: 1.1.1
resolution: "string_decoder@npm:1.1.1"
Expand Down Expand Up @@ -4563,31 +4539,29 @@ __metadata:
del: ^6.0.0
eslint: ^8.24.0
jest: ^29.1.2
node-fetch: ^2.6.2
node-fetch: ^2.7.0
picocolors: ^1.0.0
pixelmatch: ^5.2.1
playwright: ^1.14.1
pngjs: ^6.0.0
prettier: ^2.7.1
rollup: ^2.79.1
rollup-plugin-terser: ^7.0.2
tar-stream: ^2.2.0
tar-stream: ^3.1.6
typescript: ^4.8.4
bin:
svgo: ./bin/svgo
languageName: unknown
linkType: soft

"tar-stream@npm:^2.2.0":
version: 2.2.0
resolution: "tar-stream@npm:2.2.0"
"tar-stream@npm:^3.1.6":
version: 3.1.6
resolution: "tar-stream@npm:3.1.6"
dependencies:
bl: ^4.0.3
end-of-stream: ^1.4.1
fs-constants: ^1.0.0
inherits: ^2.0.3
readable-stream: ^3.1.1
checksum: 699831a8b97666ef50021c767f84924cfee21c142c2eb0e79c63254e140e6408d6d55a065a2992548e72b06de39237ef2b802b99e3ece93ca3904a37622a66f3
b4a: ^1.6.4
fast-fifo: ^1.2.0
streamx: ^2.15.0
checksum: f3627f918581976e954ff03cb8d370551053796b82564f8c7ca8fac84c48e4d042026d0854fc222171a34ff9c682b72fae91be9c9b0a112d4c54f9e4f443e9c5
languageName: node
linkType: hard

Expand Down Expand Up @@ -4669,6 +4643,13 @@ __metadata:
languageName: node
linkType: hard

"tr46@npm:~0.0.3":
version: 0.0.3
resolution: "tr46@npm:0.0.3"
checksum: 726321c5eaf41b5002e17ffbd1fb7245999a073e8979085dacd47c4b4e8068ff5777142fc6726d6ca1fd2ff16921b48788b87225cbc57c72636f6efa8efbffe3
languageName: node
linkType: hard

"type-check@npm:^0.4.0, type-check@npm:~0.4.0":
version: 0.4.0
resolution: "type-check@npm:0.4.0"
Expand Down Expand Up @@ -4760,7 +4741,7 @@ __metadata:
languageName: node
linkType: hard

"util-deprecate@npm:^1.0.1, util-deprecate@npm:~1.0.1":
"util-deprecate@npm:~1.0.1":
version: 1.0.2
resolution: "util-deprecate@npm:1.0.2"
checksum: 474acf1146cb2701fe3b074892217553dfcf9a031280919ba1b8d651a068c9b15d863b7303cb15bd00a862b498e6cf4ad7b4a08fb134edd5a6f7641681cb54a2
Expand All @@ -4787,6 +4768,23 @@ __metadata:
languageName: node
linkType: hard

"webidl-conversions@npm:^3.0.0":
version: 3.0.1
resolution: "webidl-conversions@npm:3.0.1"
checksum: c92a0a6ab95314bde9c32e1d0a6dfac83b578f8fa5f21e675bc2706ed6981bc26b7eb7e6a1fab158e5ce4adf9caa4a0aee49a52505d4d13c7be545f15021b17c
languageName: node
linkType: hard

"whatwg-url@npm:^5.0.0":
version: 5.0.0
resolution: "whatwg-url@npm:5.0.0"
dependencies:
tr46: ~0.0.3
webidl-conversions: ^3.0.0
checksum: b8daed4ad3356cc4899048a15b2c143a9aed0dfae1f611ebd55073310c7b910f522ad75d727346ad64203d7e6c79ef25eafd465f4d12775ca44b90fa82ed9e2c
languageName: node
linkType: hard

"which@npm:^2.0.1, which@npm:^2.0.2":
version: 2.0.2
resolution: "which@npm:2.0.2"
Expand Down

0 comments on commit 59ab80e

Please sign in to comment.