Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI script to check for diffs in src vs build for store release #1429

Merged
merged 9 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr-any.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
continue-on-error: true
strategy:
matrix:
step: ['lint', 'test', 'build']
step: ['lint', 'test', 'build', diff]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ docs/html
.idea
.vscode
packages/extension/manifest.json

# Diff script generates ff-diff
ff-diff
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"build:zip:src:chrome": "rm -rf ./master-chrome-src.zip && zip -r -x '*build/*' -x '*node_modules*' -FS ./master-chrome-src.zip packages .editorconfig eslint.config.js rollup.config.js CHANGELOG.md CONTRIBUTING.md i18next-scanner.config.cjs LICENSE package.json README.md tsconfig.json yarn.lock .yarnrc.yml tsconfig.base.json tsconfig.build.json tsconfig.eslint.json tsconfig.webpack.json",
"build:zip:src:ff": "rm -rf ./master-ff-src.zip && zip -r -x '*build/*' -x '*node_modules*' -FS ./master-ff-src.zip packages .editorconfig eslint.config.js rollup.config.js CHANGELOG.md CONTRIBUTING.md i18next-scanner.config.cjs LICENSE package.json README.md tsconfig.json yarn.lock .yarnrc.yml tsconfig.base.json tsconfig.build.json tsconfig.eslint.json tsconfig.webpack.json",
"clean": "polkadot-dev-clean-build",
"diff": "rm -rf ff-diff && sh ./scripts/diff.sh",
"lint": "polkadot-dev-run-lint",
"postinstall": "polkadot-dev-yarn-only",
"test": "EXTENSION_PREFIX='test' polkadot-dev-run-test --loader ./packages/extension-mocks/src/loader-empty.js --env browser ^:.spec.tsx",
Expand Down
53 changes: 53 additions & 0 deletions scripts/diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright 2019-2024 @polkadot/extension-compat-metamask authors & contributors
# SPDX-License-Identifier: Apache-2.0

#!/bin/bash

# build firefox target
yarn build:ff

# Reorg the builds to
mkdir ff-diff

OS=$(uname)
FILE_PATH="./ff-diff"

compare_directories() {
local dir1=$1
local dir2=$2

if diff -qr "$dir1" "$dir2" | sort; 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 ..
}

if [ "$OS" == "Darwin" || "$RUNNER_OS" == "Linux" ]; then
echo "Running on macOS"
# macOS-specific commands go here

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
else # Assuming it will be Linux
echo "Running on Linux"
# Linux-specific commands go here

mv -t $FILE_PATH ./master-ff-src.zip ./master-ff-build.zip && cd $FILE_PATH
unzip_ff

compare_directories ./master-ff-build ./master-ff-src/packages/extension/build
fi
Loading