From e98a890a1aaf7b516ea26c1a38d4edfcc3c78cbb Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Mon, 9 Oct 2023 13:06:49 -0700 Subject: [PATCH 01/13] chore: switch from circle ci to github actions --- .circleci/config.yml | 428 ------------------- .github/workflows/benchmark.yml | 4 +- .github/workflows/integration.yml | 47 ++ .github/workflows/karma.yml | 62 +++ .github/workflows/unit.yml | 55 +++ nx.json | 4 + package.json | 1 + packages/@lwc/integration-karma/package.json | 4 +- packages/@lwc/integration-tests/package.json | 4 +- scripts/ci/retry.sh | 20 + 10 files changed, 197 insertions(+), 432 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/integration.yml create mode 100644 .github/workflows/karma.yml create mode 100644 .github/workflows/unit.yml create mode 100755 scripts/ci/retry.sh diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index a65b78a2c3..0000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,428 +0,0 @@ -orbs: - browser-tools: circleci/browser-tools@1.4.4 - -# Shared config -ignore_forks: &ignore_forks - branches: - # Forked pull requests have CIRCLE_BRANCH set to pull/XXX - ignore: /pull\/[0-9]+/ - -only_forks: &only_forks - branches: - # Forked pull requests have CIRCLE_BRANCH set to pull/XXX - only: /pull\/[0-9]+/ - -# Jobs definition -version: 2.1 - - -# Custom executors definition -executors: - node: - working_directory: ~/lwc - docker: - - image: cimg/node:18.18.0 - node-browsers: - working_directory: ~/lwc - docker: - - image: cimg/node:18.18.0-browsers - - -# Custom commands definition -commands: - # Based on https://circleci.com/developer/orbs/orb/kimh/run-with-retry - retry_command: - description: Retry command multiple times until it succeeds - parameters: - command: - type: string - command_name: - type: string - working_directory: - type: string - retry_count: - type: integer - default: 3 - coverage: - type: boolean - default: false - legacy_browsers: - type: boolean - default: false - disable_synthetic: - type: boolean - default: false - force_native_shadow_mode: - type: boolean - default: false - api_version: - type: integer - default: -1 # treated as "latest" in this config - enable_native_custom_element_lifecycle: - type: boolean - default: false - disable_aria_reflection_polyfill: - type: boolean - default: false - node_env_production: - type: boolean - default: false - disable_synthetic_shadow_support_in_compiler: - type: boolean - default: false - steps: - - run: - name: << parameters.command_name >> - working_directory: << parameters.working_directory >> - command: | - retry() { - MAX_RETRY=<< parameters.retry_count >> - n=0 - until [ $n -ge $MAX_RETRY ] - do - echo "Try $[$n+1]/$MAX_RETRY..." - "$@" && break - n=$[$n+1] - done - if [ $n -ge $MAX_RETRY ]; then - echo "Failed: ${@}" >&2 - exit 1 - fi - } - if [ "<< parameters.api_version >>" -ne "-1" ]; then - export API_VERSION=<< parameters.api_version >> - fi - <<# parameters.disable_synthetic >> DISABLE_SYNTHETIC=1 <> \ - <<# parameters.force_native_shadow_mode >> FORCE_NATIVE_SHADOW_MODE_FOR_TEST=1 <> \ - <<# parameters.enable_native_custom_element_lifecycle >> ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE=1 <> \ - <<# parameters.disable_aria_reflection_polyfill >> DISABLE_ARIA_REFLECTION_POLYFILL=1 <> \ - <<# parameters.node_env_production >> NODE_ENV_FOR_TEST=production <> \ - <<# parameters.disable_synthetic_shadow_support_in_compiler >> DISABLE_SYNTHETIC_SHADOW_SUPPORT_IN_COMPILER=1 <> \ - <<# parameters.legacy_browsers >> LEGACY_BROWSERS=1 <> \ - <<# parameters.coverage >> COVERAGE=1 <> \ - retry << parameters.command >> - # Setup - restore_yarn_cache: - description: Restore Yarn cache from previous build - steps: - - restore_cache: - keys: - - yarn-v5-{{ checksum "yarn.lock" }} - - save_yarn_cache: - description: Save Yarn cache for future builds - steps: - - save_cache: - key: yarn-v5-{{ checksum "yarn.lock" }} - paths: - - ~/.cache/yarn - - restore_nx_cache: - description: Restore nx cache from previous build - steps: - - restore_cache: - keys: - - nx-v3-{{ checksum "yarn.lock" }} - - save_nx_cache: - description: Save nx cache for future builds - steps: - - save_cache: - key: nx-v3-{{ checksum "yarn.lock" }} - paths: - - ~/lwc/.nx-cache - - save_workspace: - description: Save current workspace - steps: - - persist_to_workspace: - root: . - paths: . - - load_workspace: - description: Load workspace - steps: - - attach_workspace: - at: ~/lwc - - - # Sauce connect - start_sauce_connect: - description: Start sauce connect - parameters: - username: - type: env_var_name - default: SAUCE_USERNAME - key: - type: env_var_name - default: SAUCE_KEY - tunnel_id: - type: env_var_name - default: SAUCE_TUNNEL_ID - steps: - - run: - name: Install and start sauce connect - background: true - command: | - curl https://saucelabs.com/downloads/sc-4.9.1-linux.tar.gz -o saucelabs.tar.gz - tar -xzf saucelabs.tar.gz - cd sc-* - bin/sc -u ${<< parameters.username >>} -k ${<< parameters.key >>} -i ${<< parameters.tunnel_id >>} -P 4445 - - run: - name: Wait for sauce connect to be up - command: wget --retry-connrefused --no-check-certificate -T 60 localhost:4445 - - # Test - run_karma: - description: Run Karma integration tests - parameters: - disable_synthetic: - type: boolean - default: false - force_native_shadow_mode: - type: boolean - default: false - api_version: - type: integer - default: -1 # treated as "latest" in this config - enable_native_custom_element_lifecycle: - type: boolean - default: false - disable_aria_reflection_polyfill: - type: boolean - default: false - node_env_production: - type: boolean - default: false - disable_synthetic_shadow_support_in_compiler: - type: boolean - default: false - legacy_browsers: - type: boolean - default: false - coverage: - type: boolean - default: true - steps: - - retry_command: - command_name: Run karma integration tests - working_directory: packages/@lwc/integration-karma - disable_synthetic: << parameters.disable_synthetic >> - force_native_shadow_mode: << parameters.force_native_shadow_mode >> - enable_native_custom_element_lifecycle: << parameters.enable_native_custom_element_lifecycle >> - disable_aria_reflection_polyfill: << parameters.disable_aria_reflection_polyfill >> - node_env_production: << parameters.node_env_production >> - disable_synthetic_shadow_support_in_compiler: << parameters.disable_synthetic_shadow_support_in_compiler >> - api_version: << parameters.api_version >> - legacy_browsers: << parameters.legacy_browsers >> - coverage: << parameters.coverage >> - command: yarn sauce - - -# Jobs definition -jobs: - build: - executor: node - steps: - - checkout - - restore_yarn_cache - - restore_nx_cache - - run: - name: Install dependencies and build - # Puppeteer Chromium download is only needed for @best/runner-local, which is unused here - command: PUPPETEER_SKIP_DOWNLOAD=true yarn install --frozen-lockfile - - run: - name: Check missing file headers - command: node ./scripts/tasks/check-license-headers.js - - run: - name: Check package.json integrity - command: node ./scripts/tasks/check-and-rewrite-package-json.js --test - - run: - name: Verify @lwc/shared is tree-shakable - command: node ./scripts/tasks/verify-treeshakable.js ./packages/@lwc/shared/dist/index.js - - run: - name: Verify that dependencies are declared - command: node ./scripts/tasks/check-imports-are-declared-dependencies.js - - run: - name: Check formatting - command: yarn prettier --check '{packages,scripts}/**/*.{js,ts,json,md}' - - run: - name: Run linter - command: yarn lint - - run: - name: Check the size of the LWC bundle - command: yarn bundlesize - - save_yarn_cache - - save_nx_cache - - save_workspace - - - test_unit: - executor: node - steps: - - load_workspace - - run: - name: Run unit tests - command: yarn test:ci - - test_benchmark_smoke: - executor: node-browsers - steps: - - browser-tools/install-chrome # required for selenium used by tachometer benchmark smoke tests - - load_workspace - - run: - name: Run benchmark smoke tests - command: BENCHMARK_SMOKE_TEST=1 yarn test:performance - - test_karma: - executor: node - environment: - SAUCE_TUNNEL_ID: lwc_<< pipeline.id >>_test_karma - steps: - - load_workspace - - start_sauce_connect - - run_karma - - run_karma: - disable_synthetic: true - - run_karma: - legacy_browsers: true - - run_karma: - force_native_shadow_mode: true - - run_karma: - enable_native_custom_element_lifecycle: true - - run_karma: - disable_synthetic: true - enable_native_custom_element_lifecycle: true - - run_karma: - api_version: 58 - - run_karma: - disable_synthetic: true - api_version: 58 - - run_karma: - disable_synthetic: true - disable_aria_reflection_polyfill: true - - run_karma: - disable_synthetic: true - disable_synthetic_shadow_support_in_compiler: true - - run_karma: - node_env_production: true - - run_karma: - node_env_production: true - disable_synthetic: true - - retry_command: - command_name: Run karma hydration tests - command: yarn hydration:sauce - working_directory: packages/@lwc/integration-karma - coverage: true - - run: - name: Compute karma coverage - command: yarn coverage - working_directory: packages/@lwc/integration-karma - - test_integration: - executor: node - environment: - SAUCE_TUNNEL_ID: lwc_<< pipeline.id >>_test_integration_prod - steps: - - load_workspace - - start_sauce_connect - - retry_command: - command_name: Run integration test - Chrome - prod mode - command: yarn sauce:prod --browsers chrome - working_directory: packages/@lwc/integration-tests - - test_integration_dev: - executor: node - environment: - SAUCE_TUNNEL_ID: lwc_<< pipeline.id >>_test_integration_dev - steps: - - load_workspace - - start_sauce_connect - - retry_command: - command_name: Run integration test - Chrome - dev mode - command: yarn sauce:dev --browsers chrome - working_directory: packages/@lwc/integration-tests - - -# Workflows definition -workflows: - version: 2 - build_and_test: - jobs: - - build: - filters: - <<: *ignore_forks - - - test_unit: - filters: - <<: *ignore_forks - requires: - - build - - - test_karma: - filters: - <<: *ignore_forks - requires: - - test_unit - - - test_integration: - filters: - <<: *ignore_forks - requires: - - test_unit - - - test_integration_dev: - filters: - <<: *ignore_forks - requires: - - test_unit - - - test_benchmark_smoke: - filters: - <<: *ignore_forks - requires: - - test_unit - - build_and_test_for_forked_repos: - jobs: - - build: - filters: - <<: *only_forks - - - test_unit: - filters: - <<: *only_forks - requires: - - build - - - hold: - type: approval # presents manual approval button in the UI - filters: - <<: *only_forks - requires: - - build - - test_unit - - - test_karma: - context: lwc-sauce-labs - filters: - <<: *only_forks - requires: - - build - - hold - - - test_integration: - # lwc-sauce-labs context not needed due to using local chrome - filters: - <<: *only_forks - requires: - - test_unit - - test_karma - - - test_integration_dev: - # lwc-sauce-labs context not needed due to using local chrome - filters: - <<: *only_forks - requires: - - test_unit - - test_karma diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 41dde4f67b..5e2437f309 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -11,6 +11,7 @@ env: BEST_FRONTEND_HOSTNAME: ${{secrets.BEST_FRONTEND_HOSTNAME}} BEST_HUB_CLIENT_TOKEN: ${{secrets.BEST_HUB_CLIENT_TOKEN}} BEST_HUB_HOSTNAME: ${{secrets.BEST_HUB_HOSTNAME}} + PUPPETEER_SKIP_DOWNLOAD: "true" # only needed for @best/runner-local, unused here jobs: run-best-performance-tests: @@ -27,8 +28,7 @@ jobs: cache: 'yarn' - name: Install dependencies - # Puppeteer Chromium download is only needed for @best/runner-local, which is unused here - run: PUPPETEER_SKIP_DOWNLOAD=true yarn install --frozen-lockfile + run: yarn install --frozen-lockfile - name: Build benchmarks run: yarn build:performance diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 0000000000..2b2c647497 --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,47 @@ +name: Run WebDriverIO integration tests + +on: + push: + branches: + - master + - release + - 'spring*' + - 'summer*' + - 'winter*' + pull_request: + branches: + - master + - release + - 'spring*' + - 'summer*' + - 'winter*' + +env: + SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}} + SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}} + PUPPETEER_SKIP_DOWNLOAD: "true" # only needed for @best/runner-local, unused here + +jobs: + run-integration-tests: + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: "18.18.0" + cache: 'yarn' + + - uses: saucelabs/sauce-connect-action@v2 + with: + username: ${{ secrets.SAUCE_USERNAME }} + accessKey: ${{ secrets.SAUCE_ACCESS_KEY }} + tunnelName: github-action-tunnel-integration + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - run: yarn sauce:prod --browsers chrome + - run: yarn sauce:dev --browsers chrome diff --git a/.github/workflows/karma.yml b/.github/workflows/karma.yml new file mode 100644 index 0000000000..4739433307 --- /dev/null +++ b/.github/workflows/karma.yml @@ -0,0 +1,62 @@ +name: Run Karma integration tests + +on: + push: + branches: + - master + - release + - 'spring*' + - 'summer*' + - 'winter*' + pull_request: + branches: + - master + - release + - 'spring*' + - 'summer*' + - 'winter*' + +env: + SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}} + SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}} + PUPPETEER_SKIP_DOWNLOAD: "true" # only needed for @best/runner-local, unused here + COVERAGE: "1" + +jobs: + run-karma-tests: + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: "18.18.0" + cache: 'yarn' + + - uses: saucelabs/sauce-connect-action@v2 + with: + username: ${{ secrets.SAUCE_USERNAME }} + accessKey: ${{ secrets.SAUCE_ACCESS_KEY }} + tunnelName: github-action-tunnel-karma + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - run: yarn test:karma:ci + - run: DISABLE_SYNTHETIC=1 yarn test:karma:ci + - run: LEGACY_BROWSERS=1 yarn test:karma:ci + - run: FORCE_NATIVE_SHADOW_MODE_FOR_TEST=1 yarn test:karma:ci + - run: ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE=1 yarn test:karma:ci + - run: ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE=1 DISABLE_SYNTHETIC=1 yarn test:karma:ci + - run: API_VERSION=58 yarn test:karma:ci + - run: API_VERSION=58 DISABLE_SYNTHETIC=1 yarn test:karma:ci + - run: DISABLE_ARIA_REFLECTION_POLYFILL=1 DISABLE_SYNTHETIC=1 yarn test:karma:ci + - run: DISABLE_SYNTHETIC_SHADOW_SUPPORT_IN_COMPILER=1 DISABLE_SYNTHETIC=1 yarn test:karma:ci + - run: NODE_ENV_FOR_TEST=production yarn test:karma:ci + - run: NODE_ENV_FOR_TEST=production DISABLE_SYNTHETIC=1 yarn test:karma:ci + - run: yarn hydration:sauce:ci + working-directory: ./packages/@lwc/integration-karma + - run: yarn coverage + working-directory: ./packages/@lwc/integration-karma diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml new file mode 100644 index 0000000000..42213bdf71 --- /dev/null +++ b/.github/workflows/unit.yml @@ -0,0 +1,55 @@ +name: Run unit tests + +on: + push: + branches: + - master + - release + - 'spring*' + - 'summer*' + - 'winter*' + pull_request: + branches: + - master + - release + - 'spring*' + - 'summer*' + - 'winter*' + +env: + PUPPETEER_SKIP_DOWNLOAD: "true" # only needed for @best/runner-local, unused here + +jobs: + run-unit-tests: + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: "18.18.0" + cache: 'yarn' + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Check missing file headers + run: node ./scripts/tasks/check-license-headers.js + - name: Check package.json integrity + run: node ./scripts/tasks/check-and-rewrite-package-json.js --test + - name: Verify @lwc/shared is tree-shakable + run: node ./scripts/tasks/verify-treeshakable.js ./packages/@lwc/shared/dist/index.js + - name: Verify that dependencies are declared + run: node ./scripts/tasks/check-imports-are-declared-dependencies.js + - name: Check formatting + run: yarn prettier --check '{packages,scripts}/**/*.{js,ts,json,md}' + - name: Run linter + run: yarn lint + - name: Check the size of the LWC bundle + run: yarn bundlesize + - name: Run Jest tests + run: yarn test:ci + - name: Run benchmark smoke tests + run: BENCHMARK_SMOKE_TEST=1 yarn test:performance diff --git a/nx.json b/nx.json index 0a829a86c3..fc9dae683c 100644 --- a/nx.json +++ b/nx.json @@ -23,6 +23,10 @@ "sauce": { "//": "Build @lwc/integration dependencies when invoking the test:integration script on the root package.json.", "dependsOn": ["^build"] + }, + "sauce:ci": { + "//": "Build @lwc/integration dependencies when invoking the test:integration script on the root package.json.", + "dependsOn": ["^build"] } }, "affected": { diff --git a/package.json b/package.json index 11abc02052..2485e57cb6 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "test:debug": "node --inspect node_modules/.bin/jest --config ./scripts/jest/root.config.js --runInBand --watch", "test:ci": "yarn test --no-cache --coverage --runInBand", "test:karma": "nx test @lwc/integration-karma", + "test:karma:ci": "nx sauce:ci @lwc/integration-karma", "test:integration": "nx sauce @lwc/integration-tests", "test:performance": "nx test @lwc/perf-benchmarks", "test:performance:best": "nx test:best @lwc/perf-benchmarks", diff --git a/packages/@lwc/integration-karma/package.json b/packages/@lwc/integration-karma/package.json index b61359fe01..63eb2d47d1 100644 --- a/packages/@lwc/integration-karma/package.json +++ b/packages/@lwc/integration-karma/package.json @@ -8,8 +8,10 @@ "hydration:start": "karma start ./scripts/karma-configs/hydration/local.js", "hydration:test": "karma start ./scripts/karma-configs/hydration/local.js --single-run --browsers ChromeHeadless", "hydration:sauce": "karma start ./scripts/karma-configs/hydration/sauce.js --single-run", + "hydration:sauce:ci": "../../../scripts/ci/retry.sh karma start ./scripts/karma-configs/hydration/sauce.js --single-run", "sauce": "karma start ./scripts/karma-configs/test/sauce.js --single-run", - "coverage": "node ./scripts/merge-coverage.js" + "sauce:ci": "../../../scripts/ci/retry.sh karma start ./scripts/karma-configs/test/sauce.js --single-run", + "coverage": "node ../scripts/merge-coverage.js" }, "//": { "karma-jasmine": "must be kept at v4 because it is only compatible with jasmine-core@4, which we need for IE11", diff --git a/packages/@lwc/integration-tests/package.json b/packages/@lwc/integration-tests/package.json index 023fb7ca0f..58e60746a6 100644 --- a/packages/@lwc/integration-tests/package.json +++ b/packages/@lwc/integration-tests/package.json @@ -11,7 +11,9 @@ "local:prod": "yarn build:prod && MODE=prod wdio ./scripts/wdio.local.conf.js", "sauce": "yarn sauce:prod", "sauce:dev": "MODE=dev yarn build:dev && MODE=dev wdio ./scripts/wdio.sauce.conf.js", - "sauce:prod": "MODE=prod yarn build:prod && MODE=prod wdio ./scripts/wdio.sauce.conf.js" + "sauce:prod": "MODE=prod yarn build:prod && MODE=prod wdio ./scripts/wdio.sauce.conf.js", + "sauce:dev:ci": "MODE=dev yarn build:dev && MODE=dev ../../../scripts/ci/retry.sh wdio ./scripts/wdio.sauce.conf.js", + "sauce:prod:ci": "MODE=prod yarn build:prod && MODE=prod ../../../scripts/ci/retry.sh wdio ./scripts/wdio.sauce.conf.js" }, "devDependencies": { "@lwc/rollup-plugin": "3.6.0", diff --git a/scripts/ci/retry.sh b/scripts/ci/retry.sh new file mode 100755 index 0000000000..6b2d5c9adb --- /dev/null +++ b/scripts/ci/retry.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# Retry a script multiple times before failing. Used for CI. + +set -e +set -x + +export PATH="${PATH}:./node_modules/.bin" + +MAX_RETRY=3 +n=0 +until [ $n -ge $MAX_RETRY ] +do + echo "Try $[$n+1]/$MAX_RETRY..." + "$@" && break + n=$[$n+1] +done +if [ $n -ge $MAX_RETRY ]; then + echo "Failed: ${@}" >&2 + exit 1 +fi From 9142b8ec8e75e47acbc543ae8ead98e33143d82e Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Mon, 9 Oct 2023 13:31:16 -0700 Subject: [PATCH 02/13] fix: header --- scripts/ci/retry.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/ci/retry.sh b/scripts/ci/retry.sh index 6b2d5c9adb..210c1ce22e 100755 --- a/scripts/ci/retry.sh +++ b/scripts/ci/retry.sh @@ -1,5 +1,12 @@ #!/usr/bin/env bash +# +# Copyright (c) 2023, salesforce.com, inc. +# All rights reserved. +# SPDX-License-Identifier: MIT +# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT +# # Retry a script multiple times before failing. Used for CI. +# set -e set -x From 53fa9a952491293446aed3492813c8820a77bb5e Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Mon, 9 Oct 2023 13:32:42 -0700 Subject: [PATCH 03/13] fix: cwd --- .github/workflows/integration.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 2b2c647497..195d29ad24 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -44,4 +44,6 @@ jobs: run: yarn install --frozen-lockfile - run: yarn sauce:prod --browsers chrome + working-directory: ./packages/@lwc/integration-tests - run: yarn sauce:dev --browsers chrome + working-directory: ./packages/@lwc/integration-tests From 0545bb7bfcd9149316e6b2910278171c3f815d55 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Mon, 9 Oct 2023 13:38:48 -0700 Subject: [PATCH 04/13] fix: tunnel id --- .github/workflows/integration.yml | 3 ++- .github/workflows/karma.yml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 195d29ad24..44f8c72427 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -19,6 +19,7 @@ on: env: SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}} SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}} + SAUCE_TUNNEL_ID: github-action-tunnel-karma-${{GITHUB_RUN_ID}} PUPPETEER_SKIP_DOWNLOAD: "true" # only needed for @best/runner-local, unused here jobs: @@ -38,7 +39,7 @@ jobs: with: username: ${{ secrets.SAUCE_USERNAME }} accessKey: ${{ secrets.SAUCE_ACCESS_KEY }} - tunnelName: github-action-tunnel-integration + tunnelName: github-action-tunnel-karma-${{GITHUB_RUN_ID}} - name: Install dependencies run: yarn install --frozen-lockfile diff --git a/.github/workflows/karma.yml b/.github/workflows/karma.yml index 4739433307..2f8b686aa6 100644 --- a/.github/workflows/karma.yml +++ b/.github/workflows/karma.yml @@ -19,6 +19,7 @@ on: env: SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}} SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}} + SAUCE_TUNNEL_ID: github-action-tunnel-integration-${{GITHUB_RUN_ID}} PUPPETEER_SKIP_DOWNLOAD: "true" # only needed for @best/runner-local, unused here COVERAGE: "1" From 3c3432f266e4dcd6f57faffa9b8d312e5e42c48c Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Mon, 9 Oct 2023 13:40:33 -0700 Subject: [PATCH 05/13] fix: tunnel id --- .github/workflows/integration.yml | 2 +- .github/workflows/karma.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 44f8c72427..f5e1e492c4 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -39,7 +39,7 @@ jobs: with: username: ${{ secrets.SAUCE_USERNAME }} accessKey: ${{ secrets.SAUCE_ACCESS_KEY }} - tunnelName: github-action-tunnel-karma-${{GITHUB_RUN_ID}} + tunnelName: ${{ env.SAUCE_TUNNEL_ID }} - name: Install dependencies run: yarn install --frozen-lockfile diff --git a/.github/workflows/karma.yml b/.github/workflows/karma.yml index 2f8b686aa6..ae4906bcf5 100644 --- a/.github/workflows/karma.yml +++ b/.github/workflows/karma.yml @@ -40,7 +40,7 @@ jobs: with: username: ${{ secrets.SAUCE_USERNAME }} accessKey: ${{ secrets.SAUCE_ACCESS_KEY }} - tunnelName: github-action-tunnel-karma + tunnelName: ${{ env.SAUCE_TUNNEL_ID }} - name: Install dependencies run: yarn install --frozen-lockfile From 3da9406888116068cc92427b76b745a177103c69 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Mon, 9 Oct 2023 13:43:11 -0700 Subject: [PATCH 06/13] fix: gh env var --- .github/workflows/integration.yml | 2 +- .github/workflows/karma.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index f5e1e492c4..3f77289a0e 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -19,7 +19,7 @@ on: env: SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}} SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}} - SAUCE_TUNNEL_ID: github-action-tunnel-karma-${{GITHUB_RUN_ID}} + SAUCE_TUNNEL_ID: github-action-tunnel-karma-${{env.GITHUB_RUN_ID}} PUPPETEER_SKIP_DOWNLOAD: "true" # only needed for @best/runner-local, unused here jobs: diff --git a/.github/workflows/karma.yml b/.github/workflows/karma.yml index ae4906bcf5..e0e6aa4ebd 100644 --- a/.github/workflows/karma.yml +++ b/.github/workflows/karma.yml @@ -19,7 +19,7 @@ on: env: SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}} SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}} - SAUCE_TUNNEL_ID: github-action-tunnel-integration-${{GITHUB_RUN_ID}} + SAUCE_TUNNEL_ID: github-action-tunnel-integration-${{env.GITHUB_RUN_ID}} PUPPETEER_SKIP_DOWNLOAD: "true" # only needed for @best/runner-local, unused here COVERAGE: "1" From 503f29a08eb5df08986bec5976d0b0593569dda7 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Mon, 9 Oct 2023 13:44:17 -0700 Subject: [PATCH 07/13] fix: gh env var 2 --- .github/workflows/integration.yml | 2 +- .github/workflows/karma.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 3f77289a0e..82c2f96e04 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -19,7 +19,7 @@ on: env: SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}} SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}} - SAUCE_TUNNEL_ID: github-action-tunnel-karma-${{env.GITHUB_RUN_ID}} + SAUCE_TUNNEL_ID: github-action-tunnel-karma-${{github.run_id}} PUPPETEER_SKIP_DOWNLOAD: "true" # only needed for @best/runner-local, unused here jobs: diff --git a/.github/workflows/karma.yml b/.github/workflows/karma.yml index e0e6aa4ebd..13d666862e 100644 --- a/.github/workflows/karma.yml +++ b/.github/workflows/karma.yml @@ -19,7 +19,7 @@ on: env: SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}} SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}} - SAUCE_TUNNEL_ID: github-action-tunnel-integration-${{env.GITHUB_RUN_ID}} + SAUCE_TUNNEL_ID: github-action-tunnel-integration-${{github.run_id}} PUPPETEER_SKIP_DOWNLOAD: "true" # only needed for @best/runner-local, unused here COVERAGE: "1" From a91307ae720d68be0f49d72b9684fb358b74cde4 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Mon, 9 Oct 2023 13:49:04 -0700 Subject: [PATCH 08/13] fix: less noisy script --- scripts/ci/retry.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/ci/retry.sh b/scripts/ci/retry.sh index 210c1ce22e..0d55e1fe34 100755 --- a/scripts/ci/retry.sh +++ b/scripts/ci/retry.sh @@ -9,7 +9,6 @@ # set -e -set -x export PATH="${PATH}:./node_modules/.bin" From f99bfb47b2144be02b41c45bc637809bccecb55d Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Mon, 9 Oct 2023 14:11:18 -0700 Subject: [PATCH 09/13] fix: script path --- packages/@lwc/integration-karma/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@lwc/integration-karma/package.json b/packages/@lwc/integration-karma/package.json index 63eb2d47d1..2d9eca3e3b 100644 --- a/packages/@lwc/integration-karma/package.json +++ b/packages/@lwc/integration-karma/package.json @@ -11,7 +11,7 @@ "hydration:sauce:ci": "../../../scripts/ci/retry.sh karma start ./scripts/karma-configs/hydration/sauce.js --single-run", "sauce": "karma start ./scripts/karma-configs/test/sauce.js --single-run", "sauce:ci": "../../../scripts/ci/retry.sh karma start ./scripts/karma-configs/test/sauce.js --single-run", - "coverage": "node ../scripts/merge-coverage.js" + "coverage": "node ./scripts/merge-coverage.js" }, "//": { "karma-jasmine": "must be kept at v4 because it is only compatible with jasmine-core@4, which we need for IE11", From 88e54d5b8889545c262919c6e8ba298577599acc Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Mon, 9 Oct 2023 14:33:49 -0700 Subject: [PATCH 10/13] fix: run in cwd --- .github/workflows/integration.yml | 6 ++++-- .github/workflows/karma.yml | 30 ++++++++++++++++-------------- nx.json | 4 ---- package.json | 1 - 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 82c2f96e04..6fa471dc04 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -25,6 +25,9 @@ env: jobs: run-integration-tests: runs-on: ubuntu-22.04 + defaults: + run: + working-directory: ./packages/@lwc/integration-tests steps: - name: Checkout repository uses: actions/checkout@v3 @@ -43,8 +46,7 @@ jobs: - name: Install dependencies run: yarn install --frozen-lockfile + working-directory: ./ - run: yarn sauce:prod --browsers chrome - working-directory: ./packages/@lwc/integration-tests - run: yarn sauce:dev --browsers chrome - working-directory: ./packages/@lwc/integration-tests diff --git a/.github/workflows/karma.yml b/.github/workflows/karma.yml index 13d666862e..e27e4168f8 100644 --- a/.github/workflows/karma.yml +++ b/.github/workflows/karma.yml @@ -26,6 +26,9 @@ env: jobs: run-karma-tests: runs-on: ubuntu-22.04 + defaults: + run: + working-directory: ./packages/@lwc/integration-karma steps: - name: Checkout repository uses: actions/checkout@v3 @@ -44,20 +47,19 @@ jobs: - name: Install dependencies run: yarn install --frozen-lockfile + working-directory: ./ - - run: yarn test:karma:ci - - run: DISABLE_SYNTHETIC=1 yarn test:karma:ci - - run: LEGACY_BROWSERS=1 yarn test:karma:ci - - run: FORCE_NATIVE_SHADOW_MODE_FOR_TEST=1 yarn test:karma:ci - - run: ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE=1 yarn test:karma:ci - - run: ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE=1 DISABLE_SYNTHETIC=1 yarn test:karma:ci - - run: API_VERSION=58 yarn test:karma:ci - - run: API_VERSION=58 DISABLE_SYNTHETIC=1 yarn test:karma:ci - - run: DISABLE_ARIA_REFLECTION_POLYFILL=1 DISABLE_SYNTHETIC=1 yarn test:karma:ci - - run: DISABLE_SYNTHETIC_SHADOW_SUPPORT_IN_COMPILER=1 DISABLE_SYNTHETIC=1 yarn test:karma:ci - - run: NODE_ENV_FOR_TEST=production yarn test:karma:ci - - run: NODE_ENV_FOR_TEST=production DISABLE_SYNTHETIC=1 yarn test:karma:ci + - run: yarn sauce:ci + - run: DISABLE_SYNTHETIC=1 yarn sauce:ci + - run: LEGACY_BROWSERS=1 yarn sauce:ci + - run: FORCE_NATIVE_SHADOW_MODE_FOR_TEST=1 yarn sauce:ci + - run: ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE=1 yarn sauce:ci + - run: ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE=1 DISABLE_SYNTHETIC=1 yarn sauce:ci + - run: API_VERSION=58 yarn sauce:ci + - run: API_VERSION=58 DISABLE_SYNTHETIC=1 yarn sauce:ci + - run: DISABLE_ARIA_REFLECTION_POLYFILL=1 DISABLE_SYNTHETIC=1 yarn sauce:ci + - run: DISABLE_SYNTHETIC_SHADOW_SUPPORT_IN_COMPILER=1 DISABLE_SYNTHETIC=1 yarn sauce:ci + - run: NODE_ENV_FOR_TEST=production yarn sauce:ci + - run: NODE_ENV_FOR_TEST=production DISABLE_SYNTHETIC=1 yarn sauce:ci - run: yarn hydration:sauce:ci - working-directory: ./packages/@lwc/integration-karma - run: yarn coverage - working-directory: ./packages/@lwc/integration-karma diff --git a/nx.json b/nx.json index fc9dae683c..0a829a86c3 100644 --- a/nx.json +++ b/nx.json @@ -23,10 +23,6 @@ "sauce": { "//": "Build @lwc/integration dependencies when invoking the test:integration script on the root package.json.", "dependsOn": ["^build"] - }, - "sauce:ci": { - "//": "Build @lwc/integration dependencies when invoking the test:integration script on the root package.json.", - "dependsOn": ["^build"] } }, "affected": { diff --git a/package.json b/package.json index 2485e57cb6..11abc02052 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,6 @@ "test:debug": "node --inspect node_modules/.bin/jest --config ./scripts/jest/root.config.js --runInBand --watch", "test:ci": "yarn test --no-cache --coverage --runInBand", "test:karma": "nx test @lwc/integration-karma", - "test:karma:ci": "nx sauce:ci @lwc/integration-karma", "test:integration": "nx sauce @lwc/integration-tests", "test:performance": "nx test @lwc/perf-benchmarks", "test:performance:best": "nx test:best @lwc/perf-benchmarks", From f3762be310956f59313955d11a22b9768a7f8eae Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Mon, 9 Oct 2023 14:36:05 -0700 Subject: [PATCH 11/13] fix: move sc later --- .github/workflows/integration.yml | 8 ++++---- .github/workflows/karma.yml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 6fa471dc04..2d6c532a26 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -38,15 +38,15 @@ jobs: node-version: "18.18.0" cache: 'yarn' + - name: Install dependencies + run: yarn install --frozen-lockfile + working-directory: ./ + - uses: saucelabs/sauce-connect-action@v2 with: username: ${{ secrets.SAUCE_USERNAME }} accessKey: ${{ secrets.SAUCE_ACCESS_KEY }} tunnelName: ${{ env.SAUCE_TUNNEL_ID }} - - name: Install dependencies - run: yarn install --frozen-lockfile - working-directory: ./ - - run: yarn sauce:prod --browsers chrome - run: yarn sauce:dev --browsers chrome diff --git a/.github/workflows/karma.yml b/.github/workflows/karma.yml index e27e4168f8..2c1e093da4 100644 --- a/.github/workflows/karma.yml +++ b/.github/workflows/karma.yml @@ -39,16 +39,16 @@ jobs: node-version: "18.18.0" cache: 'yarn' + - name: Install dependencies + run: yarn install --frozen-lockfile + working-directory: ./ + - uses: saucelabs/sauce-connect-action@v2 with: username: ${{ secrets.SAUCE_USERNAME }} accessKey: ${{ secrets.SAUCE_ACCESS_KEY }} tunnelName: ${{ env.SAUCE_TUNNEL_ID }} - - name: Install dependencies - run: yarn install --frozen-lockfile - working-directory: ./ - - run: yarn sauce:ci - run: DISABLE_SYNTHETIC=1 yarn sauce:ci - run: LEGACY_BROWSERS=1 yarn sauce:ci From 1d754ae8ec5f56354f898b7324cb291858715642 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Fri, 20 Oct 2023 12:31:05 -0700 Subject: [PATCH 12/13] fix: whoops, renamed --- .github/workflows/karma.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/karma.yml b/.github/workflows/karma.yml index bfa78503f4..d6cdd2cc61 100644 --- a/.github/workflows/karma.yml +++ b/.github/workflows/karma.yml @@ -59,8 +59,8 @@ jobs: - run: API_VERSION=58 DISABLE_SYNTHETIC=1 yarn sauce:ci - run: API_VERSION=59 yarn sauce:ci - run: API_VERSION=59 DISABLE_SYNTHETIC=1 yarn sauce:ci - - run: DISABLE_ARIA_REFLECTION_POLYFILL=1 yarn sauce:ci - - run: DISABLE_ARIA_REFLECTION_POLYFILL=1 DISABLE_SYNTHETIC=1 yarn sauce:ci + - run: ENABLE_ARIA_REFLECTION_GLOBAL_POLYFILL=1 yarn sauce:ci + - run: ENABLE_ARIA_REFLECTION_GLOBAL_POLYFILL=1 DISABLE_SYNTHETIC=1 yarn sauce:ci - run: DISABLE_SYNTHETIC_SHADOW_SUPPORT_IN_COMPILER=1 DISABLE_SYNTHETIC=1 yarn sauce:ci - run: NODE_ENV_FOR_TEST=production yarn sauce:ci - run: NODE_ENV_FOR_TEST=production DISABLE_SYNTHETIC=1 yarn sauce:ci From 8ccc7461d3e0528c15c82769193c25832bbc0c58 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Mon, 23 Oct 2023 14:09:46 -0700 Subject: [PATCH 13/13] chore: bump ci