From 7b2a91d939791fadec8cd6fcff193860565f2b28 Mon Sep 17 00:00:00 2001 From: vasco Date: Tue, 4 Apr 2023 14:59:03 +0100 Subject: [PATCH 1/9] CI test commit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2e219dd8..65d8bf70 100644 --- a/README.md +++ b/README.md @@ -157,4 +157,4 @@ An instance object used to access the results of the speedtest measurements. The [build-size-img]: https://img.shields.io/bundlephobia/minzip/@cloudflare/speedtest [build-size-url]: https://bundlephobia.com/result?p=@cloudflare/speedtest [npm-downloads-img]: https://img.shields.io/npm/dt/@cloudflare/speedtest -[npm-downloads-url]: https://www.npmtrends.com/@cloudflare/speedtest \ No newline at end of file +[npm-downloads-url]: https://www.npmtrends.com/@cloudflare/speedtest From 584cc1f7ee9420955d9d789cbed441a3e3598d8f Mon Sep 17 00:00:00 2001 From: vasco Date: Tue, 4 Apr 2023 15:12:27 +0100 Subject: [PATCH 2/9] Update build action --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5d555ded..222103a7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,5 +22,6 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' + - run: npm install - run: npm run build - run: npm run lint From 39612288e62b7cde40ba06050b195954c0ebe465 Mon Sep 17 00:00:00 2001 From: vasco Date: Tue, 4 Apr 2023 15:22:25 +0100 Subject: [PATCH 3/9] Use yarn to build --- .github/workflows/build.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 222103a7..61aa306d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,6 +22,18 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' - - run: npm install - - run: npm run build - - run: npm run lint + + - name: yarn install + uses: borales/actions-yarn@v4 + with: + cmd: install + + - name: yarn build + uses: borales/actions-yarn@v4 + with: + cmd: build + + - name: yarn lint + uses: borales/actions-yarn@v4 + with: + cmd: lint From db2254b24513809bf583960b564f554cc53063c0 Mon Sep 17 00:00:00 2001 From: vasco Date: Tue, 4 Apr 2023 15:29:00 +0100 Subject: [PATCH 4/9] Skip node 14 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 61aa306d..0acbd573 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - node-version: [14.x, 16.x, 18.x] + node-version: [16.x, 18.x] steps: - uses: actions/checkout@v3 From be1fea2863c17304929b3ad865d1639d446a9e89 Mon Sep 17 00:00:00 2001 From: vasco Date: Tue, 4 Apr 2023 15:32:05 +0100 Subject: [PATCH 5/9] Test lint check --- src/utils/numbers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/numbers.js b/src/utils/numbers.js index a344c0f8..e8016d0d 100644 --- a/src/utils/numbers.js +++ b/src/utils/numbers.js @@ -9,7 +9,7 @@ export const percentile = (vals, perc = 0.5) => { const idx = (vals.length - 1) * perc; const rem = idx % 1; - if (rem === 0) return sortedVals[Math.round(idx)]; + if (rem == 0) return sortedVals[Math.round(idx)]; // calculate weighted average const edges = [Math.floor, Math.ceil].map(rndFn => sortedVals[rndFn(idx)]); From 10d70eb9e4e712754476f6724ddeadad43d2c25d Mon Sep 17 00:00:00 2001 From: vasco Date: Tue, 4 Apr 2023 15:34:07 +0100 Subject: [PATCH 6/9] Fix lint check --- src/utils/numbers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/numbers.js b/src/utils/numbers.js index e8016d0d..a344c0f8 100644 --- a/src/utils/numbers.js +++ b/src/utils/numbers.js @@ -9,7 +9,7 @@ export const percentile = (vals, perc = 0.5) => { const idx = (vals.length - 1) * perc; const rem = idx % 1; - if (rem == 0) return sortedVals[Math.round(idx)]; + if (rem === 0) return sortedVals[Math.round(idx)]; // calculate weighted average const edges = [Math.floor, Math.ceil].map(rndFn => sortedVals[rndFn(idx)]); From cd27246870f09e949ca05540a3f8810dd49ea816 Mon Sep 17 00:00:00 2001 From: vasco Date: Tue, 4 Apr 2023 15:46:56 +0100 Subject: [PATCH 7/9] Use yarn to build publish --- .github/workflows/pr-npm-publish.yml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-npm-publish.yml b/.github/workflows/pr-npm-publish.yml index 51bd9e21..5e2f9edd 100644 --- a/.github/workflows/pr-npm-publish.yml +++ b/.github/workflows/pr-npm-publish.yml @@ -14,9 +14,19 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 16 - - run: npm build - - run: npm lint + node-version: 18 + - name: yarn install + uses: borales/actions-yarn@v4 + with: + cmd: install + - name: yarn build + uses: borales/actions-yarn@v4 + with: + cmd: build + - name: yarn lint + uses: borales/actions-yarn@v4 + with: + cmd: lint bump-version: needs: build @@ -26,7 +36,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 - name: Apply version bump (major) if: contains(github.event.pull_request.labels.*.name, 'major') run: npm version major @@ -49,7 +59,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 registry-url: https://registry.npmjs.org/ - run: npm publish env: From 6252a4272cabbcdc4c245bf177c1561030fd85e5 Mon Sep 17 00:00:00 2001 From: vasco Date: Tue, 4 Apr 2023 15:56:57 +0100 Subject: [PATCH 8/9] Revert readme update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 65d8bf70..2e219dd8 100644 --- a/README.md +++ b/README.md @@ -157,4 +157,4 @@ An instance object used to access the results of the speedtest measurements. The [build-size-img]: https://img.shields.io/bundlephobia/minzip/@cloudflare/speedtest [build-size-url]: https://bundlephobia.com/result?p=@cloudflare/speedtest [npm-downloads-img]: https://img.shields.io/npm/dt/@cloudflare/speedtest -[npm-downloads-url]: https://www.npmtrends.com/@cloudflare/speedtest +[npm-downloads-url]: https://www.npmtrends.com/@cloudflare/speedtest \ No newline at end of file From b22cbd10837e503a2a5252ce92533b7dd87e6d6b Mon Sep 17 00:00:00 2001 From: vasco Date: Tue, 4 Apr 2023 16:05:34 +0100 Subject: [PATCH 9/9] Bypass publish build if not PR merge --- .github/workflows/pr-npm-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-npm-publish.yml b/.github/workflows/pr-npm-publish.yml index 5e2f9edd..bd955769 100644 --- a/.github/workflows/pr-npm-publish.yml +++ b/.github/workflows/pr-npm-publish.yml @@ -9,6 +9,7 @@ on: jobs: build: + if: github.event.pull_request.merged == true runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -30,7 +31,6 @@ jobs: bump-version: needs: build - if: github.event.pull_request.merged == true runs-on: ubuntu-latest steps: - uses: actions/checkout@v3