From 0b042d191723fda56e01a003314250cca22ff95e Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Fri, 5 Nov 2021 21:57:19 +0700 Subject: [PATCH 01/28] test: add ci-pipeline --- .github/workflows/test.yml | 164 +++++++++++++++++++++++++++++++++++-- 1 file changed, 157 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 53abf80e05..d654fe9721 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,10 @@ name: Test on: - pull_request: - branches: [develop] + push: + branches: + - improve-ci-pipeline-2 jobs: - test-ubuntu: + build: runs-on: ubuntu-latest steps: - name: Check out repository code @@ -17,10 +18,159 @@ jobs: uses: actions/setup-node@v2 with: node-version: 15.x - cache: 'npm' - - run: npm ci --ignore-scripts --audit=false --fund=false + - name: Setup caching dependencies + uses: actions/cache@v2 + id: cache-npm + with: + path: | + node_modules + */*/node_modules + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + + - name: Install Dependencies + if: steps.cache-npm.outputs.cache-hit != 'true' + run: | + npm ci --ignore-scripts --audit=false --fund=false + + - name: Setup caching build + uses: actions/cache@v2 + id: cache-build + with: + path: | + packages/*/lib + packages/*/light + packages/*/dark + packages/*/charcoal + packages/*/pearl + key: ${{ runner.os }}-build-${{ github.sha }} + restore-keys: ${{ runner.os }}-build-${{ github.sha }} + + - name: Build changed packages + if: steps.cache-build.outputs.cache-hit != 'true' + run: | + lerna run build --include-dependencies --since origin/develop...HEAD + + + lint: + needs: build + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v2 + with: + # Number of commits to fetch. 0 indicates all history for all branches and tags. + # Pulls all commits (needed for Lerna) + fetch-depth: 0 - - run: lerna run build --include-dependencies --since origin/develop...HEAD + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 15.x + + - name: Setup caching dependencies + uses: actions/cache@v2 + with: + path: | + node_modules + */*/node_modules + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + + - name: Setup caching build + uses: actions/cache@v2 + id: cache-build + with: + path: | + packages/*/lib + packages/*/light + packages/*/dark + packages/*/charcoal + packages/*/pearl + key: ${{ runner.os }}-build-${{ github.sha }} + restore-keys: ${{ runner.os }}-build-${{ github.sha }} + + - run: lerna run lint --include-dependents --since origin/develop...HEAD + + test-google-chrome: + needs: lint + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v2 + with: + # Number of commits to fetch. 0 indicates all history for all branches and tags. + # Pulls all commits (needed for Lerna) + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 15.x + + - name: Setup caching dependencies + uses: actions/cache@v2 + with: + path: | + node_modules + */*/node_modules + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + + - name: Setup caching build + uses: actions/cache@v2 + id: cache-build + with: + path: | + packages/*/lib + packages/*/light + packages/*/dark + packages/*/charcoal + packages/*/pearl + key: ${{ runner.os }}-build-${{ github.sha }} + restore-keys: ${{ runner.os }}-build-${{ github.sha }} + + - run: lerna bootstrap + - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers chrome + + test-firefox: + needs: lint + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v2 + with: + # Number of commits to fetch. 0 indicates all history for all branches and tags. + # Pulls all commits (needed for Lerna) + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 15.x + + - name: Setup caching dependencies + uses: actions/cache@v2 + with: + path: | + node_modules + */*/node_modules + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + + - name: Setup caching build + uses: actions/cache@v2 + id: cache-build + with: + path: | + packages/*/lib + packages/*/light + packages/*/dark + packages/*/charcoal + packages/*/pearl + key: ${{ runner.os }}-build-${{ github.sha }} + restore-keys: ${{ runner.os }}-build-${{ github.sha }} - - run: lerna run test --include-dependents --since origin/develop...HEAD + - run: lerna bootstrap + - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers firefox --includeCoverage false From dd3376c7bc5f12a3c736b311263248cfeb3268f4 Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Mon, 8 Nov 2021 16:12:10 +0700 Subject: [PATCH 02/28] test: ci init lerna from previous stage --- .github/workflows/test.yml | 3 --- packages/core/package.json | 3 ++- packages/demo-block/package.json | 2 +- packages/i18n/package.json | 3 ++- packages/phrasebook/package.json | 3 ++- packages/test-helpers/package.json | 3 ++- packages/translate/package.json | 2 +- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d654fe9721..e2e2e42fdb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,7 +52,6 @@ jobs: run: | lerna run build --include-dependencies --since origin/develop...HEAD - lint: needs: build runs-on: ubuntu-latest @@ -131,7 +130,6 @@ jobs: key: ${{ runner.os }}-build-${{ github.sha }} restore-keys: ${{ runner.os }}-build-${{ github.sha }} - - run: lerna bootstrap - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers chrome test-firefox: @@ -172,5 +170,4 @@ jobs: key: ${{ runner.os }}-build-${{ github.sha }} restore-keys: ${{ runner.os }}-build-${{ github.sha }} - - run: lerna bootstrap - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers firefox --includeCoverage false diff --git a/packages/core/package.json b/packages/core/package.json index 1cda131d69..1ad94dc6cc 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -42,10 +42,11 @@ "license": "Apache-2.0", "scripts": { "build": "tsc --sourceMap --declarationMap", + "build:watch": "npm run build -- --watch --preserveWatchOutput", "build:prod": "tsc", "lint": "eslint .", "lint:fix": "eslint . --fix", - "test": "npm run build && karma start ../../karma.config.js --package=core", + "test": "karma start ../../karma.config.js --package=core", "test:snapshots": "npm run test -- --snapshots", "test:watch": "npm run build && npm run test -- --watch", "prepublishOnly": "node scripts/release" diff --git a/packages/demo-block/package.json b/packages/demo-block/package.json index 9e4be075fa..6bbced9334 100644 --- a/packages/demo-block/package.json +++ b/packages/demo-block/package.json @@ -12,7 +12,7 @@ "lint": "eslint .", "lint:fix": "eslint . --fix", "start": "npm run build && concurrently \"npm run build:watch\" \"web-dev-server --config ../../server.config.js --app-index __demo__\"", - "test": "npm run build && karma start ../../karma.config.js --package=demo-block", + "test": "karma start ../../karma.config.js --package=demo-block", "test:snapshots": "npm run test -- --snapshots", "test:watch": "npm run test -- --watch", "prepublishOnly": "node scripts/release" diff --git a/packages/i18n/package.json b/packages/i18n/package.json index d66c442d12..cef8aaf823 100644 --- a/packages/i18n/package.json +++ b/packages/i18n/package.json @@ -12,10 +12,11 @@ }, "scripts": { "build": "tsc --sourceMap --declarationMap", + "build:watch": "npm run build -- --watch --preserveWatchOutput", "build:prod": "tsc", "lint": "eslint .", "lint:fix": "eslint . --fix", - "test": "npm run build && karma start ../../karma.config.js --package=i18n --include-snapshots=false", + "test": "karma start ../../karma.config.js --package=i18n --include-snapshots=false", "test:watch": "npm run test -- --watch" }, "author": "Refinitiv", diff --git a/packages/phrasebook/package.json b/packages/phrasebook/package.json index 9ea7ec75f7..bd67d17a47 100644 --- a/packages/phrasebook/package.json +++ b/packages/phrasebook/package.json @@ -117,10 +117,11 @@ }, "scripts": { "build": "tsc --sourceMap --declarationMap", + "build:watch": "npm run build -- --watch --preserveWatchOutput", "build:prod": "tsc", "lint": "eslint .", "lint:fix": "eslint . --fix", - "test": "npm run build && mocha __test__/**/*.js --require esm" + "test": "mocha __test__/**/*.js --require esm" }, "devDependencies": { "chai": "^4.3.4", diff --git a/packages/test-helpers/package.json b/packages/test-helpers/package.json index 1c9a21a03a..cb328d361c 100644 --- a/packages/test-helpers/package.json +++ b/packages/test-helpers/package.json @@ -14,10 +14,11 @@ "license": "Apache-2.0", "scripts": { "build": "tsc --sourceMap --declarationMap", + "build:watch": "npm run build -- --watch --preserveWatchOutput", "build:prod": "tsc", "lint": "eslint .", "lint:fix": "eslint . --fix", - "test": "npm run build && karma start ../../karma.config.js --package=test-helpers --include-snapshots=false", + "test": "karma start ../../karma.config.js --package=test-helpers --include-snapshots=false", "test:watch": "npm run test -- --watch" }, "publishConfig": { diff --git a/packages/translate/package.json b/packages/translate/package.json index 20d1e3c8ca..c2b6cb0aa6 100644 --- a/packages/translate/package.json +++ b/packages/translate/package.json @@ -19,7 +19,7 @@ "lint": "eslint .", "lint:fix": "eslint . --fix", "start": "npm run build && concurrently \"npm run build:watch\" \"web-dev-server --config ../../server.config.js --app-index __demo__\"", - "test": "npm run build && karma start ../../karma.config.js --package=translate", + "test": "karma start ../../karma.config.js --package=translate", "test:snapshots": "npm run test -- --snapshots", "test:watch": "npm run test -- --watch" }, From 78c47025d70d83ce60a1333786fbb9be7b8c6191 Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Mon, 20 Dec 2021 15:28:28 +0700 Subject: [PATCH 03/28] chore: reuse ci workflow --- .github/workflows/test-browser.yml | 52 ++++++++++++++++++ .github/workflows/test.yml | 84 ++++-------------------------- 2 files changed, 61 insertions(+), 75 deletions(-) create mode 100644 .github/workflows/test-browser.yml diff --git a/.github/workflows/test-browser.yml b/.github/workflows/test-browser.yml new file mode 100644 index 0000000000..4cc310946e --- /dev/null +++ b/.github/workflows/test-browser.yml @@ -0,0 +1,52 @@ +name: Test Browser +on: + workflow_call: + inputs: + browser: + required: true + type: string + default: chrome + description: input browser name for run test + coverage: + type: boolean + default: false + description: include code coverage testing +jobs: + test-browser: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v2 + with: + # Number of commits to fetch. 0 indicates all history for all branches and tags. + # Pulls all commits (needed for Lerna) + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 15.x + + - name: Setup caching dependencies + uses: actions/cache@v2 + with: + path: | + node_modules + */*/node_modules + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + + - name: Setup caching build + uses: actions/cache@v2 + id: cache-build + with: + path: | + packages/*/lib + packages/*/light + packages/*/dark + packages/*/charcoal + packages/*/pearl + key: ${{ runner.os }}-build-${{ github.sha }} + restore-keys: ${{ runner.os }}-build-${{ github.sha }} + + - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers ${{inputs.browser}} --includeCoverage ${{inputs.coverage}} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e2e2e42fdb..beb84d4564 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: Test on: push: branches: - - improve-ci-pipeline-2 + - improve-ci jobs: build: runs-on: ubuntu-latest @@ -94,80 +94,14 @@ jobs: test-google-chrome: needs: lint - runs-on: ubuntu-latest - steps: - - name: Check out repository code - uses: actions/checkout@v2 - with: - # Number of commits to fetch. 0 indicates all history for all branches and tags. - # Pulls all commits (needed for Lerna) - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 15.x - - - name: Setup caching dependencies - uses: actions/cache@v2 - with: - path: | - node_modules - */*/node_modules - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - - - name: Setup caching build - uses: actions/cache@v2 - id: cache-build - with: - path: | - packages/*/lib - packages/*/light - packages/*/dark - packages/*/charcoal - packages/*/pearl - key: ${{ runner.os }}-build-${{ github.sha }} - restore-keys: ${{ runner.os }}-build-${{ github.sha }} - - - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers chrome + uses: Refinitiv/refinitiv-ui/.github/workflows/test-browser.yml@improve-ci + with: + browser: chrome + coverage: true test-firefox: needs: lint - runs-on: ubuntu-latest - steps: - - name: Check out repository code - uses: actions/checkout@v2 - with: - # Number of commits to fetch. 0 indicates all history for all branches and tags. - # Pulls all commits (needed for Lerna) - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 15.x - - - name: Setup caching dependencies - uses: actions/cache@v2 - with: - path: | - node_modules - */*/node_modules - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - - - name: Setup caching build - uses: actions/cache@v2 - id: cache-build - with: - path: | - packages/*/lib - packages/*/light - packages/*/dark - packages/*/charcoal - packages/*/pearl - key: ${{ runner.os }}-build-${{ github.sha }} - restore-keys: ${{ runner.os }}-build-${{ github.sha }} - - - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers firefox --includeCoverage false + uses: Refinitiv/refinitiv-ui/.github/workflows/test-browser.yml@improve-ci + with: + browser: firefox + coverage: false From eab8375c25b954a0117c7791bcd7c08b669b8379 Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Mon, 20 Dec 2021 15:56:32 +0700 Subject: [PATCH 04/28] chore: add ci build workflow --- .github/workflows/build.yml | 52 +++++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 51 +++--------------------------------- 2 files changed, 55 insertions(+), 48 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..279b520c2a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,52 @@ +name: Build Code +on: + workflow_call: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v2 + with: + # Number of commits to fetch. 0 indicates all history for all branches and tags. + # Pulls all commits (needed for Lerna) + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 15.x + + - name: Setup caching dependencies + uses: actions/cache@v2 + id: cache-npm + with: + path: | + node_modules + */*/node_modules + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + + - name: Install Dependencies + if: steps.cache-npm.outputs.cache-hit != 'true' + run: | + npm ci --ignore-scripts --audit=false --fund=false + + - name: Setup caching build + uses: actions/cache@v2 + id: cache-build + with: + path: | + packages/*/lib + packages/*/light + packages/*/dark + packages/*/charcoal + packages/*/pearl + key: ${{ runner.os }}-build-${{ github.sha }} + restore-keys: ${{ runner.os }}-build-${{ github.sha }} + + - name: Build changed packages + if: steps.cache-build.outputs.cache-hit != 'true' + run: | + lerna run build --include-dependencies --since origin/develop...HEAD diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index beb84d4564..b570da5857 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,52 +5,7 @@ on: - improve-ci jobs: build: - runs-on: ubuntu-latest - steps: - - name: Check out repository code - uses: actions/checkout@v2 - with: - # Number of commits to fetch. 0 indicates all history for all branches and tags. - # Pulls all commits (needed for Lerna) - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 15.x - - - name: Setup caching dependencies - uses: actions/cache@v2 - id: cache-npm - with: - path: | - node_modules - */*/node_modules - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - - - name: Install Dependencies - if: steps.cache-npm.outputs.cache-hit != 'true' - run: | - npm ci --ignore-scripts --audit=false --fund=false - - - name: Setup caching build - uses: actions/cache@v2 - id: cache-build - with: - path: | - packages/*/lib - packages/*/light - packages/*/dark - packages/*/charcoal - packages/*/pearl - key: ${{ runner.os }}-build-${{ github.sha }} - restore-keys: ${{ runner.os }}-build-${{ github.sha }} - - - name: Build changed packages - if: steps.cache-build.outputs.cache-hit != 'true' - run: | - lerna run build --include-dependencies --since origin/develop...HEAD + uses: Refinitiv/refinitiv-ui/.github/workflows/build.yml@improve-ci lint: needs: build @@ -92,14 +47,14 @@ jobs: - run: lerna run lint --include-dependents --since origin/develop...HEAD - test-google-chrome: + google-chrome: needs: lint uses: Refinitiv/refinitiv-ui/.github/workflows/test-browser.yml@improve-ci with: browser: chrome coverage: true - test-firefox: + firefox: needs: lint uses: Refinitiv/refinitiv-ui/.github/workflows/test-browser.yml@improve-ci with: From d4a93d2ac363df670755b84c24a39a9fa426ffdd Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Mon, 20 Dec 2021 17:44:45 +0700 Subject: [PATCH 05/28] chore: add ci install workflow --- .github/workflows/install.yml | 34 ++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 4 ++++ 2 files changed, 38 insertions(+) create mode 100644 .github/workflows/install.yml diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml new file mode 100644 index 0000000000..ae267d7aab --- /dev/null +++ b/.github/workflows/install.yml @@ -0,0 +1,34 @@ +name: Install dependencies +on: + workflow_call: + +jobs: + install: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v2 + with: + # Number of commits to fetch. 0 indicates all history for all branches and tags. + # Pulls all commits (needed for Lerna) + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 15.x + + - name: Setup caching dependencies + uses: actions/cache@v2 + id: cache-npm + with: + path: | + node_modules + */*/node_modules + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + + - name: Install Dependencies + if: steps.cache-npm.outputs.cache-hit != 'true' + run: | + npm ci --ignore-scripts --audit=false --fund=false diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b570da5857..52d14f0f95 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,11 @@ on: branches: - improve-ci jobs: + install: + uses: Refinitiv/refinitiv-ui/.github/workflows/install.yml@improve-ci + build: + needs: install uses: Refinitiv/refinitiv-ui/.github/workflows/build.yml@improve-ci lint: From 3ec3f7fec6bd76d4b150206c86cc496873681be4 Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Mon, 20 Dec 2021 18:05:02 +0700 Subject: [PATCH 06/28] chore: ci reuse lint workflow --- .github/workflows/build.yml | 2 +- .github/workflows/install.yml | 2 +- .github/workflows/lint.yml | 29 ++++++++++++++++++++------ .github/workflows/test.yml | 38 +---------------------------------- 4 files changed, 26 insertions(+), 45 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 279b520c2a..452ccdacfd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ on: workflow_call: jobs: - build: + build-code: runs-on: ubuntu-latest steps: - name: Check out repository code diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index ae267d7aab..209fabd109 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -3,7 +3,7 @@ on: workflow_call: jobs: - install: + install-dependencies: runs-on: ubuntu-latest steps: - name: Check out repository code diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6c50b632a3..8a1711183c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,9 +1,9 @@ name: Lint on: - pull_request: - branches: [develop] + workflow_call: + jobs: - lint: + lint-code: runs-on: ubuntu-latest steps: - name: Check out repository code @@ -17,10 +17,27 @@ jobs: uses: actions/setup-node@v2 with: node-version: 15.x - cache: 'npm' - - run: npm ci --ignore-scripts --audit=false --fund=false + - name: Setup caching dependencies + uses: actions/cache@v2 + with: + path: | + node_modules + */*/node_modules + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - - run: lerna run build --include-dependencies --since origin/develop...HEAD + - name: Setup caching build + uses: actions/cache@v2 + id: cache-build + with: + path: | + packages/*/lib + packages/*/light + packages/*/dark + packages/*/charcoal + packages/*/pearl + key: ${{ runner.os }}-build-${{ github.sha }} + restore-keys: ${{ runner.os }}-build-${{ github.sha }} - run: lerna run lint --include-dependents --since origin/develop...HEAD diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 52d14f0f95..29659bec50 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,43 +13,7 @@ jobs: lint: needs: build - runs-on: ubuntu-latest - steps: - - name: Check out repository code - uses: actions/checkout@v2 - with: - # Number of commits to fetch. 0 indicates all history for all branches and tags. - # Pulls all commits (needed for Lerna) - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 15.x - - - name: Setup caching dependencies - uses: actions/cache@v2 - with: - path: | - node_modules - */*/node_modules - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - - - name: Setup caching build - uses: actions/cache@v2 - id: cache-build - with: - path: | - packages/*/lib - packages/*/light - packages/*/dark - packages/*/charcoal - packages/*/pearl - key: ${{ runner.os }}-build-${{ github.sha }} - restore-keys: ${{ runner.os }}-build-${{ github.sha }} - - - run: lerna run lint --include-dependents --since origin/develop...HEAD + uses: Refinitiv/refinitiv-ui/.github/workflows/lint.yml@improve-ci google-chrome: needs: lint From fd3783e796a84b5e0ec7767577ebd61109459853 Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Tue, 21 Dec 2021 14:14:18 +0700 Subject: [PATCH 07/28] chore: update ci npm cach path --- .github/workflows/build.yml | 6 ++---- .github/workflows/lint.yml | 6 ++---- .github/workflows/test-browser.yml | 6 ++---- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 452ccdacfd..60db8c2544 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,10 +39,8 @@ jobs: with: path: | packages/*/lib - packages/*/light - packages/*/dark - packages/*/charcoal - packages/*/pearl + packages/*-theme/**/*.js + packages/*-theme/**/*.css key: ${{ runner.os }}-build-${{ github.sha }} restore-keys: ${{ runner.os }}-build-${{ github.sha }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8a1711183c..18a4b8a252 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -33,10 +33,8 @@ jobs: with: path: | packages/*/lib - packages/*/light - packages/*/dark - packages/*/charcoal - packages/*/pearl + packages/*-theme/**/*.js + packages/*-theme/**/*.css key: ${{ runner.os }}-build-${{ github.sha }} restore-keys: ${{ runner.os }}-build-${{ github.sha }} diff --git a/.github/workflows/test-browser.yml b/.github/workflows/test-browser.yml index 4cc310946e..45c747af10 100644 --- a/.github/workflows/test-browser.yml +++ b/.github/workflows/test-browser.yml @@ -42,10 +42,8 @@ jobs: with: path: | packages/*/lib - packages/*/light - packages/*/dark - packages/*/charcoal - packages/*/pearl + packages/*-theme/**/*.js + packages/*-theme/**/*.css key: ${{ runner.os }}-build-${{ github.sha }} restore-keys: ${{ runner.os }}-build-${{ github.sha }} From ad9b75a2009a7f814e8187ffba0472092ad8f2cb Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Tue, 21 Dec 2021 14:50:47 +0700 Subject: [PATCH 08/28] chore: ci comparison multiple stage --- .github/workflows/lint-old.yml | 27 +++++++++++++++++++++++++++ .github/workflows/test-chrome.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/test-firefox.yml | 29 +++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 .github/workflows/lint-old.yml create mode 100644 .github/workflows/test-chrome.yml create mode 100644 .github/workflows/test-firefox.yml diff --git a/.github/workflows/lint-old.yml b/.github/workflows/lint-old.yml new file mode 100644 index 0000000000..7b45b65496 --- /dev/null +++ b/.github/workflows/lint-old.yml @@ -0,0 +1,27 @@ +name: Lint +on: + push: + branches: + - improve-ci-exclude +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v2 + with: + # Number of commits to fetch. 0 indicates all history for all branches and tags. + # Pulls all commits (needed for Lerna) + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 15.x + cache: 'npm' + + - run: npm ci --ignore-scripts --audit=false --fund=false + + - run: lerna run build --include-dependencies --since origin/develop...HEAD + + - run: lerna run lint --include-dependents --since origin/develop...HEAD diff --git a/.github/workflows/test-chrome.yml b/.github/workflows/test-chrome.yml new file mode 100644 index 0000000000..e90447c6a9 --- /dev/null +++ b/.github/workflows/test-chrome.yml @@ -0,0 +1,29 @@ +name: Test +on: + push: + branches: + - improve-ci +jobs: + test-chrome: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v2 + with: + # Number of commits to fetch. 0 indicates all history for all branches and tags. + # Pulls all commits (needed for Lerna) + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 15.x + cache: 'npm' + + - run: npm ci --ignore-scripts --audit=false --fund=false + + - run: lerna run build --include-dependencies --since origin/develop...HEAD + + - run: lerna run lint --include-dependents --since origin/develop...HEAD + + - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers chrome --includeCoverage true diff --git a/.github/workflows/test-firefox.yml b/.github/workflows/test-firefox.yml new file mode 100644 index 0000000000..44901cb636 --- /dev/null +++ b/.github/workflows/test-firefox.yml @@ -0,0 +1,29 @@ +name: Test +on: + push: + branches: + - improve-ci +jobs: + test-firefox: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v2 + with: + # Number of commits to fetch. 0 indicates all history for all branches and tags. + # Pulls all commits (needed for Lerna) + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 15.x + cache: 'npm' + + - run: npm ci --ignore-scripts --audit=false --fund=false + + - run: lerna run build --include-dependencies --since origin/develop...HEAD + + - run: lerna run lint --include-dependents --since origin/develop...HEAD + + - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers firefox --includeCoverage false From f7f5f5cc7d3ba2415a136582c170bd7a7ffb5bcb Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Tue, 21 Dec 2021 15:13:45 +0700 Subject: [PATCH 09/28] chore: ci group build step --- .github/workflows/test.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 29659bec50..42aa1f2faf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,11 +4,10 @@ on: branches: - improve-ci jobs: - install: - uses: Refinitiv/refinitiv-ui/.github/workflows/install.yml@improve-ci + # install: + # uses: Refinitiv/refinitiv-ui/.github/workflows/install.yml@improve-ci build: - needs: install uses: Refinitiv/refinitiv-ui/.github/workflows/build.yml@improve-ci lint: From b3d4ac2d41c7553791f9f14ab3ea42826c26b153 Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Tue, 21 Dec 2021 16:11:18 +0700 Subject: [PATCH 10/28] chore: ci remove build before test --- packages/elements/scripts/cmd/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/elements/scripts/cmd/test.js b/packages/elements/scripts/cmd/test.js index 105e6c051d..b74a263cd0 100644 --- a/packages/elements/scripts/cmd/test.js +++ b/packages/elements/scripts/cmd/test.js @@ -53,7 +53,7 @@ exports.handler = (argv) => { } try { - execSync('node cli build --sourceMap --declarationMap'); + // execSync('node cli build --sourceMap --declarationMap'); const command = ['karma', 'start', 'karma.config.js', `--package=${PACKAGE_NAME}`]; watch && command.push('--watch'); From c92b4e3b13a2cdf13462a8deef3c9a6abcee1532 Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Tue, 21 Dec 2021 16:22:33 +0700 Subject: [PATCH 11/28] chore: ci exclude test workflow --- .github/workflows/test-chrome.yml | 2 +- .github/workflows/test-firefox.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-chrome.yml b/.github/workflows/test-chrome.yml index e90447c6a9..b7cfdc2dd5 100644 --- a/.github/workflows/test-chrome.yml +++ b/.github/workflows/test-chrome.yml @@ -2,7 +2,7 @@ name: Test on: push: branches: - - improve-ci + - improve-ci-exclude jobs: test-chrome: runs-on: ubuntu-latest diff --git a/.github/workflows/test-firefox.yml b/.github/workflows/test-firefox.yml index 44901cb636..a8396007e2 100644 --- a/.github/workflows/test-firefox.yml +++ b/.github/workflows/test-firefox.yml @@ -2,7 +2,7 @@ name: Test on: push: branches: - - improve-ci + - improve-ci-exclude jobs: test-firefox: runs-on: ubuntu-latest From f4c011f97d7926c5c3424f9d461be372d4806353 Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Wed, 22 Dec 2021 13:01:44 +0700 Subject: [PATCH 12/28] chore: ci with caching --- .github/workflows/install.yml | 34 ------------------------------ .github/workflows/lint-old.yml | 27 ------------------------ .github/workflows/test-chrome.yml | 29 ------------------------- .github/workflows/test-firefox.yml | 29 ------------------------- .github/workflows/test.yml | 5 +---- 5 files changed, 1 insertion(+), 123 deletions(-) delete mode 100644 .github/workflows/install.yml delete mode 100644 .github/workflows/lint-old.yml delete mode 100644 .github/workflows/test-chrome.yml delete mode 100644 .github/workflows/test-firefox.yml diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml deleted file mode 100644 index 209fabd109..0000000000 --- a/.github/workflows/install.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Install dependencies -on: - workflow_call: - -jobs: - install-dependencies: - runs-on: ubuntu-latest - steps: - - name: Check out repository code - uses: actions/checkout@v2 - with: - # Number of commits to fetch. 0 indicates all history for all branches and tags. - # Pulls all commits (needed for Lerna) - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 15.x - - - name: Setup caching dependencies - uses: actions/cache@v2 - id: cache-npm - with: - path: | - node_modules - */*/node_modules - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - - - name: Install Dependencies - if: steps.cache-npm.outputs.cache-hit != 'true' - run: | - npm ci --ignore-scripts --audit=false --fund=false diff --git a/.github/workflows/lint-old.yml b/.github/workflows/lint-old.yml deleted file mode 100644 index 7b45b65496..0000000000 --- a/.github/workflows/lint-old.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Lint -on: - push: - branches: - - improve-ci-exclude -jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: Check out repository code - uses: actions/checkout@v2 - with: - # Number of commits to fetch. 0 indicates all history for all branches and tags. - # Pulls all commits (needed for Lerna) - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 15.x - cache: 'npm' - - - run: npm ci --ignore-scripts --audit=false --fund=false - - - run: lerna run build --include-dependencies --since origin/develop...HEAD - - - run: lerna run lint --include-dependents --since origin/develop...HEAD diff --git a/.github/workflows/test-chrome.yml b/.github/workflows/test-chrome.yml deleted file mode 100644 index b7cfdc2dd5..0000000000 --- a/.github/workflows/test-chrome.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Test -on: - push: - branches: - - improve-ci-exclude -jobs: - test-chrome: - runs-on: ubuntu-latest - steps: - - name: Check out repository code - uses: actions/checkout@v2 - with: - # Number of commits to fetch. 0 indicates all history for all branches and tags. - # Pulls all commits (needed for Lerna) - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 15.x - cache: 'npm' - - - run: npm ci --ignore-scripts --audit=false --fund=false - - - run: lerna run build --include-dependencies --since origin/develop...HEAD - - - run: lerna run lint --include-dependents --since origin/develop...HEAD - - - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers chrome --includeCoverage true diff --git a/.github/workflows/test-firefox.yml b/.github/workflows/test-firefox.yml deleted file mode 100644 index a8396007e2..0000000000 --- a/.github/workflows/test-firefox.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Test -on: - push: - branches: - - improve-ci-exclude -jobs: - test-firefox: - runs-on: ubuntu-latest - steps: - - name: Check out repository code - uses: actions/checkout@v2 - with: - # Number of commits to fetch. 0 indicates all history for all branches and tags. - # Pulls all commits (needed for Lerna) - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 15.x - cache: 'npm' - - - run: npm ci --ignore-scripts --audit=false --fund=false - - - run: lerna run build --include-dependencies --since origin/develop...HEAD - - - run: lerna run lint --include-dependents --since origin/develop...HEAD - - - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers firefox --includeCoverage false diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 42aa1f2faf..0d29fc0f34 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,9 +4,6 @@ on: branches: - improve-ci jobs: - # install: - # uses: Refinitiv/refinitiv-ui/.github/workflows/install.yml@improve-ci - build: uses: Refinitiv/refinitiv-ui/.github/workflows/build.yml@improve-ci @@ -14,7 +11,7 @@ jobs: needs: build uses: Refinitiv/refinitiv-ui/.github/workflows/lint.yml@improve-ci - google-chrome: + chrome: needs: lint uses: Refinitiv/refinitiv-ui/.github/workflows/test-browser.yml@improve-ci with: From 971ee5f33914fed04ec2ce26f718745935cf58ea Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Wed, 22 Dec 2021 14:41:56 +0700 Subject: [PATCH 13/28] chore: ci reuse composite action --- .github/actions/cache.yml | 35 ++++++++++++++++++++++++++++++++ .github/actions/cache/action.yml | 32 +++++++++++++++++++++++++++++ .github/workflows/build.yml | 27 +++++------------------- .github/workflows/test.yml | 2 +- 4 files changed, 73 insertions(+), 23 deletions(-) create mode 100644 .github/actions/cache.yml create mode 100644 .github/actions/cache/action.yml diff --git a/.github/actions/cache.yml b/.github/actions/cache.yml new file mode 100644 index 0000000000..e34391c663 --- /dev/null +++ b/.github/actions/cache.yml @@ -0,0 +1,35 @@ +name: 'Cache NPM and Build' +description: 'Cache NPM dependencies and and build output scripts' +runs: + using: "composite" + steps: + - name: Setup caching dependencies + uses: actions/cache@v2 + id: cache-npm + with: + path: | + node_modules + */*/node_modules + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + + - name: Install Dependencies + if: steps.cache-npm.outputs.cache-hit != 'true' + run: | + npm ci --ignore-scripts --audit=false --fund=false + + - name: Setup caching build + uses: actions/cache@v2 + id: cache-build + with: + path: | + packages/*/lib + packages/*-theme/**/*.js + packages/*-theme/**/*.css + key: ${{ runner.os }}-build-${{ github.sha }} + restore-keys: ${{ runner.os }}-build-${{ github.sha }} + + - name: Build changed packages + if: steps.cache-build.outputs.cache-hit != 'true' + run: | + lerna run build --include-dependencies --since origin/develop...HEAD diff --git a/.github/actions/cache/action.yml b/.github/actions/cache/action.yml new file mode 100644 index 0000000000..5a79d358ff --- /dev/null +++ b/.github/actions/cache/action.yml @@ -0,0 +1,32 @@ +name: 'Cache NPM and Build' +description: 'Cache NPM dependencies and and build output scripts' +outputs: + dependencies-hit: + description: "Use dependencies cache" + value: ${{ steps.cache-npm.outputs.cache-hit }} + build-hit: + description: "Use build output scripts cache" + value: ${{ steps.cache-build.outputs.cache-hit }} +runs: + using: "composite" + steps: + - name: Setup caching dependencies + uses: actions/cache@v2 + id: cache-npm + with: + path: | + node_modules + */*/node_modules + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + + - name: Setup caching build + uses: actions/cache@v2 + id: cache-build + with: + path: | + packages/*/lib + packages/*-theme/**/*.js + packages/*-theme/**/*.css + key: ${{ runner.os }}-build-${{ github.sha }} + restore-keys: ${{ runner.os }}-build-${{ github.sha }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 60db8c2544..dc50c3c4e8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,33 +18,16 @@ jobs: with: node-version: 15.x - - name: Setup caching dependencies - uses: actions/cache@v2 - id: cache-npm - with: - path: | - node_modules - */*/node_modules - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + - name: Setup caching dependencies and build output scripts + uses: ./.github/actions/cache + id: cache - name: Install Dependencies - if: steps.cache-npm.outputs.cache-hit != 'true' + if: steps.cache.outputs.dependencies-hit != 'true' run: | npm ci --ignore-scripts --audit=false --fund=false - - name: Setup caching build - uses: actions/cache@v2 - id: cache-build - with: - path: | - packages/*/lib - packages/*-theme/**/*.js - packages/*-theme/**/*.css - key: ${{ runner.os }}-build-${{ github.sha }} - restore-keys: ${{ runner.os }}-build-${{ github.sha }} - - name: Build changed packages - if: steps.cache-build.outputs.cache-hit != 'true' + if: steps.cache.outputs.build-hit != 'true' run: | lerna run build --include-dependencies --since origin/develop...HEAD diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0d29fc0f34..312f7642cb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Test +name: Test PR on: push: branches: From 7d5673772d4a3d6da187aa358b5ad944d1c226fe Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Wed, 22 Dec 2021 15:52:04 +0700 Subject: [PATCH 14/28] chore: ci reuse cache action --- .github/workflows/lint.yml | 21 ++------------------- .github/workflows/test-browser.yml | 21 ++------------------- 2 files changed, 4 insertions(+), 38 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 18a4b8a252..d862964c00 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,24 +18,7 @@ jobs: with: node-version: 15.x - - name: Setup caching dependencies - uses: actions/cache@v2 - with: - path: | - node_modules - */*/node_modules - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - - - name: Setup caching build - uses: actions/cache@v2 - id: cache-build - with: - path: | - packages/*/lib - packages/*-theme/**/*.js - packages/*-theme/**/*.css - key: ${{ runner.os }}-build-${{ github.sha }} - restore-keys: ${{ runner.os }}-build-${{ github.sha }} + - name: Setup caching dependencies and build output scripts + uses: ./.github/actions/cache - run: lerna run lint --include-dependents --since origin/develop...HEAD diff --git a/.github/workflows/test-browser.yml b/.github/workflows/test-browser.yml index 45c747af10..bc855d35d4 100644 --- a/.github/workflows/test-browser.yml +++ b/.github/workflows/test-browser.yml @@ -27,24 +27,7 @@ jobs: with: node-version: 15.x - - name: Setup caching dependencies - uses: actions/cache@v2 - with: - path: | - node_modules - */*/node_modules - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - - - name: Setup caching build - uses: actions/cache@v2 - id: cache-build - with: - path: | - packages/*/lib - packages/*-theme/**/*.js - packages/*-theme/**/*.css - key: ${{ runner.os }}-build-${{ github.sha }} - restore-keys: ${{ runner.os }}-build-${{ github.sha }} + - name: Setup caching dependencies and build output scripts + uses: ./.github/actions/cache - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers ${{inputs.browser}} --includeCoverage ${{inputs.coverage}} From 8c878f2886d534445c288793a207277571de41fe Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Wed, 22 Dec 2021 16:09:31 +0700 Subject: [PATCH 15/28] chore: ci run lint and test concurrently --- .github/actions/cache.yml | 35 ----------------------------------- .github/workflows/test.yml | 4 ++-- 2 files changed, 2 insertions(+), 37 deletions(-) delete mode 100644 .github/actions/cache.yml diff --git a/.github/actions/cache.yml b/.github/actions/cache.yml deleted file mode 100644 index e34391c663..0000000000 --- a/.github/actions/cache.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: 'Cache NPM and Build' -description: 'Cache NPM dependencies and and build output scripts' -runs: - using: "composite" - steps: - - name: Setup caching dependencies - uses: actions/cache@v2 - id: cache-npm - with: - path: | - node_modules - */*/node_modules - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - - - name: Install Dependencies - if: steps.cache-npm.outputs.cache-hit != 'true' - run: | - npm ci --ignore-scripts --audit=false --fund=false - - - name: Setup caching build - uses: actions/cache@v2 - id: cache-build - with: - path: | - packages/*/lib - packages/*-theme/**/*.js - packages/*-theme/**/*.css - key: ${{ runner.os }}-build-${{ github.sha }} - restore-keys: ${{ runner.os }}-build-${{ github.sha }} - - - name: Build changed packages - if: steps.cache-build.outputs.cache-hit != 'true' - run: | - lerna run build --include-dependencies --since origin/develop...HEAD diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 312f7642cb..32a0d2e163 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,14 +12,14 @@ jobs: uses: Refinitiv/refinitiv-ui/.github/workflows/lint.yml@improve-ci chrome: - needs: lint + needs: build uses: Refinitiv/refinitiv-ui/.github/workflows/test-browser.yml@improve-ci with: browser: chrome coverage: true firefox: - needs: lint + needs: build uses: Refinitiv/refinitiv-ui/.github/workflows/test-browser.yml@improve-ci with: browser: firefox From 779133c53c35f860748f76fdf7ee2e797f4570c9 Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Wed, 22 Dec 2021 16:20:18 +0700 Subject: [PATCH 16/28] chore: ci lint before test --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 32a0d2e163..312f7642cb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,14 +12,14 @@ jobs: uses: Refinitiv/refinitiv-ui/.github/workflows/lint.yml@improve-ci chrome: - needs: build + needs: lint uses: Refinitiv/refinitiv-ui/.github/workflows/test-browser.yml@improve-ci with: browser: chrome coverage: true firefox: - needs: build + needs: lint uses: Refinitiv/refinitiv-ui/.github/workflows/test-browser.yml@improve-ci with: browser: firefox From 81371d3fe244d8a31d11e860d734cff0357bd556 Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Wed, 22 Dec 2021 17:40:00 +0700 Subject: [PATCH 17/28] chore: ci test pull request branch --- .github/workflows/lint.yml | 2 ++ .github/workflows/test.yml | 13 ++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d862964c00..26c4b2f743 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,6 +1,8 @@ name: Lint on: workflow_call: + pull_request: + branches: [test-develop] jobs: lint-code: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 312f7642cb..98f4b35fc4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,26 +1,25 @@ name: Test PR on: - push: - branches: - - improve-ci + pull_request: + branches: [test-develop] jobs: build: - uses: Refinitiv/refinitiv-ui/.github/workflows/build.yml@improve-ci + uses: Refinitiv/refinitiv-ui/.github/workflows/build.yml@test-develop lint: needs: build - uses: Refinitiv/refinitiv-ui/.github/workflows/lint.yml@improve-ci + uses: Refinitiv/refinitiv-ui/.github/workflows/lint.yml@test-develop chrome: needs: lint - uses: Refinitiv/refinitiv-ui/.github/workflows/test-browser.yml@improve-ci + uses: Refinitiv/refinitiv-ui/.github/workflows/test-browser.yml@test-develop with: browser: chrome coverage: true firefox: needs: lint - uses: Refinitiv/refinitiv-ui/.github/workflows/test-browser.yml@improve-ci + uses: Refinitiv/refinitiv-ui/.github/workflows/test-browser.yml@test-develop with: browser: firefox coverage: false From 478d10d2872d05c786735dc2a9ba70ee84041d0f Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Wed, 22 Dec 2021 17:44:29 +0700 Subject: [PATCH 18/28] chore: ci add comment about resued Github workflow --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 98f4b35fc4..13a8ac776c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,6 +2,8 @@ name: Test PR on: pull_request: branches: [test-develop] + +# Need to discuss about reuse Github workflows or include all jobs to single one yml file. jobs: build: uses: Refinitiv/refinitiv-ui/.github/workflows/build.yml@test-develop From 28d1908a5a565ec640b89f5d506facaffa99b8f0 Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Wed, 22 Dec 2021 17:40:00 +0700 Subject: [PATCH 19/28] chore: ci test pull request branch --- .github/workflows/test.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 312f7642cb..98f4b35fc4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,26 +1,25 @@ name: Test PR on: - push: - branches: - - improve-ci + pull_request: + branches: [test-develop] jobs: build: - uses: Refinitiv/refinitiv-ui/.github/workflows/build.yml@improve-ci + uses: Refinitiv/refinitiv-ui/.github/workflows/build.yml@test-develop lint: needs: build - uses: Refinitiv/refinitiv-ui/.github/workflows/lint.yml@improve-ci + uses: Refinitiv/refinitiv-ui/.github/workflows/lint.yml@test-develop chrome: needs: lint - uses: Refinitiv/refinitiv-ui/.github/workflows/test-browser.yml@improve-ci + uses: Refinitiv/refinitiv-ui/.github/workflows/test-browser.yml@test-develop with: browser: chrome coverage: true firefox: needs: lint - uses: Refinitiv/refinitiv-ui/.github/workflows/test-browser.yml@improve-ci + uses: Refinitiv/refinitiv-ui/.github/workflows/test-browser.yml@test-develop with: browser: firefox coverage: false From 836e4090f11f922991a5925364dd8f75551accfc Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Wed, 22 Dec 2021 18:21:18 +0700 Subject: [PATCH 20/28] chore: remove ci event for trigger lint --- .github/workflows/lint.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 26c4b2f743..d862964c00 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,8 +1,6 @@ name: Lint on: workflow_call: - pull_request: - branches: [test-develop] jobs: lint-code: From 45ff910d00a1839b71553daed3905d9472c2535f Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Wed, 22 Dec 2021 18:32:37 +0700 Subject: [PATCH 21/28] chore: update ci workflow comment --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 15108b4039..310d6ae651 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: Test PR on: pull_request: branches: [test-develop] -# Need to discuss about reuse Github workflows or include all jobs to single one yml file. +# Need to be discussed about reuse Github workflows or include all jobs to single one yml file. jobs: build: uses: Refinitiv/refinitiv-ui/.github/workflows/build.yml@test-develop From 056fbe3b890ad60d174cebf509ca3f532cc55f3c Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Wed, 22 Dec 2021 20:12:46 +0700 Subject: [PATCH 22/28] chore: ci use setup actions instead of link to workflows --- .github/actions/{cache => setup}/action.yml | 20 ++++++++-- .github/workflows/build.yml | 33 ---------------- .github/workflows/lint.yml | 24 ------------ .github/workflows/test-browser.yml | 33 ---------------- .github/workflows/test.yml | 42 +++++++++++++++------ 5 files changed, 47 insertions(+), 105 deletions(-) rename .github/actions/{cache => setup}/action.yml (64%) delete mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/test-browser.yml diff --git a/.github/actions/cache/action.yml b/.github/actions/setup/action.yml similarity index 64% rename from .github/actions/cache/action.yml rename to .github/actions/setup/action.yml index 5a79d358ff..8409abd2f9 100644 --- a/.github/actions/cache/action.yml +++ b/.github/actions/setup/action.yml @@ -1,15 +1,27 @@ -name: 'Cache NPM and Build' -description: 'Cache NPM dependencies and and build output scripts' +name: 'Setup Environment and Resources' +description: 'Checkout repository, setup environment and caching' outputs: - dependencies-hit: + cache-dependencies-hit: description: "Use dependencies cache" value: ${{ steps.cache-npm.outputs.cache-hit }} - build-hit: + cache-build-hit: description: "Use build output scripts cache" value: ${{ steps.cache-build.outputs.cache-hit }} runs: using: "composite" steps: + - name: Check out repository code + uses: actions/checkout@v2 + with: + # Number of commits to fetch. 0 indicates all history for all branches and tags. + # Pulls all commits (needed for Lerna) + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 15.x + - name: Setup caching dependencies uses: actions/cache@v2 id: cache-npm diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index dc50c3c4e8..0000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Build Code -on: - workflow_call: - -jobs: - build-code: - runs-on: ubuntu-latest - steps: - - name: Check out repository code - uses: actions/checkout@v2 - with: - # Number of commits to fetch. 0 indicates all history for all branches and tags. - # Pulls all commits (needed for Lerna) - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 15.x - - - name: Setup caching dependencies and build output scripts - uses: ./.github/actions/cache - id: cache - - - name: Install Dependencies - if: steps.cache.outputs.dependencies-hit != 'true' - run: | - npm ci --ignore-scripts --audit=false --fund=false - - - name: Build changed packages - if: steps.cache.outputs.build-hit != 'true' - run: | - lerna run build --include-dependencies --since origin/develop...HEAD diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index d862964c00..0000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Lint -on: - workflow_call: - -jobs: - lint-code: - runs-on: ubuntu-latest - steps: - - name: Check out repository code - uses: actions/checkout@v2 - with: - # Number of commits to fetch. 0 indicates all history for all branches and tags. - # Pulls all commits (needed for Lerna) - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 15.x - - - name: Setup caching dependencies and build output scripts - uses: ./.github/actions/cache - - - run: lerna run lint --include-dependents --since origin/develop...HEAD diff --git a/.github/workflows/test-browser.yml b/.github/workflows/test-browser.yml deleted file mode 100644 index bc855d35d4..0000000000 --- a/.github/workflows/test-browser.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Test Browser -on: - workflow_call: - inputs: - browser: - required: true - type: string - default: chrome - description: input browser name for run test - coverage: - type: boolean - default: false - description: include code coverage testing -jobs: - test-browser: - runs-on: ubuntu-latest - steps: - - name: Check out repository code - uses: actions/checkout@v2 - with: - # Number of commits to fetch. 0 indicates all history for all branches and tags. - # Pulls all commits (needed for Lerna) - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 15.x - - - name: Setup caching dependencies and build output scripts - uses: ./.github/actions/cache - - - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers ${{inputs.browser}} --includeCoverage ${{inputs.coverage}} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 310d6ae651..0dd01fba71 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,26 +1,46 @@ name: Test PR on: pull_request: - branches: [test-develop] + branches: [develop] # Need to be discussed about reuse Github workflows or include all jobs to single one yml file. jobs: build: - uses: Refinitiv/refinitiv-ui/.github/workflows/build.yml@test-develop + runs-on: ubuntu-latest + steps: + - name: Setup resources and environment + uses: ./.github/actions/setup + id: setup + + - name: Install Dependencies + if: steps.setup.outputs.cache-dependencies-hit != 'true' + run: | + npm ci --ignore-scripts --audit=false --fund=false + + - name: Build changed packages + if: steps.setup.outputs.cache-build-hit != 'true' + run: | + lerna run build --include-dependencies --since origin/develop...HEAD lint: needs: build - uses: Refinitiv/refinitiv-ui/.github/workflows/lint.yml@test-develop + runs-on: ubuntu-latest + steps: + - name: Setup resources and environment + uses: ./.github/actions/setup + - run: lerna run lint --include-dependents --since origin/develop...HEAD chrome: needs: lint - uses: Refinitiv/refinitiv-ui/.github/workflows/test-browser.yml@test-develop - with: - browser: chrome - coverage: true + runs-on: ubuntu-latest + steps: + - name: Setup resources and environment + uses: ./.github/actions/setup + - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers chrome --includeCoverage firefox: needs: lint - uses: Refinitiv/refinitiv-ui/.github/workflows/test-browser.yml@test-develop - with: - browser: firefox - coverage: false + runs-on: ubuntu-latest + steps: + - name: Setup resources and environment + uses: ./.github/actions/setup + - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers firefox --includeCoverage false From e90fec5bc5c9a77079deacca50c6fa538fae69aa Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Wed, 22 Dec 2021 20:19:07 +0700 Subject: [PATCH 23/28] chore: update ci github action setup --- .github/actions/setup/action.yml | 11 +++-------- .github/workflows/test.yml | 21 +++++++++++++++++++-- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 8409abd2f9..84625a95da 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -1,5 +1,6 @@ name: 'Setup Environment and Resources' -description: 'Checkout repository, setup environment and caching' +description: 'Setup environment, resources and caching' + outputs: cache-dependencies-hit: description: "Use dependencies cache" @@ -7,16 +8,10 @@ outputs: cache-build-hit: description: "Use build output scripts cache" value: ${{ steps.cache-build.outputs.cache-hit }} + runs: using: "composite" steps: - - name: Check out repository code - uses: actions/checkout@v2 - with: - # Number of commits to fetch. 0 indicates all history for all branches and tags. - # Pulls all commits (needed for Lerna) - fetch-depth: 0 - - name: Setup Node.js uses: actions/setup-node@v2 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0dd01fba71..6e704ccce1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,12 +1,17 @@ -name: Test PR +name: Test on: pull_request: branches: [develop] -# Need to be discussed about reuse Github workflows or include all jobs to single one yml file. jobs: build: runs-on: ubuntu-latest steps: + - name: Check out repository code + uses: actions/checkout@v2 + with: + # Number of commits to fetch. 0 indicates all history for all branches and tags. + # Pulls all commits (needed for Lerna) + fetch-depth: 0 - name: Setup resources and environment uses: ./.github/actions/setup id: setup @@ -25,6 +30,10 @@ jobs: needs: build runs-on: ubuntu-latest steps: + - name: Check out repository code + uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Setup resources and environment uses: ./.github/actions/setup - run: lerna run lint --include-dependents --since origin/develop...HEAD @@ -33,6 +42,10 @@ jobs: needs: lint runs-on: ubuntu-latest steps: + - name: Check out repository code + uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Setup resources and environment uses: ./.github/actions/setup - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers chrome --includeCoverage @@ -41,6 +54,10 @@ jobs: needs: lint runs-on: ubuntu-latest steps: + - name: Check out repository code + uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Setup resources and environment uses: ./.github/actions/setup - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers firefox --includeCoverage false From b346d0eb9c4c88d8fe31e9d8320ea6a5596959e6 Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Wed, 22 Dec 2021 22:42:52 +0700 Subject: [PATCH 24/28] chore: ci update step name --- .github/workflows/test.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6e704ccce1..49b64152de 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,19 +12,18 @@ jobs: # Number of commits to fetch. 0 indicates all history for all branches and tags. # Pulls all commits (needed for Lerna) fetch-depth: 0 + - name: Setup resources and environment uses: ./.github/actions/setup id: setup - name: Install Dependencies if: steps.setup.outputs.cache-dependencies-hit != 'true' - run: | - npm ci --ignore-scripts --audit=false --fund=false + run: npm ci --ignore-scripts --audit=false --fund=false - - name: Build changed packages + - name: Build if: steps.setup.outputs.cache-build-hit != 'true' - run: | - lerna run build --include-dependencies --since origin/develop...HEAD + run: lerna run build --include-dependencies --since origin/develop...HEAD lint: needs: build @@ -34,8 +33,11 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Setup resources and environment uses: ./.github/actions/setup + + - name: Lint - run: lerna run lint --include-dependents --since origin/develop...HEAD chrome: @@ -46,8 +48,11 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Setup resources and environment uses: ./.github/actions/setup + + - name: Test - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers chrome --includeCoverage firefox: @@ -58,6 +63,9 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Setup resources and environment uses: ./.github/actions/setup + + - name: Test - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers firefox --includeCoverage false From d4702c40e4403cd648f63516153cff37eaafe068 Mon Sep 17 00:00:00 2001 From: Sakchai Homhual Date: Wed, 22 Dec 2021 23:06:16 +0700 Subject: [PATCH 25/28] chore: ci update incorrect run command --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 49b64152de..668e4c6861 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,7 +38,7 @@ jobs: uses: ./.github/actions/setup - name: Lint - - run: lerna run lint --include-dependents --since origin/develop...HEAD + run: lerna run lint --include-dependents --since origin/develop...HEAD chrome: needs: lint @@ -53,7 +53,7 @@ jobs: uses: ./.github/actions/setup - name: Test - - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers chrome --includeCoverage + run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers chrome --includeCoverage firefox: needs: lint @@ -68,4 +68,4 @@ jobs: uses: ./.github/actions/setup - name: Test - - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers firefox --includeCoverage false + run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers firefox --includeCoverage false From 4c50a3a4cc67f307af5e5c8b687603af297877c6 Mon Sep 17 00:00:00 2001 From: wsuwt Date: Fri, 24 Dec 2021 15:36:21 +0700 Subject: [PATCH 26/28] ci: tests should include coverage by default --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 668e4c6861..ede9e8723a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,7 +53,7 @@ jobs: uses: ./.github/actions/setup - name: Test - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers chrome --includeCoverage + run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers chrome firefox: needs: lint @@ -68,4 +68,4 @@ jobs: uses: ./.github/actions/setup - name: Test - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers firefox --includeCoverage false + run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers firefox From cb8f869be7db777975ffd72e329eed8b81e4e9b7 Mon Sep 17 00:00:00 2001 From: wsuwt Date: Fri, 24 Dec 2021 15:39:38 +0700 Subject: [PATCH 27/28] ci: bring back force build before test command --- packages/core/package.json | 2 +- packages/demo-block/package.json | 2 +- packages/elements/scripts/cmd/test.js | 2 +- packages/i18n/package.json | 2 +- packages/phrasebook/package.json | 2 +- packages/test-helpers/package.json | 2 +- packages/translate/package.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 1ad94dc6cc..f2fa946644 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -46,7 +46,7 @@ "build:prod": "tsc", "lint": "eslint .", "lint:fix": "eslint . --fix", - "test": "karma start ../../karma.config.js --package=core", + "test": "npm run build && karma start ../../karma.config.js --package=core", "test:snapshots": "npm run test -- --snapshots", "test:watch": "npm run build && npm run test -- --watch", "prepublishOnly": "node scripts/release" diff --git a/packages/demo-block/package.json b/packages/demo-block/package.json index 6bbced9334..9e4be075fa 100644 --- a/packages/demo-block/package.json +++ b/packages/demo-block/package.json @@ -12,7 +12,7 @@ "lint": "eslint .", "lint:fix": "eslint . --fix", "start": "npm run build && concurrently \"npm run build:watch\" \"web-dev-server --config ../../server.config.js --app-index __demo__\"", - "test": "karma start ../../karma.config.js --package=demo-block", + "test": "npm run build && karma start ../../karma.config.js --package=demo-block", "test:snapshots": "npm run test -- --snapshots", "test:watch": "npm run test -- --watch", "prepublishOnly": "node scripts/release" diff --git a/packages/elements/scripts/cmd/test.js b/packages/elements/scripts/cmd/test.js index b74a263cd0..105e6c051d 100644 --- a/packages/elements/scripts/cmd/test.js +++ b/packages/elements/scripts/cmd/test.js @@ -53,7 +53,7 @@ exports.handler = (argv) => { } try { - // execSync('node cli build --sourceMap --declarationMap'); + execSync('node cli build --sourceMap --declarationMap'); const command = ['karma', 'start', 'karma.config.js', `--package=${PACKAGE_NAME}`]; watch && command.push('--watch'); diff --git a/packages/i18n/package.json b/packages/i18n/package.json index cef8aaf823..83cd268be1 100644 --- a/packages/i18n/package.json +++ b/packages/i18n/package.json @@ -16,7 +16,7 @@ "build:prod": "tsc", "lint": "eslint .", "lint:fix": "eslint . --fix", - "test": "karma start ../../karma.config.js --package=i18n --include-snapshots=false", + "test": "npm run build && karma start ../../karma.config.js --package=i18n --include-snapshots=false", "test:watch": "npm run test -- --watch" }, "author": "Refinitiv", diff --git a/packages/phrasebook/package.json b/packages/phrasebook/package.json index bd67d17a47..05cb4f0113 100644 --- a/packages/phrasebook/package.json +++ b/packages/phrasebook/package.json @@ -121,7 +121,7 @@ "build:prod": "tsc", "lint": "eslint .", "lint:fix": "eslint . --fix", - "test": "mocha __test__/**/*.js --require esm" + "test": "npm run build && mocha __test__/**/*.js --require esm" }, "devDependencies": { "chai": "^4.3.4", diff --git a/packages/test-helpers/package.json b/packages/test-helpers/package.json index cb328d361c..f201fe9feb 100644 --- a/packages/test-helpers/package.json +++ b/packages/test-helpers/package.json @@ -18,7 +18,7 @@ "build:prod": "tsc", "lint": "eslint .", "lint:fix": "eslint . --fix", - "test": "karma start ../../karma.config.js --package=test-helpers --include-snapshots=false", + "test": "npm run build && karma start ../../karma.config.js --package=test-helpers --include-snapshots=false", "test:watch": "npm run test -- --watch" }, "publishConfig": { diff --git a/packages/translate/package.json b/packages/translate/package.json index c2b6cb0aa6..20d1e3c8ca 100644 --- a/packages/translate/package.json +++ b/packages/translate/package.json @@ -19,7 +19,7 @@ "lint": "eslint .", "lint:fix": "eslint . --fix", "start": "npm run build && concurrently \"npm run build:watch\" \"web-dev-server --config ../../server.config.js --app-index __demo__\"", - "test": "karma start ../../karma.config.js --package=translate", + "test": "npm run build && karma start ../../karma.config.js --package=translate", "test:snapshots": "npm run test -- --snapshots", "test:watch": "npm run test -- --watch" }, From 2fff6b9a01d32b0b28ec37e6ba7f66b15033a1a5 Mon Sep 17 00:00:00 2001 From: wsuwt Date: Fri, 24 Dec 2021 16:41:32 +0700 Subject: [PATCH 28/28] ci: add comment regarding Firefox test coverage --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ede9e8723a..0222ecaec5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -68,4 +68,5 @@ jobs: uses: ./.github/actions/setup - name: Test - run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers firefox + # TODO: `@refinitiv/core` has test coverage below threshold on Firefox + run: lerna run test --include-dependents --since origin/develop...HEAD -- -- --browsers firefox --includeCoverage false