mirror of
https://github.com/bitwarden/browser
synced 2025-12-13 14:53:33 +00:00
BRE-883 build(firefox): check file size (#15399)
* build(firefox): check file size
if building `firefox` or `firefox-mv3`
* check if any file(s) exceeds 4M (megabytes)
- If true, fail and provide basic message.
* style: add clarity
sytle: add error message
* fix: relocate step
ensure final step of source files before validating
* test: add failure condition
* fix: source file target directory
* fix: test for failure condition
* test: remove failure condition
remove lines used for testing
This commit is contained in:
23
.github/workflows/build-browser.yml
vendored
23
.github/workflows/build-browser.yml
vendored
@@ -268,6 +268,29 @@ jobs:
|
|||||||
working-directory: browser-source/
|
working-directory: browser-source/
|
||||||
run: npm link ../sdk-internal
|
run: npm link ../sdk-internal
|
||||||
|
|
||||||
|
- name: Check source file size
|
||||||
|
if: ${{ startsWith(matrix.name, 'firefox') }}
|
||||||
|
run: |
|
||||||
|
# Declare variable as indexed array
|
||||||
|
declare -a FILES
|
||||||
|
|
||||||
|
# Search for source files that are greater than 4M
|
||||||
|
TARGET_DIR='./browser-source/apps/browser'
|
||||||
|
while IFS=' ' read -r RESULT; do
|
||||||
|
FILES+=("$RESULT")
|
||||||
|
done < <(find $TARGET_DIR -size +4M)
|
||||||
|
|
||||||
|
# Validate results and provide messaging
|
||||||
|
if [[ ${#FILES[@]} -ne 0 ]]; then
|
||||||
|
echo "File(s) exceeds size limit: 4MB"
|
||||||
|
for FILE in ${FILES[@]}; do
|
||||||
|
echo "- $(du --si $FILE)"
|
||||||
|
done
|
||||||
|
echo "ERROR Firefox rejects extension uploads that contain files larger than 4MB"
|
||||||
|
# Invoke failure
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Build extension
|
- name: Build extension
|
||||||
run: npm run ${{ matrix.npm_command }}
|
run: npm run ${{ matrix.npm_command }}
|
||||||
working-directory: browser-source/apps/browser
|
working-directory: browser-source/apps/browser
|
||||||
|
|||||||
Reference in New Issue
Block a user