mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
fix: Make metadata tests more resilient. (#6771)
* fix: Make metadata tests more resilient. * fix: improve control flow and clarify xargs purpose.
This commit is contained in:
@@ -165,17 +165,23 @@ function compareSize(file, expected) {
|
|||||||
const stat = fs.statSync(name);
|
const stat = fs.statSync(name);
|
||||||
const size = stat.size;
|
const size = stat.size;
|
||||||
|
|
||||||
|
if (!compare) {
|
||||||
|
const message = `Failed: Previous size of ${name} is undefined.`;
|
||||||
|
console.log(`${BOLD_RED}${message}${ANSI_RESET}`);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (size > compare) {
|
if (size > compare) {
|
||||||
const message = `Failed: ` +
|
const message = `Failed: ` +
|
||||||
`Size of ${name} has grown more than 10%. ${size} vs ${expected}`;
|
`Size of ${name} has grown more than 10%. ${size} vs ${expected}`;
|
||||||
console.log(`${BOLD_RED}${message}${ANSI_RESET}`);
|
console.log(`${BOLD_RED}${message}${ANSI_RESET}`);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
|
||||||
const message =
|
|
||||||
`Size of ${name} at ${size} compared to previous ${expected}`;
|
|
||||||
console.log(`${BOLD_GREEN}${message}${ANSI_RESET}`);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const message =
|
||||||
|
`Size of ${name} at ${size} compared to previous ${expected}`;
|
||||||
|
console.log(`${BOLD_GREEN}${message}${ANSI_RESET}`);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ readonly RELEASE_DIR='dist'
|
|||||||
# Q3 2022 8.0.0 1040413 (mid-quarter typescript conversion)
|
# Q3 2022 8.0.0 1040413 (mid-quarter typescript conversion)
|
||||||
# Q4 2022 8.0.0 870104
|
# Q4 2022 8.0.0 870104
|
||||||
# Q4 2022 9.1.1 903357
|
# Q4 2022 9.1.1 903357
|
||||||
readonly BLOCKLY_SIZE_EXPECTED= 903357
|
readonly BLOCKLY_SIZE_EXPECTED=903357
|
||||||
|
|
||||||
# Size of blocks_compressed.js
|
# Size of blocks_compressed.js
|
||||||
# Q2 2019 2.20190722.0 75618
|
# Q2 2019 2.20190722.0 75618
|
||||||
@@ -52,7 +52,7 @@ readonly BLOCKLY_SIZE_EXPECTED= 903357
|
|||||||
# Q3 2022 8.0.0 102176 (mid-quarter typescript conversion)
|
# Q3 2022 8.0.0 102176 (mid-quarter typescript conversion)
|
||||||
# Q4 2022 8.0.0 102213
|
# Q4 2022 8.0.0 102213
|
||||||
# Q4 2022 9.1.1 102190
|
# Q4 2022 9.1.1 102190
|
||||||
readonly BLOCKS_SIZE_EXPECTED= 102190
|
readonly BLOCKS_SIZE_EXPECTED=102190
|
||||||
|
|
||||||
# Size of blockly_compressed.js.gz
|
# Size of blockly_compressed.js.gz
|
||||||
# Q2 2019 2.20190722.0 180925
|
# Q2 2019 2.20190722.0 180925
|
||||||
@@ -72,7 +72,7 @@ readonly BLOCKS_SIZE_EXPECTED= 102190
|
|||||||
# Q3 2022 8.0.0 185766 (mid-quarter typescript conversion)
|
# Q3 2022 8.0.0 185766 (mid-quarter typescript conversion)
|
||||||
# Q4 2022 8.0.0 175140
|
# Q4 2022 8.0.0 175140
|
||||||
# Q4 2022 9.1.1 179306
|
# Q4 2022 9.1.1 179306
|
||||||
readonly BLOCKLY_GZ_SIZE_EXPECTED= 179306
|
readonly BLOCKLY_GZ_SIZE_EXPECTED=179306
|
||||||
|
|
||||||
# Size of blocks_compressed.js.gz
|
# Size of blocks_compressed.js.gz
|
||||||
# Q2 2019 2.20190722.0 14552
|
# Q2 2019 2.20190722.0 14552
|
||||||
@@ -91,7 +91,7 @@ readonly BLOCKLY_GZ_SIZE_EXPECTED= 179306
|
|||||||
# Q3 2022 8.0.0 17016 (mid-quarter typescript conversion)
|
# Q3 2022 8.0.0 17016 (mid-quarter typescript conversion)
|
||||||
# Q4 2022 8.0.0 17188
|
# Q4 2022 8.0.0 17188
|
||||||
# Q4 2022 9.1.1 17182
|
# Q4 2022 9.1.1 17182
|
||||||
readonly BLOCKS_GZ_SIZE_EXPECTED= 17182
|
readonly BLOCKS_GZ_SIZE_EXPECTED=17182
|
||||||
|
|
||||||
# ANSI colors
|
# ANSI colors
|
||||||
readonly BOLD_GREEN='\033[1;32m'
|
readonly BOLD_GREEN='\033[1;32m'
|
||||||
|
|||||||
@@ -12,10 +12,12 @@ readonly RELEASE_DIR='dist'
|
|||||||
gzip -k "${RELEASE_DIR}/blockly_compressed.js"
|
gzip -k "${RELEASE_DIR}/blockly_compressed.js"
|
||||||
gzip -k "${RELEASE_DIR}/blocks_compressed.js"
|
gzip -k "${RELEASE_DIR}/blocks_compressed.js"
|
||||||
|
|
||||||
blockly_size=$(wc -c < "${RELEASE_DIR}/blockly_compressed.js")
|
# wc prefixes the file size with whitespace; xargs strips that and the -n flag to
|
||||||
blocks_size=$(wc -c < "${RELEASE_DIR}/blocks_compressed.js")
|
# echo removes the newline.
|
||||||
blockly_gz_size=$(wc -c < "${RELEASE_DIR}/blockly_compressed.js.gz")
|
blockly_size=$(wc -c < "${RELEASE_DIR}/blockly_compressed.js" | xargs echo -n)
|
||||||
blocks_gz_size=$(wc -c < "${RELEASE_DIR}/blocks_compressed.js.gz")
|
blocks_size=$(wc -c < "${RELEASE_DIR}/blocks_compressed.js" | xargs echo -n)
|
||||||
|
blockly_gz_size=$(wc -c < "${RELEASE_DIR}/blockly_compressed.js.gz" | xargs echo -n)
|
||||||
|
blocks_gz_size=$(wc -c < "${RELEASE_DIR}/blocks_compressed.js.gz" | xargs echo -n)
|
||||||
quarters=(1 1 1 2 2 2 3 3 3 4 4 4)
|
quarters=(1 1 1 2 2 2 3 3 3 4 4 4)
|
||||||
month=$(date +%-m)
|
month=$(date +%-m)
|
||||||
quarter=$(echo Q${quarters[$month - 1]} $(date +%Y))
|
quarter=$(echo Q${quarters[$month - 1]} $(date +%Y))
|
||||||
|
|||||||
Reference in New Issue
Block a user