Skip to content

Commit

Permalink
introduce Desktop Build Checks: non regression on bundle size, librar…
Browse files Browse the repository at this point in the history
…y duplicates,... (#5346)

chore: introduce desktop-build-checks
  • Loading branch information
valpinkman authored Nov 13, 2023
1 parent 84e1c20 commit 47dcce5
Show file tree
Hide file tree
Showing 96 changed files with 72,299 additions and 257,773 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/build-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,35 @@ jobs:
runs-on: ubuntu-latest
if: always() && !cancelled() && github.event_name == 'workflow_dispatch'
steps:
- uses: LedgerHQ/ledger-live/tools/actions/composites/checkout-merge@develop
with:
ref: ${{ (github.event_name == 'workflow_dispatch' && (inputs.ref || github.ref_name)) || github.sha }}
base: ${{ inputs.base_ref }}
persist-credentials: false
- name: generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.GH_BOT_APP_ID }}
private_key: ${{ secrets.GH_BOT_PRIVATE_KEY }}
- uses: actions/download-artifact@v3
with:
name: linux-js-bundle-metafiles
path: linux-js-bundle-metafiles
- uses: actions/download-artifact@v3
with:
name: windows-js-bundle-metafiles
path: windows-js-bundle-metafiles
- uses: actions/download-artifact@v3
with:
name: mac-js-bundle-metafiles
path: mac-js-bundle-metafiles
- uses: ./tools/actions/desktop-build-checks
if: inputs.prNumber != ''
with:
token: ${{ steps.generate-token.outputs.token }}
baseBranch: ${{ inputs.base_ref || 'develop' }}
prNumber: ${{ inputs.prNumber }}
- uses: actions/github-script@v6
name: build summary
with:
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@ledgerhq/types-live": "workspace:^",
"@types/command-line-args": "^5.2.0",
"@types/lodash": "^4.14.177",
"@types/node": "^18.0.0",
"@types/node": "^20.8.10",
"@types/pako": "^2.0.0",
"ts-node": "^10.4.0"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const ConnectEnvsToSentry = () => {
// We need to wait firebase to load the data and then we set once for all the tags
const timeout = setTimeout(syncTheTags, 5000);
// We also try to regularly update them so we are sure to get the correct tags (as these are dynamic)
const interval = setInterval(syncTheTags, 60000);
const interval = window.setInterval(syncTheTags, 60000);
return () => {
clearTimeout(timeout);
clearInterval(interval);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const Unbonding = (
return moment.utc(moment.duration(counter, "seconds").asMilliseconds()).format(format);
}, [counter]);
const handleCounter = () => {
const interval = setInterval(() => setCounter(timer => timer - 1), 1000);
const interval = window.setInterval(() => setCounter(timer => timer - 1), 1000);
return () => {
clearInterval(interval);
setCounter(seconds);
Expand Down
2 changes: 1 addition & 1 deletion apps/ledger-live-desktop/src/renderer/hooks/useInterval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const useInterval = (callback: Function, delay: number) => {
savedCallback.current();
}
if (delay !== null) {
const id = setInterval(tick, delay);
const id = window.setInterval(tick, delay);
return () => clearInterval(id);
}
}, [delay]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function Countdown({ refreshTime, rates }: Props) {
setIconKey(key => key + 1);
const startTime = new Date().getTime();
setCountdown(getSeconds(refreshTime));
const countdownInterval = setInterval(() => {
const countdownInterval = window.setInterval(() => {
const now = new Date().getTime();
const newCountdown = refreshTime + startTime - now;
setCountdown(getSeconds(newCountdown));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useTranslation } from "react-i18next";
function Loader() {
const [dots, setDots] = useState("");
useEffect(() => {
const interval = setInterval(() => {
const interval = window.setInterval(() => {
setDots(dots => (dots.length < 3 ? dots + "." : ""));
}, 500);
return () => clearInterval(interval);
Expand Down
6 changes: 4 additions & 2 deletions apps/ledger-live-desktop/tests/utils/waitFor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ export async function waitFor(
const interval = setInterval(async () => {
const condition = await predicate();
if (condition) {
clearTimeout(interval);
// @ts-expect-error web vs node Timers
clearInterval(interval);
resolve(true);
}
}, intervalMs);

setTimeout(() => {
clearTimeout(interval);
// @ts-expect-error web vs node Timers
clearInterval(interval);
reject(new Error("waitFor timeout"));
}, timeout);
});
Expand Down
12 changes: 0 additions & 12 deletions apps/ledger-live-desktop/tools/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,6 @@ const build = async argv => {
fs.writeFileSync("metafile.renderer.json", JSON.stringify(results[3].metafile), "utf-8");
fs.writeFileSync("metafile.renderer.worker.json", JSON.stringify(results[4].metafile), "utf-8");
}

// Ensure that we keep our bundle size under thresholds
if (results[0].metafile.outputs[".webpack/main.bundle.js"].bytes > 5 * 1024 * 1024) {
throw new Error(
"main bundle must be kept under 5 MB. This indicates a possible regression of importing too much modules. Most of Ledger Live must be run on renderer side.",
);
}
if (results[3].metafile.outputs[".webpack/renderer.bundle.js"].bytes > 40 * 1024 * 1024) {
throw new Error(
"renderer bundle must be kept under 40 MB. This indicates a possible regression of importing too much modules. If you change the threshold, please justify why / schedule tech debt tasks to reduce it back to lower.",
);
}
};

yargs
Expand Down
2 changes: 1 addition & 1 deletion apps/web-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"devDependencies": {
"@types/invariant": "^2.2.35",
"@types/lodash": "^4.14.198",
"@types/node": "20.8.9",
"@types/node": "20.8.10",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.13",
"@types/react-inspector": "^4.0.2",
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/node": "^20.6.5",
"@types/node": "^20.8.10",
"eslint-config-next": "13.5.4",
"typescript": "^5.2.2"
}
Expand Down
2 changes: 1 addition & 1 deletion libs/domain-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"@testing-library/react": "12",
"@testing-library/react-hooks": "^8.0.0",
"@types/jest": "^28.1.3",
"@types/node": "^18.15.7",
"@types/node": "^20.8.10",
"@types/testing-library__jest-dom": "^5.14.5",
"cross-env": "^7.0.3",
"eslint-plugin-jest": "^27.4.2",
Expand Down
2 changes: 1 addition & 1 deletion libs/evm-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@ledgerhq/types-live": "workspace:^",
"@types/crypto-js": "^4.1.1",
"@types/jest": "^28.1.8",
"@types/node": "^18.15.7",
"@types/node": "^20.8.10",
"jest": "^28.1.3",
"ts-jest": "^28.0.8"
},
Expand Down
2 changes: 1 addition & 1 deletion libs/ledger-live-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
"@types/cbor": "^6.0.0",
"@types/jest": "^27.5.0",
"@types/lodash": "^4.14.179",
"@types/node": "^18",
"@types/node": "^20.8.10",
"@types/object-hash": "^2.1.0",
"@types/react": "^18.2.21",
"@types/uuid": "^8.3.4",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"devDependencies": {
"@types/jest": "^29.5.4",
"@types/node": "^20.5.7",
"@types/node": "^20.8.10",
"eslint-plugin-react": "^7.33.2",
"jest": "^29.7.0",
"ts-jest": "^29.1.1",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/cryptoassets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@ledgerhq/types-cryptoassets": "workspace:^",
"@types/bs58check": "^2.1.0",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"documentation": "13.2.5",
"jest": "^28.1.1",
"rimraf": "^4.4.1",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/devices/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
},
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"@types/semver": "^7.3.9",
"documentation": "13.2.5",
"jest": "^28.1.1",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"gitHead": "dd0dea64b58e5a9125c8a422dcffd29e5ef6abec",
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"documentation": "13.2.5",
"jest": "^28.1.1",
"rimraf": "^4.4.1",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/hw-app-algorand/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"devDependencies": {
"@ledgerhq/hw-transport-mocker": "workspace:^",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"documentation": "13.2.5",
"jest": "^28.1.1",
"rimraf": "^4.4.1",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/hw-app-btc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"@ledgerhq/hw-transport-mocker": "workspace:^",
"@ledgerhq/hw-transport-node-speculos": "workspace:^",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"axios": "^0.25.0",
"documentation": "13.2.5",
"jest": "^28.1.1",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/hw-app-cosmos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"devDependencies": {
"@ledgerhq/hw-transport-mocker": "workspace:^",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"documentation": "13.2.5",
"jest": "^28.1.1",
"rimraf": "^4.4.1",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/hw-app-eth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"gitHead": "dd0dea64b58e5a9125c8a422dcffd29e5ef6abec",
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"documentation": "13.2.5",
"ethers": "5.6.9",
"jest": "^28.1.1",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/hw-app-exchange/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@ledgerhq/hw-transport-mocker": "workspace:^",
"@ledgerhq/hw-transport-node-speculos-http": "workspace:^",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"documentation": "13.2.5",
"jest": "^28.1.1",
"protobufjs": "7.2.5",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/hw-app-helium/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@ledgerhq/hw-transport-mocker": "workspace:^",
"@ledgerhq/hw-transport-node-speculos": "workspace:^",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"axios": "^0.26.1",
"documentation": "13.2.5",
"jest": "^28.1.1",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/hw-app-near/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"devDependencies": {
"@ledgerhq/hw-transport-mocker": "workspace:^",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"documentation": "13.2.5",
"jest": "^28.1.1",
"rimraf": "^4.4.1",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/hw-app-polkadot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"devDependencies": {
"@ledgerhq/hw-transport-mocker": "workspace:^",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"documentation": "13.2.5",
"jest": "^28.1.1",
"rimraf": "^4.4.1",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/hw-app-solana/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@ledgerhq/hw-transport-mocker": "workspace:^",
"@ledgerhq/hw-transport-node-speculos": "workspace:^",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"axios": "^0.26.1",
"documentation": "13.2.5",
"jest": "^28.1.1",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/hw-app-str/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"devDependencies": {
"@ledgerhq/hw-transport-mocker": "workspace:^",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"documentation": "13.2.5",
"jest": "^28.1.1",
"rimraf": "^4.4.1",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/hw-app-tezos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"devDependencies": {
"@ledgerhq/hw-transport-mocker": "workspace:^",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"documentation": "13.2.5",
"jest": "^28.1.1",
"rimraf": "^4.4.1",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/hw-app-trx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"devDependencies": {
"@ledgerhq/hw-transport-mocker": "workspace:^",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"documentation": "13.2.5",
"jest": "^28.1.1",
"rimraf": "^4.4.1",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/hw-app-xrp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"devDependencies": {
"@ledgerhq/hw-transport-mocker": "workspace:^",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"documentation": "13.2.5",
"jest": "^28.1.1",
"rimraf": "^4.4.1",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/hw-transport-http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"gitHead": "dd0dea64b58e5a9125c8a422dcffd29e5ef6abec",
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"documentation": "13.2.5",
"jest": "^28.1.1",
"rimraf": "^4.4.1",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/hw-transport-mocker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"gitHead": "dd0dea64b58e5a9125c8a422dcffd29e5ef6abec",
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"documentation": "13.2.5",
"jest": "^28.1.1",
"rimraf": "^4.4.1",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/hw-transport-node-ble/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"gitHead": "dd0dea64b58e5a9125c8a422dcffd29e5ef6abec",
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"documentation": "13.2.5",
"jest": "^28.1.1",
"rimraf": "^4.4.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"@types/node-hid": "^1.3.1",
"documentation": "13.2.5",
"jest": "^28.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"gitHead": "dd0dea64b58e5a9125c8a422dcffd29e5ef6abec",
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"documentation": "13.2.5",
"jest": "^28.1.1",
"rimraf": "^4.4.1",
Expand Down
2 changes: 1 addition & 1 deletion libs/ledgerjs/packages/hw-transport-node-hid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"gitHead": "dd0dea64b58e5a9125c8a422dcffd29e5ef6abec",
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"documentation": "13.2.5",
"jest": "^28.1.1",
"rimraf": "^4.4.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"gitHead": "dd0dea64b58e5a9125c8a422dcffd29e5ef6abec",
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"documentation": "13.2.5",
"jest": "^28.1.1",
"rimraf": "^4.4.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"gitHead": "dd0dea64b58e5a9125c8a422dcffd29e5ef6abec",
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/node": "^20.8.10",
"documentation": "13.2.5",
"jest": "^28.1.1",
"rimraf": "^4.4.1",
Expand Down
Loading

2 comments on commit 47dcce5

@vercel
Copy link

@vercel vercel bot commented on 47dcce5 Nov 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ledger-live-github-bot – ./tools/github-bot

ledger-live-github-bot.vercel.app
ledger-live-github-bot-ledgerhq.vercel.app
ledger-live-github-bot-git-develop-ledgerhq.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 47dcce5 Nov 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.