From 49a32ffab1ecbf1f676dfcfc68c4a272ebb60c17 Mon Sep 17 00:00:00 2001 From: Hien To Date: Wed, 13 Dec 2023 11:59:00 +0700 Subject: [PATCH 1/6] Add check build extensions --- Makefile | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 13618cf6ac..2bd96d480c 100644 --- a/Makefile +++ b/Makefile @@ -21,11 +21,26 @@ endif yarn install yarn build:extensions -dev: install-and-build +# +check-file-counts: install-and-build +ifeq ($(OS),Windows_NT) + powershell -Command "$$tgz_count = (Get-ChildItem -Path electron/pre-install -Filter *.tgz | Measure-Object | Select-Object -ExpandProperty Count); $$dir_count = (Get-ChildItem -Path extensions -Directory | Measure-Object | Select-Object -ExpandProperty Count); if ($$tgz_count -ne $$dir_count) { Write-Host 'Number of .tgz files in electron/pre-install (' + $$tgz_count + ') does not match the number of subdirectories in extension (' + $$dir_count + ')'; exit 1 } else { Write-Host 'Extension build successful' }" +else + @tgz_count=$$(find electron/pre-install -name "*.tgz" | wc -l); \ + dir_count=$$(find extension -mindepth 1 -maxdepth 1 -type d | wc -l); \ + if [ $$tgz_count -ne $$dir_count ]; then \ + echo "Number of .tgz files in 'electron/pre-install' ($$tgz_count) does not match the number of subdirectories in 'extension' ($$dir_count)"; \ + exit 1; \ + else + echo "Extension build successful"; + fi +endif + +dev: check-file-counts yarn dev # Linting -lint: install-and-build +lint: check-file-counts yarn lint # Testing @@ -34,11 +49,11 @@ test: lint yarn test # Builds and publishes the app -build-and-publish: install-and-build +build-and-publish: check-file-counts yarn build:publish # Build -build: install-and-build +build: check-file-counts yarn build clean: From d9b4695b8e4a3d230ab65477bce1463431e6a355 Mon Sep 17 00:00:00 2001 From: Service Account Date: Wed, 13 Dec 2023 13:57:24 +0700 Subject: [PATCH 2/6] Correct Makefile check extenstions --- Makefile | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 2bd96d480c..3ce435571c 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ # Makefile for Jan Electron App - Build, Lint, Test, and Clean +.SHELLFLAGS := -eu -o pipefail -c + # Default target, does nothing all: @echo "Specify a target to run" @@ -21,19 +23,11 @@ endif yarn install yarn build:extensions -# check-file-counts: install-and-build ifeq ($(OS),Windows_NT) powershell -Command "$$tgz_count = (Get-ChildItem -Path electron/pre-install -Filter *.tgz | Measure-Object | Select-Object -ExpandProperty Count); $$dir_count = (Get-ChildItem -Path extensions -Directory | Measure-Object | Select-Object -ExpandProperty Count); if ($$tgz_count -ne $$dir_count) { Write-Host 'Number of .tgz files in electron/pre-install (' + $$tgz_count + ') does not match the number of subdirectories in extension (' + $$dir_count + ')'; exit 1 } else { Write-Host 'Extension build successful' }" else - @tgz_count=$$(find electron/pre-install -name "*.tgz" | wc -l); \ - dir_count=$$(find extension -mindepth 1 -maxdepth 1 -type d | wc -l); \ - if [ $$tgz_count -ne $$dir_count ]; then \ - echo "Number of .tgz files in 'electron/pre-install' ($$tgz_count) does not match the number of subdirectories in 'extension' ($$dir_count)"; \ - exit 1; \ - else - echo "Extension build successful"; - fi + @tgz_count=$$(find electron/pre-install -type f -name "*.tgz" | wc -l); dir_count=$$(find extensions -mindepth 1 -maxdepth 1 -type d | wc -l); if [ $$tgz_count -ne $$dir_count ]; then echo "Number of .tgz files in electron/pre-install ($$tgz_count) does not match the number of subdirectories in extension ($$dir_count)"; exit 1; else echo "Extension build successful"; fi endif dev: check-file-counts From ce0eb0b61443395ca23d3542611e19cee9909462 Mon Sep 17 00:00:00 2001 From: Hien To Date: Wed, 13 Dec 2023 11:59:00 +0700 Subject: [PATCH 3/6] Add check build extensions --- Makefile | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 13618cf6ac..2bd96d480c 100644 --- a/Makefile +++ b/Makefile @@ -21,11 +21,26 @@ endif yarn install yarn build:extensions -dev: install-and-build +# +check-file-counts: install-and-build +ifeq ($(OS),Windows_NT) + powershell -Command "$$tgz_count = (Get-ChildItem -Path electron/pre-install -Filter *.tgz | Measure-Object | Select-Object -ExpandProperty Count); $$dir_count = (Get-ChildItem -Path extensions -Directory | Measure-Object | Select-Object -ExpandProperty Count); if ($$tgz_count -ne $$dir_count) { Write-Host 'Number of .tgz files in electron/pre-install (' + $$tgz_count + ') does not match the number of subdirectories in extension (' + $$dir_count + ')'; exit 1 } else { Write-Host 'Extension build successful' }" +else + @tgz_count=$$(find electron/pre-install -name "*.tgz" | wc -l); \ + dir_count=$$(find extension -mindepth 1 -maxdepth 1 -type d | wc -l); \ + if [ $$tgz_count -ne $$dir_count ]; then \ + echo "Number of .tgz files in 'electron/pre-install' ($$tgz_count) does not match the number of subdirectories in 'extension' ($$dir_count)"; \ + exit 1; \ + else + echo "Extension build successful"; + fi +endif + +dev: check-file-counts yarn dev # Linting -lint: install-and-build +lint: check-file-counts yarn lint # Testing @@ -34,11 +49,11 @@ test: lint yarn test # Builds and publishes the app -build-and-publish: install-and-build +build-and-publish: check-file-counts yarn build:publish # Build -build: install-and-build +build: check-file-counts yarn build clean: From 6b262b8613f1466aa1b3237cde1e63f1c4495edb Mon Sep 17 00:00:00 2001 From: Service Account Date: Wed, 13 Dec 2023 13:57:24 +0700 Subject: [PATCH 4/6] Correct Makefile check extenstions --- Makefile | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 2bd96d480c..3ce435571c 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ # Makefile for Jan Electron App - Build, Lint, Test, and Clean +.SHELLFLAGS := -eu -o pipefail -c + # Default target, does nothing all: @echo "Specify a target to run" @@ -21,19 +23,11 @@ endif yarn install yarn build:extensions -# check-file-counts: install-and-build ifeq ($(OS),Windows_NT) powershell -Command "$$tgz_count = (Get-ChildItem -Path electron/pre-install -Filter *.tgz | Measure-Object | Select-Object -ExpandProperty Count); $$dir_count = (Get-ChildItem -Path extensions -Directory | Measure-Object | Select-Object -ExpandProperty Count); if ($$tgz_count -ne $$dir_count) { Write-Host 'Number of .tgz files in electron/pre-install (' + $$tgz_count + ') does not match the number of subdirectories in extension (' + $$dir_count + ')'; exit 1 } else { Write-Host 'Extension build successful' }" else - @tgz_count=$$(find electron/pre-install -name "*.tgz" | wc -l); \ - dir_count=$$(find extension -mindepth 1 -maxdepth 1 -type d | wc -l); \ - if [ $$tgz_count -ne $$dir_count ]; then \ - echo "Number of .tgz files in 'electron/pre-install' ($$tgz_count) does not match the number of subdirectories in 'extension' ($$dir_count)"; \ - exit 1; \ - else - echo "Extension build successful"; - fi + @tgz_count=$$(find electron/pre-install -type f -name "*.tgz" | wc -l); dir_count=$$(find extensions -mindepth 1 -maxdepth 1 -type d | wc -l); if [ $$tgz_count -ne $$dir_count ]; then echo "Number of .tgz files in electron/pre-install ($$tgz_count) does not match the number of subdirectories in extension ($$dir_count)"; exit 1; else echo "Extension build successful"; fi endif dev: check-file-counts From 6945a216538737d834ec0185869deea059b0219a Mon Sep 17 00:00:00 2001 From: Hien To Date: Wed, 13 Dec 2023 14:18:09 +0700 Subject: [PATCH 5/6] Include Makefile change will run test --- .github/workflows/jan-electron-linter-and-test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/jan-electron-linter-and-test.yml b/.github/workflows/jan-electron-linter-and-test.yml index dd3656101b..d4689ca60c 100644 --- a/.github/workflows/jan-electron-linter-and-test.yml +++ b/.github/workflows/jan-electron-linter-and-test.yml @@ -14,6 +14,7 @@ on: - "core/**" - "extensions/**" - "!README.md" + - "Makefile" pull_request: branches: @@ -26,6 +27,7 @@ on: - "package.json" - "node_modules/**" - "yarn.lock" + - "Makefile" jobs: test-on-macos: From 8ff780c51db854a8be311fd41db2d95cc4f9d6c1 Mon Sep 17 00:00:00 2001 From: Hien To Date: Wed, 13 Dec 2023 14:24:32 +0700 Subject: [PATCH 6/6] Fix error on linux --- Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Makefile b/Makefile index 3ce435571c..cb70715d5e 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,5 @@ # Makefile for Jan Electron App - Build, Lint, Test, and Clean -.SHELLFLAGS := -eu -o pipefail -c - # Default target, does nothing all: @echo "Specify a target to run"