diff --git a/.github/actions/webapp-setup/action.yml b/.github/actions/webapp-setup/action.yml new file mode 100644 index 0000000000..d9d304345c --- /dev/null +++ b/.github/actions/webapp-setup/action.yml @@ -0,0 +1,18 @@ +name: "Web app setup" +description: "Set up NPM and dependencies" + +runs: + using: "composite" + steps: + - name: ci/setup-node + uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 + id: setup_node + with: + node-version-file: ".nvmrc" + cache: npm + cache-dependency-path: 'webapp/package-lock.json' + - name: ci/get-node-modules + shell: bash + working-directory: webapp + run: | + make node_modules diff --git a/.github/workflows/webapp-ci-master.yml b/.github/workflows/webapp-ci-master.yml index 387663f60c..b025c06135 100644 --- a/.github/workflows/webapp-ci-master.yml +++ b/.github/workflows/webapp-ci-master.yml @@ -5,7 +5,6 @@ on: - master - cloud - release-* - - mono-repo* jobs: master-ci: diff --git a/.github/workflows/webapp-ci-pr.yml b/.github/workflows/webapp-ci-pr.yml index 9aef2ff492..3f4c173409 100644 --- a/.github/workflows/webapp-ci-pr.yml +++ b/.github/workflows/webapp-ci-pr.yml @@ -1,6 +1,8 @@ name: Web App CI PR on: pull_request: + paths: + - 'webapp/**' concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/webapp-ci-template.yml b/.github/workflows/webapp-ci-template.yml index b303bcb908..a533a29f98 100644 --- a/.github/workflows/webapp-ci-template.yml +++ b/.github/workflows/webapp-ci-template.yml @@ -5,9 +5,6 @@ name: Web App CI Template on: workflow_call: -defaults: - run: - shell: bash jobs: check-lint: runs-on: ubuntu-22.04 @@ -17,29 +14,12 @@ jobs: steps: - name: ci/checkout-repo uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 - - name: ci/setup-node - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 - id: setup_node - with: - node-version-file: ".nvmrc" - cache: npm - cache-dependency-path: 'webapp/package-lock.json' - # - uses: actions/cache@2b8105bdae4b746666ee225970c4a281bbd9d51f # v3.2.4 - # id: npm-cache - # with: - # path: | - # '**/node_modules' - # 'e2e-tests/playwright/node_modules' - # 'e2e-tests/cypress/node_modules' - # key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('e2e-tests/cypress/package-lock.json') }}-${{ hashFiles('e2e-tests/playwright/package-lock.json') }} - - name: ci/get-node-modules - # if: steps.npm-cache.outputs.cache-hit != 'true' - run: | - make node_modules - # make channels/e2e-tests/playwright/node_modules + - name: ci/setup + uses: ./.github/actions/webapp-setup - name: ci/lint run: | npm run check + check-i18n: runs-on: ubuntu-22.04 defaults: @@ -48,26 +28,8 @@ jobs: steps: - name: ci/checkout-repo uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 - - name: ci/setup-node - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 - id: setup_node - with: - node-version-file: ".nvmrc" - cache: npm - cache-dependency-path: 'webapp/package-lock.json' - # - uses: actions/cache@2b8105bdae4b746666ee225970c4a281bbd9d51f # v3.2.4 - # id: npm-cache - # with: - # path: | - # '**/node_modules' - # 'e2e-tests/playwright/node_modules' - # 'e2e-tests/cypress/node_modules' - # key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('e2e-tests/cypress/package-lock.json') }}-${{ hashFiles('e2e-tests/playwright/package-lock.json') }} - - name: ci/get-node-modules - # if: steps.npm-cache.outputs.cache-hit != 'true' - run: | - make node_modules - # make channels/e2e-tests/playwright/node_modules + - name: ci/setup + uses: ./.github/actions/webapp-setup - name: ci/lint working-directory: webapp/channels run: | @@ -90,6 +52,7 @@ jobs: run: | npm run i18n-extract git --no-pager diff --exit-code i18n/en.json || (echo "Please run \"cd webapp/playbooks && npm run i18n-extract\" and commit the changes in webapp/playbooks/i18n/en.json." && exit 1) + check-types: runs-on: ubuntu-22.04 defaults: @@ -98,32 +61,14 @@ jobs: steps: - name: ci/checkout-repo uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 - - name: ci/setup-node - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 - id: setup_node - with: - node-version-file: ".nvmrc" - cache: npm - cache-dependency-path: 'webapp/package-lock.json' - # - uses: actions/cache@2b8105bdae4b746666ee225970c4a281bbd9d51f # v3.2.4 - # id: npm-cache - # with: - # path: | - # '**/node_modules' - # 'e2e-tests/playwright/node_modules' - # 'e2e-tests/cypress/node_modules' - # key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('e2e-tests/cypress/package-lock.json') }}-${{ hashFiles('e2e-tests/playwright/package-lock.json') }} - - name: ci/get-node-modules - # if: steps.npm-cache.outputs.cache-hit != 'true' - run: | - make node_modules - # make channels/e2e-tests/playwright/node_modules + - name: ci/setup + uses: ./.github/actions/webapp-setup - name: ci/lint run: | npm run check-types + test: runs-on: ubuntu-22.04 - needs: [check-types, check-i18n, check-lint] permissions: checks: write pull-requests: write @@ -133,34 +78,14 @@ jobs: steps: - name: ci/checkout-repo uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 - - name: ci/setup-node - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 - id: setup_node - with: - node-version-file: ".nvmrc" - cache: npm - cache-dependency-path: 'webapp/package-lock.json' - # - uses: actions/cache@2b8105bdae4b746666ee225970c4a281bbd9d51f # v3.2.4 - # id: npm-cache - # with: - # path: | - # '**/node_modules' - # 'e2e-tests/playwright/node_modules' - # 'e2e-tests/cypress/node_modules' - # key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('e2e-tests/cypress/package-lock.json') }}-${{ hashFiles('e2e-tests/playwright/package-lock.json') }} - - name: ci/get-node-modules - # if: steps.npm-cache.outputs.cache-hit != 'true' - run: | - make node_modules - # make channels/e2e-tests/playwright/node_modules + - name: ci/setup + uses: ./.github/actions/webapp-setup - name: ci/test env: NODE_OPTIONS: --max_old_space_size=5120 run: | - npm run test-ci --workspace=boards - npm run test-ci --workspace=channels - npm run test-ci --workspace=platform/client - npm run test-ci --workspace=playbooks + npm run test-ci + build: runs-on: ubuntu-22.04 defaults: @@ -169,29 +94,12 @@ jobs: steps: - name: ci/checkout-repo uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 - - name: ci/setup-node - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 - id: setup_node - with: - node-version-file: ".nvmrc" - cache: npm - cache-dependency-path: 'webapp/package-lock.json' - # - uses: actions/cache@2b8105bdae4b746666ee225970c4a281bbd9d51f # v3.2.4 - # id: npm-cache - # with: - # path: | - # '**/node_modules' - # 'e2e-tests/playwright/node_modules' - # 'e2e-tests/cypress/node_modules' - # key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('e2e-tests/cypress/package-lock.json') }}-${{ hashFiles('e2e-tests/playwright/package-lock.json') }} - - name: ci/get-node-modules - # if: steps.npm-cache.outputs.cache-hit != 'true' - run: | - make node_modules - # make channels/e2e-tests/playwright/node_modules + - name: ci/setup + uses: ./.github/actions/webapp-setup - name: ci/build run: | npm run build + # run-performance-bechmarks: # uses: ./.github/workflows/performance-benchmarks.yml # needs: build diff --git a/webapp/package.json b/webapp/package.json index 2deee4b4b8..cb88f1f9d2 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -11,6 +11,7 @@ "run": "node scripts/run.js", "dev-server": "node scripts/dev-server.js", "test": "npm run test --workspaces --if-present", + "test-ci": "npm run test-ci --workspaces --if-present", "check": "npm run check --workspaces --if-present", "fix": "npm run fix --workspaces --if-present", "check-types": "npm run check-types --workspaces --if-present",