chore: import upstream snapshot with attribution
RequirementsTest / build (windows-latest, 3.9) (push) Has been cancelled
RequirementsTest / build (macos-latest, 3.9) (push) Has been cancelled
RequirementsTest / build (ubuntu-latest, 3.9) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Pylint / build (3.9) (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:18:32 +08:00
commit f0dfbfc3d7
1306 changed files with 364980 additions and 0 deletions
+85
View File
@@ -0,0 +1,85 @@
#!/bin/bash
# Checks the size of generated files and verifies they aren't growing
# unreasonably.
# These values should be updated with each release
# Size of blockly_compressed.js
# Q2 2019 2.20190722.0 812688
# Q3 2019 3.20191014.0 538781
# Q4 2019 3.20200123.0 609855
# Q1 2020 3.20200402.0 619341
# Q2 2020 3.20200625.0 621811
# Q3 2020 3.20200924.0 641216
blockly_size_expected=641216
# Size of blocks_compressed.js
# Q2 2019 2.20190722.0 75618
# Q3 2019 3.20191014.0 76455
# Q4 2019 3.20200123.0 75629
# Q1 2020 3.20200402.0 75805
# Q2 2020 3.20200625.0 76360
# Q3 2020 3.20200924.0 76429
blocks_size_expected=76429
# Size of blockly_compressed.js.gz
# Q2 2019 2.20190722.0 180925
# Q3 2019 3.20191014.0 119064
# Q4 2019 3.20200123.0 131897
# Q1 2020 3.20200402.0 134133
# Q2 2020 3.20200625.0 135181
# Q3 2020 3.20200924.0 138003
blockly_gz_size_expected=138003
# Size of blocks_compressed.js.gz
# Q2 2019 2.20190722.0 14552
# Q3 2019 3.20191014.0 15064
# Q4 2019 3.20200123.0 14897
# Q1 2020 3.20200402.0 14966
# Q2 2020 3.20200625.0 15195
# Q3 2020 3.20200924.0 15231
blocks_gz_size_expected=15231
# ANSI colors
BOLD_GREEN='\033[1;32m'
BOLD_RED='\033[1;31m'
ANSI_RESET='\033[0m'
# Build the compressed files for core and blocks
echo "Building files"
npm install
gulp buildCompressed
gulp buildBlocks
# GZip them for additional size comparisons
echo "Zipping the compressed files"
gzip -c blockly_compressed.js > blockly_compressed.js.gz
gzip -c blocks_compressed.js > blocks_compressed.js.gz
# Check the sizes of the files
has_failed=0
compare_size() {
local name=$1
local expected=$2
local compare=$(echo "$expected * 1.1 / 1" | bc)
local size=$(wc -c <"$name")
if (( $size > $compare))
then
echo -e "${BOLD_RED}Failed: Size of $name has grown more than 10%. $size vs $expected ${ANSI_RESET}" >&2
has_failed=1
else
echo -e "${BOLD_GREEN}Size of $name at $size compared to previous $expected.${ANSI_RESET}"
fi
}
compare_size "blockly_compressed.js" $blockly_size_expected
compare_size "blocks_compressed.js" $blocks_size_expected
compare_size "blockly_compressed.js.gz" $blockly_gz_size_expected
compare_size "blocks_compressed.js.gz" $blocks_gz_size_expected
exit $has_failed
@@ -0,0 +1,29 @@
#!/bin/bash
# ANSI colors
BOLD_GREEN='\033[1;32m'
BOLD_RED='\033[1;31m'
ANSI_RESET='\033[0m'
# Download TypeScript to obtain the compiler.
echo "Downloading TypeScript"
npm install typescript
# Generate Blockly typings.
echo "Generating Blockly typings"
npm run typings
# Use the TypeScript compiler to compile the generated typings.
echo "Compiling typings"
cd typings
../node_modules/.bin/tsc blockly.d.ts
if [ $? -eq 0 ]
then
echo -e "${BOLD_GREEN}TypeScript typings compiled successfully.${ANSI_RESET}"
exit 0
else
echo -e "${BOLD_RED}Failed to compile TypeScript typings.${ANSI_RESET}" >&2
exit 1
fi
+57
View File
@@ -0,0 +1,57 @@
#!/bin/bash
# ANSI colors
BOLD_GREEN='\033[1;32m'
BOLD_RED='\033[1;31m'
ANSI_RESET='\033[0m'
SUCCESS_PREFIX="${BOLD_GREEN}SUCCESS:${ANSI_RESET}"
FAILURE_PREFIX="${BOLD_RED}FAILED:${ANSI_RESET}"
TMP_DIR="tests/generators/tmp/"
GOLDEN_DIR="tests/generators/golden/"
FAILURE_COUNT=0
check_result() {
local suffix=$1 # One of: js, py, dart, lua, php
local tmp_filename="${TMP_DIR}generated.$suffix"
if [ -f $tmp_filename ]; then
local golden_filename="${GOLDEN_DIR}generated.$suffix"
if [ -f $golden_filename ]; then
if cmp --silent $tmp_filename $golden_filename; then
echo -e "$SUCCESS_PREFIX $suffix: $tmp_filename matches $golden_filename"
else
echo -e "$FAILURE_PREFIX $suffix: $tmp_filename does not match $golden_filename"
FAILURE_COUNT=$((FAILURE_COUNT+1))
fi
else
echo "File $golden_filename not found!"
FAILURE_COUNT=$((FAILURE_COUNT+1))
fi
else
echo "File $tmp_filename not found!"
FAILURE_COUNT=$((FAILURE_COUNT+1))
fi
}
mkdir $TMP_DIR
node tests/generators/run_generators_in_browser.js
generator_suffixes=( "js" "py" "dart" "lua" "php" )
for i in "${generator_suffixes[@]}"
do
check_result "$i"
done
# Clean up.
rm -r $TMP_DIR
if [ "$FAILURE_COUNT" -eq "0" ]; then
echo -e "${BOLD_GREEN}All generator tests passed.${ANSI_RESET}"
exit 0
else
echo -e "${BOLD_RED}Failures in ${FAILURE_COUNT} generator tests.${ANSI_RESET}"
exit 1
fi
@@ -0,0 +1,27 @@
/* eslint-disable */
module.exports = {
// check for more recent versions of selenium here:
// https://selenium-release.storage.googleapis.com/index.html
version: '3.9.1',
baseURL: 'https://selenium-release.storage.googleapis.com',
drivers: {
chrome: {
// check for more recent versions of chrome driver here:
// https://chromedriver.storage.googleapis.com/index.html
version: '87.0.4280.20',
arch: process.arch,
baseURL: 'https://chromedriver.storage.googleapis.com'
},
firefox: {
// check for more recent versions of chrome driver here:
// https://chromedriver.storage.googleapis.com/index.html
version: '0.21.0',
arch: process.arch,
baseURL: 'https://github.com/mozilla/geckodriver/releases/download'
},
},
requestOpts: { // see https://github.com/request/request#requestoptions-callback
timeout: 10000
},
};
@@ -0,0 +1,8 @@
#!/bin/bash
if [ "${RUNNER_OS}" == "Linux" ]
then
Xvfb :99 &
export DISPLAY=:99 &
npm run test:prepare > /dev/null &
fi
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
if [ "${TRAVIS_OS_NAME}" == "osx" ]
then
brew cask install google-chrome
sudo Xvfb :99 -ac -screen 0 1024x768x8 &
export CHROME_BIN="/Applications/Google Chrome.app"
npm run test:prepare > /dev/null &
fi