refactor(codemod): improve js components migration (#3682) #11823
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Main workflow | |
# The event triggers are configured as following: | |
# - on branch main, trigger the workflow on every push | |
# - on any pull request, trigger the workflow | |
# This is to avoid running the workflow twice on pull requests. | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
lint_and_test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
# https://github.com/bahmutov/cypress-gh-action-split-install/blob/ca3916d4e7240ebdc337825d2d78eb354855464b/.github/workflows/tests.yml#L8-L11 | |
env: | |
# prevents extra Cypress installation progress messages | |
CI: 1 | |
# avoid warnings like "tput: No value for $TERM and no -T specified" | |
TERM: xterm | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Installing dependencies and building packages | |
uses: ./.github/actions/ci | |
- name: Running static type checking | |
run: pnpm typecheck | |
- name: Running static type checking (Cypress) | |
run: pnpm typecheck:cypress | |
- name: Running static type checking (Starter Template) | |
run: pnpm typecheck:starters | |
- name: Running linters and tests | |
run: pnpm jest --projects jest.{eslint,stylelint,test}.config.js --reporters jest-silent-reporter | |
env: | |
CI: true | |
RTL_ASYNC_UTIL_TIMEOUT: 5000 | |
test_visual: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Installing dependencies and building packages | |
uses: ./.github/actions/ci | |
- name: Building Visual Regression Tests application for UI components | |
run: pnpm visual-testing-app:build | |
# Explicitly install the Chrome binary in case it's not available yet. | |
# This workaround is based on the suggestions from https://github.com/puppeteer/puppeteer/issues/9533. | |
- name: Installing Chrome via Puppeteer | |
run: node ./node_modules/puppeteer/install.js | |
- name: Running Visual Regression Tests for UI components | |
run: pnpm vrt:components | |
env: | |
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN_UI_COMPONENTS }} | |
test_custom_app_starter_js_template: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
# https://github.com/bahmutov/cypress-gh-action-split-install/blob/ca3916d4e7240ebdc337825d2d78eb354855464b/.github/workflows/tests.yml#L8-L11 | |
env: | |
# prevents extra Cypress installation progress messages | |
CI: 1 | |
# avoid warnings like "tput: No value for $TERM and no -T specified" | |
TERM: xterm | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test Custom Application javascript starter template | |
uses: ./.github/actions/test-template-action | |
with: | |
application-type: custom-application | |
template-name: starter | |
e2e-tests-command: test:e2e:template-custom-application-starter | |
host-gcp-staging: ${{ secrets.HOST_GCP_STAGING }} | |
playground-application-id: ${{ secrets.APP_ID_PLAYGROUND }} | |
mc-api-url: ${{ secrets.MC_API_URL }} | |
cypress-login-user: ${{ secrets.CYPRESS_LOGIN_USER }} | |
cypress-login-password: ${{ secrets.CYPRESS_LOGIN_PASSWORD }} | |
cypress-project-key: ${{ secrets.CYPRESS_PROJECT_KEY }} | |
test_custom_app_starter_js_template_installation: | |
runs-on: ubuntu-latest | |
if: github.ref != 'refs/heads/main' && github.head_ref != 'changeset-release/main' | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Installing dependencies and building packages | |
uses: ./.github/actions/ci | |
- name: Installing and building template starter | |
run: node ./scripts/install-template.mjs | |
env: | |
APPLICATION_TYPE: custom-application | |
TEMPLATE_NAME: starter | |
CTP_INITIAL_PROJECT_KEY: ${{ secrets.CYPRESS_PROJECT_KEY }} | |
test_custom_app_starter_ts_template: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
# https://github.com/bahmutov/cypress-gh-action-split-install/blob/ca3916d4e7240ebdc337825d2d78eb354855464b/.github/workflows/tests.yml#L8-L11 | |
env: | |
# prevents extra Cypress installation progress messages | |
CI: 1 | |
# avoid warnings like "tput: No value for $TERM and no -T specified" | |
TERM: xterm | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test Custom Application typescript starter template | |
uses: ./.github/actions/test-template-action | |
with: | |
application-type: custom-application | |
template-name: starter-typescript | |
e2e-tests-command: test:e2e:template-custom-application-starter | |
typecheck-command: typecheck:starter:custom-applications | |
host-gcp-staging: ${{ secrets.HOST_GCP_STAGING }} | |
playground-application-id: ${{ secrets.APP_ID_PLAYGROUND }} | |
mc-api-url: ${{ secrets.MC_API_URL }} | |
cypress-login-user: ${{ secrets.CYPRESS_LOGIN_USER }} | |
cypress-login-password: ${{ secrets.CYPRESS_LOGIN_PASSWORD }} | |
cypress-project-key: ${{ secrets.CYPRESS_PROJECT_KEY }} | |
test_custom_app_starter_ts_template_installation: | |
runs-on: ubuntu-latest | |
if: github.ref != 'refs/heads/main' && github.head_ref != 'changeset-release/main' | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Installing dependencies and building packages | |
uses: ./.github/actions/ci | |
- name: Installing and building template starter | |
run: node ./scripts/install-template.mjs | |
env: | |
APPLICATION_TYPE: custom-application | |
TEMPLATE_NAME: starter-typescript | |
CTP_INITIAL_PROJECT_KEY: ${{ secrets.CYPRESS_PROJECT_KEY }} | |
test_custom_view_starter_js_template: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
# https://github.com/bahmutov/cypress-gh-action-split-install/blob/ca3916d4e7240ebdc337825d2d78eb354855464b/.github/workflows/tests.yml#L8-L11 | |
env: | |
# prevents extra Cypress installation progress messages | |
CI: 1 | |
# avoid warnings like "tput: No value for $TERM and no -T specified" | |
TERM: xterm | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test Custom View javascript starter template | |
uses: ./.github/actions/test-template-action | |
with: | |
application-type: custom-view | |
template-name: starter | |
e2e-tests-command: test:e2e:template-custom-view-starter | |
host-gcp-staging: ${{ secrets.HOST_GCP_STAGING }} | |
playground-application-id: ${{ secrets.APP_ID_PLAYGROUND }} | |
mc-api-url: ${{ secrets.MC_API_URL }} | |
cypress-login-user: ${{ secrets.CYPRESS_LOGIN_USER }} | |
cypress-login-password: ${{ secrets.CYPRESS_LOGIN_PASSWORD }} | |
cypress-project-key: ${{ secrets.CYPRESS_PROJECT_KEY }} | |
cypress-package-name: '@commercetools-applications/merchant-center-custom-view-template-starter' | |
test_custom_view_starter_js_template_installation: | |
runs-on: ubuntu-latest | |
if: github.ref != 'refs/heads/main' && github.head_ref != 'changeset-release/main' | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Installing dependencies and building packages | |
uses: ./.github/actions/ci | |
- name: Installing and building template starter | |
run: node ./scripts/install-template.mjs | |
env: | |
APPLICATION_TYPE: custom-view | |
TEMPLATE_NAME: starter | |
CTP_INITIAL_PROJECT_KEY: ${{ secrets.CYPRESS_PROJECT_KEY }} | |
test_custom_view_starter_ts_template: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
# https://github.com/bahmutov/cypress-gh-action-split-install/blob/ca3916d4e7240ebdc337825d2d78eb354855464b/.github/workflows/tests.yml#L8-L11 | |
env: | |
# prevents extra Cypress installation progress messages | |
CI: 1 | |
# avoid warnings like "tput: No value for $TERM and no -T specified" | |
TERM: xterm | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test Custom View typescript starter template | |
uses: ./.github/actions/test-template-action | |
with: | |
application-type: custom-view | |
template-name: starter-typescript | |
e2e-tests-command: test:e2e:template-custom-view-starter | |
typecheck-command: typecheck:starter:custom-views | |
host-gcp-staging: ${{ secrets.HOST_GCP_STAGING }} | |
playground-application-id: ${{ secrets.APP_ID_PLAYGROUND }} | |
mc-api-url: ${{ secrets.MC_API_URL }} | |
cypress-login-user: ${{ secrets.CYPRESS_LOGIN_USER }} | |
cypress-login-password: ${{ secrets.CYPRESS_LOGIN_PASSWORD }} | |
cypress-project-key: ${{ secrets.CYPRESS_PROJECT_KEY }} | |
cypress-package-name: '@commercetools-applications/merchant-center-custom-view-template-starter-typescript' | |
test_custom_view_starter_ts_template_installation: | |
runs-on: ubuntu-latest | |
if: github.ref != 'refs/heads/main' && github.head_ref != 'changeset-release/main' | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Installing dependencies and building packages | |
uses: ./.github/actions/ci | |
- name: Installing and building template starter | |
run: node ./scripts/install-template.mjs | |
env: | |
APPLICATION_TYPE: custom-view | |
TEMPLATE_NAME: starter-typescript | |
CTP_INITIAL_PROJECT_KEY: ${{ secrets.CYPRESS_PROJECT_KEY }} | |
test_playground: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
# https://github.com/bahmutov/cypress-gh-action-split-install/blob/ca3916d4e7240ebdc337825d2d78eb354855464b/.github/workflows/tests.yml#L8-L11 | |
env: | |
# prevents extra Cypress installation progress messages | |
CI: 1 | |
# avoid warnings like "tput: No value for $TERM and no -T specified" | |
TERM: xterm | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Installing dependencies and building packages | |
uses: ./.github/actions/ci | |
- name: Building Playground application | |
run: pnpm playground:build | |
env: | |
NODE_OPTIONS: '--max-old-space-size=6144' | |
APP_ID: ${{ secrets.APP_ID_PLAYGROUND }} | |
MC_API_URL: ${{ secrets.MC_API_URL }} | |
CTP_INITIAL_PROJECT_KEY: ${{ secrets.CYPRESS_PROJECT_KEY }} | |
HOST_GCP_STAGING: ${{ secrets.HOST_GCP_STAGING }} | |
# https://github.com/bahmutov/cypress-gh-action-split-install/blob/ca3916d4e7240ebdc337825d2d78eb354855464b/.github/workflows/tests.yml#L23-L30 | |
# https://github.com/marketplace/actions/cypress-io#custom-install | |
- name: Restoring Cypress cache | |
# restore / cache the binary ourselves on Linux | |
# see https://github.com/actions/cache | |
id: cache-cypress | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/Cypress | |
key: ${{ runner.os }}-cypress-${{ hashFiles('**/package.json') }} | |
- name: Installing Cypress binary | |
run: pnpm cypress install && pnpm cypress cache list | |
- name: Running End-to-End tests for Playground application | |
run: pnpm start-server-and-test 'pnpm playground:start:prod:local' http-get://127.0.0.1:3001 'pnpm percy exec -- pnpm test:e2e:playground' | |
env: | |
NODE_ENV: test | |
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN_E2E_PLAYGROUND }} | |
CYPRESS_CI: 'true' | |
CYPRESS_LOGIN_USER: ${{ secrets.CYPRESS_LOGIN_USER }} | |
CYPRESS_LOGIN_PASSWORD: ${{ secrets.CYPRESS_LOGIN_PASSWORD }} | |
CYPRESS_PROJECT_KEY: ${{ secrets.CYPRESS_PROJECT_KEY }} | |
HOST_GCP_STAGING: ${{ secrets.HOST_GCP_STAGING }} | |
APP_ID: ${{ secrets.APP_ID_PLAYGROUND }} | |
MC_API_URL: ${{ secrets.MC_API_URL }} | |
CTP_INITIAL_PROJECT_KEY: ${{ secrets.CYPRESS_PROJECT_KEY }} |