Files
pezkuwi-extension/scripts/diff.sh
T
Kurdistan Tech Ministry 758d346078 Make the Firefox source build reproducible, and let its check fail
The diff step rebuilds the extension from master-ff-src.zip (the source
archive AMO reviews) and compares the result with our build. It had never
worked, which the removed continue-on-error was hiding:

- The source zip left out .yarn/releases (yarnPath points there, so yarn
  could not start in the unpacked source) and scripts/ (build:ff runs
  scripts/postbuild-cleanup.cjs). Both are now included.
- diff.sh used `[ a || b ]`, which is not valid test syntax, and piped
  `diff -qr` into `sort`, so the check exited 0 whatever diff found. It now
  goes by diff's own exit status; with a file altered it fails.
- With those fixed, the builds still differed: webpack inlined
  import.meta.url from @pezkuwi/* packageInfo.js as the absolute file://
  path of the build machine, which also put our build directory into the
  published extension. DefinePlugin now gives it a fixed value; it is only
  shown in duplicate-version warnings.

Also fail-fast: false on the matrix. Without continue-on-error, the first
red step cancelled the others, so their results were lost.

Checked locally with node_modules as locked: "Builds are identical".
2026-10-08 09:07:34 +04:00

42 lines
918 B
Bash

# Copyright 2019-2026 @pezkuwi/extension authors & contributors
# SPDX-License-Identifier: Apache-2.0
#!/bin/bash
# build firefox target
yarn build:ff
# Reorg the builds to
mkdir ff-diff
FILE_PATH="./ff-diff"
compare_directories() {
local dir1=$1
local dir2=$2
# diff's own exit status decides; piped into sort it was always 0, so builds
# that differed were reported as identical.
if diff -qr "$dir1" "$dir2"; then
echo "Builds are identical"
exit 0
else
echo "Builds are not identical"
exit 1
fi
}
unzip_ff() {
unzip -o master-ff-src.zip -d master-ff-src
unzip -o master-ff-build.zip -d master-ff-build
cd ./master-ff-src && yarn install && yarn build:ff && cd ..
}
mv ./master-ff-src.zip ./master-ff-build.zip "$FILE_PATH" && cd "$FILE_PATH"
unzip_ff
compare_directories ./master-ff-build ./master-ff-src/packages/extension/build