MM-52438 Clean up web app CI and only run when web app code is changed (#23232)

* MM-52438 Only run web app CI for PRs with web app changes

* MM-52438 Don't wait to run web app tests in CI

* MM-52438 Remove commented out caching

* MM-52438 Reuse steps to set up webapp environment

* MM-52438 Add test-ci script to root package.json

* Simplify path filter
This commit is contained in:
Harrison Healey
2023-05-17 13:59:34 -04:00
committed by GitHub
parent f48f979e1b
commit 3b5e556e1c
5 changed files with 37 additions and 109 deletions

18
.github/actions/webapp-setup/action.yml vendored Normal file
View File

@@ -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

View File

@@ -5,7 +5,6 @@ on:
- master
- cloud
- release-*
- mono-repo*
jobs:
master-ci:

View File

@@ -1,6 +1,8 @@
name: Web App CI PR
on:
pull_request:
paths:
- 'webapp/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

View File

@@ -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

View File

@@ -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",