From 6633bac8dceb1afd83f65165f38aebdde58c1fc8 Mon Sep 17 00:00:00 2001 From: Roma Sosnovsky Date: Tue, 23 Jun 2026 16:18:37 +0300 Subject: [PATCH 1/2] optimize semaphore.yml --- .semaphore/semaphore.yml | 67 ++++++++++++++++------------------------ package.json | 4 ++- 2 files changed, 29 insertions(+), 42 deletions(-) diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index 8d29a25bee4..0ac3c6f0abb 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -17,17 +17,20 @@ blocks: minutes: 45 task: secrets: - - name: flowcrypt-browser-ci-secrets + - &flowcrypt_ci_secrets + name: flowcrypt-browser-ci-secrets env_vars: - - name: SEMAPHORE_GIT_DIR + - &flowcrypt_git_dir + name: SEMAPHORE_GIT_DIR value: /home/semaphore/git/flowcrypt-browser prologue: - commands: + commands: &flowcrypt_ci_prologue - mkdir ~/git && checkout && mv ~/test-secrets.json ~/git/flowcrypt-browser/test/test-secrets.json - cd ~/git/flowcrypt-browser - - npm install + - cache restore flowcrypt-browser-npm-$(checksum package-lock.json) || true + - npm ci --cache ~/.npm --prefer-offline + - cache store flowcrypt-browser-npm-$(checksum package-lock.json) ~/.npm || true - 'echo "NODE=$(node --version), NPM=$(npm --version), TSC=$( ./node_modules/typescript/bin/tsc --version)"' - - npm run-script pretest jobs: - name: consumer mock - standard test group commands: @@ -44,10 +47,13 @@ blocks: commands: - npm run-script test_ci_chrome_enterprise epilogue: - always: + always: &flowcrypt_ci_epilogue_always commands: - - '[[ -f report.xml ]] && test-results publish report.xml' - on_fail: + - | + if [[ -f report.xml ]]; then + test-results publish report.xml + fi + on_fail: &flowcrypt_ci_epilogue_on_fail commands: - | shopt -s nullglob @@ -64,33 +70,18 @@ blocks: minutes: 60 task: secrets: - - name: flowcrypt-browser-ci-secrets + - *flowcrypt_ci_secrets env_vars: - - name: SEMAPHORE_GIT_DIR - value: /home/semaphore/git/flowcrypt-browser + - *flowcrypt_git_dir prologue: - commands: - - mkdir ~/git && checkout && mv ~/test-secrets.json ~/git/flowcrypt-browser/test/test-secrets.json - - cd ~/git/flowcrypt-browser - - npm install - - 'echo "NODE=$(node --version), NPM=$(npm --version), TSC=$( ./node_modules/typescript/bin/tsc --version)"' - - npm run-script pretest + commands: *flowcrypt_ci_prologue jobs: - name: Live Gmail tests commands: - npm run-script test_ci_chrome_consumer_live_gmail epilogue: - always: - commands: - - '[[ -f report.xml ]] && test-results publish report.xml' - on_fail: - commands: - - | - shopt -s nullglob - for file in build/test/test/debugArtifacts/debugHtmlAttachment-*.html; do - echo "Uploading debug file $file as job artifact..." - artifact push job "$file" --force - done + always: *flowcrypt_ci_epilogue_always + on_fail: *flowcrypt_ci_epilogue_on_fail - name: Other tests dependencies: [] @@ -102,17 +93,11 @@ blocks: type: e1-standard-2 os_image: ubuntu2404 secrets: - - name: flowcrypt-browser-ci-secrets + - *flowcrypt_ci_secrets env_vars: - - name: SEMAPHORE_GIT_DIR - value: /home/semaphore/git/flowcrypt-browser + - *flowcrypt_git_dir prologue: - commands: - - mkdir ~/git && checkout && mv ~/test-secrets.json ~/git/flowcrypt-browser/test/test-secrets.json - - cd ~/git/flowcrypt-browser - - npm install - - 'echo "NODE=$(node --version), NPM=$(npm --version), TSC=$( ./node_modules/typescript/bin/tsc --version)"' - - npm run-script pretest + commands: *flowcrypt_ci_prologue jobs: - name: code quality commands: @@ -125,12 +110,12 @@ blocks: - npm run-script test_buf - name: consumer mock - unit tests commands: - - npm run-script test_local_unit_consumer - - '[[ -f report.xml ]] && test-results publish report.xml' + - npm run-script test_ci_unit_consumer - name: enterprise mock - unit tests commands: - - npm run-script test_local_unit_enterprise - - '[[ -f report.xml ]] && test-results publish report.xml' + - npm run-script test_ci_unit_enterprise + epilogue: + always: *flowcrypt_ci_epilogue_always after_pipeline: task: diff --git a/package.json b/package.json index 4ca19b3d29d..9b3960c84c7 100644 --- a/package.json +++ b/package.json @@ -77,6 +77,8 @@ "test_local_chrome_consumer_mock_flaky": "npm run pretest && npm run test_ci_chrome_consumer_flaky -- -- --pool-size=1 --retry=false --debug", "test_local_unit_consumer": "npm run pretest && npx ava --timeout=20m --verbose --tap --concurrency=10 build/test/test/source/test.js -- UNIT-TESTS --retry=false --pool-size=1 --debug CONSUMER-MOCK | npx tap-xunit > report.xml", "test_local_unit_enterprise": "npm run pretest && npx ava --timeout=20m --verbose --tap --concurrency=10 build/test/test/source/test.js -- UNIT-TESTS --retry=false --pool-size=1 --debug ENTERPRISE-MOCK | npx tap-xunit > report.xml", + "test_ci_unit_consumer": "bash -o pipefail -c 'npx ava --timeout=20m --verbose --tap --concurrency=10 build/test/test/source/test.js -- UNIT-TESTS --retry=false --pool-size=1 --debug CONSUMER-MOCK | npx tap-xunit > report.xml'", + "test_ci_unit_enterprise": "bash -o pipefail -c 'npx ava --timeout=20m --verbose --tap --concurrency=10 build/test/test/source/test.js -- UNIT-TESTS --retry=false --pool-size=1 --debug ENTERPRISE-MOCK | npx tap-xunit > report.xml'", "test_local_chrome_consumer_mock_headless": "xvfb-run npm run test_local_chrome_consumer_mock", "test_stylelint": "stylelint extension/css/cryptup.css extension/css/settings.css extension/css/webmail.css && stylelint extension/**/*.htm --custom-syntax postcss-html", "test_eslint": "cross-env NODE_OPTIONS=--max-old-space-size=4096 eslint .", @@ -88,7 +90,7 @@ "test_ci_chrome_consumer": "npx ava --timeout=30m --verbose --concurrency=10 build/test/test/source/test.js -- CONSUMER-MOCK STANDARD-GROUP", "test_ci_chrome_enterprise": "npx ava --timeout=30m --verbose --tap --concurrency=10 build/test/test/source/test.js -- ENTERPRISE-MOCK STANDARD-GROUP | npx tap-xunit > report.xml", "test_ci_chrome_consumer_flaky": "npx ava --timeout=30m --verbose --tap --concurrency=1 build/test/test/source/test.js -- CONSUMER-MOCK FLAKY-GROUP --pool-size=3 | npx tap-xunit > report.xml", - "test_ci_chrome_content_scripts": "npx ava --timeout=3m --verbose --tap build/test/test/source/test.js -- CONTENT-SCRIPT-TESTS --pool-size=1 > report.xml", + "test_ci_chrome_content_scripts": "bash -o pipefail -c 'npx ava --timeout=3m --verbose --tap build/test/test/source/test.js -- CONTENT-SCRIPT-TESTS --pool-size=1 | npx tap-xunit > report.xml'", "dev_start_gmail_mock_api": "./scripts/build.sh && cd ./conf && node ../build/tooling/tsc-compiler --project tsconfig.test.json && cd .. && node ./build/test/test/source/mock.js", "run_firefox": "npm run build-incremental && npx web-ext run --source-dir ./build/firefox-consumer/ --firefox-profile ~/.mozilla/firefox/flowcrypt-dev --keep-profile-changes", "run_firefox_windows": "npm run build-incremental && npx web-ext run --source-dir ./build/firefox-consumer/ --firefox-profile %userprofile%/AppData/Local/Mozilla/Firefox/Profiles/flowcrypt-dev --keep-profile-changes", From e959fa58776b11b6d7b22572abc37066f74834c4 Mon Sep 17 00:00:00 2001 From: Roma Sosnovsky Date: Fri, 26 Jun 2026 13:52:34 +0300 Subject: [PATCH 2/2] revert some changes --- .semaphore/semaphore.yml | 6 ++++-- package.json | 4 +--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index 0ac3c6f0abb..b79b8f34ed0 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -110,10 +110,12 @@ blocks: - npm run-script test_buf - name: consumer mock - unit tests commands: - - npm run-script test_ci_unit_consumer + - npm run-script test_local_unit_consumer + - '[[ -f report.xml ]] && test-results publish report.xml' - name: enterprise mock - unit tests commands: - - npm run-script test_ci_unit_enterprise + - npm run-script test_local_unit_enterprise + - '[[ -f report.xml ]] && test-results publish report.xml' epilogue: always: *flowcrypt_ci_epilogue_always diff --git a/package.json b/package.json index 9b3960c84c7..4ca19b3d29d 100644 --- a/package.json +++ b/package.json @@ -77,8 +77,6 @@ "test_local_chrome_consumer_mock_flaky": "npm run pretest && npm run test_ci_chrome_consumer_flaky -- -- --pool-size=1 --retry=false --debug", "test_local_unit_consumer": "npm run pretest && npx ava --timeout=20m --verbose --tap --concurrency=10 build/test/test/source/test.js -- UNIT-TESTS --retry=false --pool-size=1 --debug CONSUMER-MOCK | npx tap-xunit > report.xml", "test_local_unit_enterprise": "npm run pretest && npx ava --timeout=20m --verbose --tap --concurrency=10 build/test/test/source/test.js -- UNIT-TESTS --retry=false --pool-size=1 --debug ENTERPRISE-MOCK | npx tap-xunit > report.xml", - "test_ci_unit_consumer": "bash -o pipefail -c 'npx ava --timeout=20m --verbose --tap --concurrency=10 build/test/test/source/test.js -- UNIT-TESTS --retry=false --pool-size=1 --debug CONSUMER-MOCK | npx tap-xunit > report.xml'", - "test_ci_unit_enterprise": "bash -o pipefail -c 'npx ava --timeout=20m --verbose --tap --concurrency=10 build/test/test/source/test.js -- UNIT-TESTS --retry=false --pool-size=1 --debug ENTERPRISE-MOCK | npx tap-xunit > report.xml'", "test_local_chrome_consumer_mock_headless": "xvfb-run npm run test_local_chrome_consumer_mock", "test_stylelint": "stylelint extension/css/cryptup.css extension/css/settings.css extension/css/webmail.css && stylelint extension/**/*.htm --custom-syntax postcss-html", "test_eslint": "cross-env NODE_OPTIONS=--max-old-space-size=4096 eslint .", @@ -90,7 +88,7 @@ "test_ci_chrome_consumer": "npx ava --timeout=30m --verbose --concurrency=10 build/test/test/source/test.js -- CONSUMER-MOCK STANDARD-GROUP", "test_ci_chrome_enterprise": "npx ava --timeout=30m --verbose --tap --concurrency=10 build/test/test/source/test.js -- ENTERPRISE-MOCK STANDARD-GROUP | npx tap-xunit > report.xml", "test_ci_chrome_consumer_flaky": "npx ava --timeout=30m --verbose --tap --concurrency=1 build/test/test/source/test.js -- CONSUMER-MOCK FLAKY-GROUP --pool-size=3 | npx tap-xunit > report.xml", - "test_ci_chrome_content_scripts": "bash -o pipefail -c 'npx ava --timeout=3m --verbose --tap build/test/test/source/test.js -- CONTENT-SCRIPT-TESTS --pool-size=1 | npx tap-xunit > report.xml'", + "test_ci_chrome_content_scripts": "npx ava --timeout=3m --verbose --tap build/test/test/source/test.js -- CONTENT-SCRIPT-TESTS --pool-size=1 > report.xml", "dev_start_gmail_mock_api": "./scripts/build.sh && cd ./conf && node ../build/tooling/tsc-compiler --project tsconfig.test.json && cd .. && node ./build/test/test/source/mock.js", "run_firefox": "npm run build-incremental && npx web-ext run --source-dir ./build/firefox-consumer/ --firefox-profile ~/.mozilla/firefox/flowcrypt-dev --keep-profile-changes", "run_firefox_windows": "npm run build-incremental && npx web-ext run --source-dir ./build/firefox-consumer/ --firefox-profile %userprofile%/AppData/Local/Mozilla/Firefox/Profiles/flowcrypt-dev --keep-profile-changes",