From c3eb599c6821b05b6c716f2c6c1b2bceb2a8af33 Mon Sep 17 00:00:00 2001 From: SorsOps <80043879+sorsOps@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:54:00 +0200 Subject: [PATCH 1/4] Add pruning support in the pipeline for CI to aid with speed --- .github/workflows/pr-ci.yml | 75 +++++++++++++++++++++++++++++++++++++ scripts/diff.js | 24 ++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 scripts/diff.js diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index 5c08607c5..00da8d546 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -16,9 +16,81 @@ concurrency: cancel-in-progress: true jobs: + + + changes: + runs-on: ubuntu-latest + env: + TURBO_RUN_FILTER: ${{ github.event_name == 'pull_request' && '...[origin/master]' || '...[HEAD^]' }} + # Required permissions + permissions: + pull-requests: read + # Set job outputs to values from filter step + outputs: + flat: ${{ steps.flat.outputs.result }} + steps: + - name: Check out code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + lfs: true + - name: Setup Node.js environment + uses: actions/setup-node@v4 + with: + cache: 'npm' + node-version: 20 + - name: Install turbo@1.13.3 & glob + run: | + npm i -g turbo@1.13.3 glob + echo "PATH=$(npm config get config):$PATH" >> $GITHUB_ENV + + - name: Verify turbo installation + shell: bash + run: | + source $GITHUB_ENV + turbo --version + - name: Debug TURBO_RUN_FILTER + run: echo "TURBO_RUN_FILTER is $TURBO_RUN_FILTER" + - name: Validate JSON Output + run: | + content=$(turbo build --filter=$TURBO_RUN_FILTER --dry-run=json) + echo $content | jq . + - name: Debug turbo command + run: | + set -x + turbo build --filter=$TURBO_RUN_FILTER --dry-run=json + set +x + - name: Verify turbo installation + run: which turbo + + - name: Debug content + run: | + content=`turbo build --filter=$TURBO_RUN_FILTER --dry-run=json` + echo "Content is: $content" + - name: Changeset + id: changeset + run: | + content=`turbo build --filter=$TURBO_RUN_FILTER --dry-run=json` + content="${content//'%'/'%25'}" + content="${content//$'\n'/'%0A'}" + content="${content//$'\r'/'%0D'}" + echo "::set-output name=result::$content" + - name: Flat output + id: flat + run: | + filteredPkgs=`turbo build --filter=$TURBO_RUN_FILTER --dry-run=json | node ./scripts/diff.js` + echo "::set-output name=result::$filteredPkgs" + echo "$filteredPkgs" + + verify: name: Verify changes + needs: changes runs-on: ubuntu-latest + defaults: + run: + shell: bash + working-directory: ./out steps: - name: Check out code uses: actions/checkout@v3 @@ -33,6 +105,9 @@ jobs: - name: Install turbo run: yarn global add turbo@1.9.8 + - name: prune + run: turbo prune ${{ needs.changes.outputs.flat }} + working-directory: ./ - name: Turbo Cache id: turbo-cache diff --git a/scripts/diff.js b/scripts/diff.js new file mode 100644 index 000000000..2c008bca1 --- /dev/null +++ b/scripts/diff.js @@ -0,0 +1,24 @@ +const stdin = process.openStdin(); + +let data = ''; + +stdin.on('data', function (chunk) { + data += chunk; +}); + +stdin.on('end', function () { + const input = JSON.parse(data); + const flatpack = input.tasks.reduce((acc, task) => { + if (task.command == '\u003cNONEXISTENT\u003e') { + return acc; + } + + if (task.cache.status == 'MISS') { + acc.push(task.package); + } + return acc; + }, []); + + const uniq = [...new Set(flatpack)]; + console.log(uniq.join(' ')); +}); From 7de628ee25090c68b8059583ab6a0d132e71c58e Mon Sep 17 00:00:00 2001 From: SorsOps <80043879+sorsOps@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:57:43 +0200 Subject: [PATCH 2/4] Add gitkeep for out --- out/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 out/.gitkeep diff --git a/out/.gitkeep b/out/.gitkeep new file mode 100644 index 000000000..e69de29bb From 9d7734dffa0b8ed2101a1ccd4b90d09ba8fba015 Mon Sep 17 00:00:00 2001 From: SorsOps <80043879+sorsOps@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:02:23 +0200 Subject: [PATCH 3/4] Fix schema being incorrect for a token set --- .changeset/wicked-planes-talk.md | 5 +++++ .github/workflows/pr-ci.yml | 1 + packages/nodes-design-tokens/src/schemas/index.ts | 6 +----- 3 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 .changeset/wicked-planes-talk.md diff --git a/.changeset/wicked-planes-talk.md b/.changeset/wicked-planes-talk.md new file mode 100644 index 000000000..4f04a76e8 --- /dev/null +++ b/.changeset/wicked-planes-talk.md @@ -0,0 +1,5 @@ +--- +"@tokens-studio/graph-engine-nodes-design-tokens": patch +--- + +Fixes the incorrectly typed Tokenset Schema diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index 00da8d546..79c9f38a4 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -87,6 +87,7 @@ jobs: name: Verify changes needs: changes runs-on: ubuntu-latest + if: ${{ needs.changes.outputs.flat != '[]' }} defaults: run: shell: bash diff --git a/packages/nodes-design-tokens/src/schemas/index.ts b/packages/nodes-design-tokens/src/schemas/index.ts index ab0843448..c1f788f5a 100644 --- a/packages/nodes-design-tokens/src/schemas/index.ts +++ b/packages/nodes-design-tokens/src/schemas/index.ts @@ -89,11 +89,7 @@ export const TOKEN_SET = 'https://schemas.tokens.studio/tokenSet.json'; export const TokenSetSchema: SchemaObject = { $id: TOKEN_SET, title: 'Token Set', - type: 'object', - properties: { - name: StringSchema, - token: StringSchema - } + type: 'object' }; export const LEONARDO_COLOR = From 3565f8949c9bbfe3cf59b61488b61752bcb12361 Mon Sep 17 00:00:00 2001 From: SorsOps <80043879+sorsOps@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:15:23 +0200 Subject: [PATCH 4/4] Upgrade turbo --- .github/workflows/pr-ci.yml | 6 ++++-- package.json | 2 +- yarn.lock | 40 ++++++++++++++++++++++++++++++++----- 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml index 79c9f38a4..7eb7921eb 100644 --- a/.github/workflows/pr-ci.yml +++ b/.github/workflows/pr-ci.yml @@ -1,6 +1,8 @@ name: CI -on: pull_request +on: + pull_request: + types: [opened, synchronize] env: HUSKY: 0 @@ -105,7 +107,7 @@ jobs: cache: "yarn" - name: Install turbo - run: yarn global add turbo@1.9.8 + run: yarn global add turbo@1.13.3 - name: prune run: turbo prune ${{ needs.changes.outputs.flat }} working-directory: ./ diff --git a/package.json b/package.json index b59d06b20..26023cc77 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "husky": "^8.0.3", "lint-staged": "^13.2.1", "listr2": "5.0.8", - "turbo": "^1.9.8" + "turbo": "^1.13.3" }, "packageManager": "yarn@1.22.19" } diff --git a/yarn.lock b/yarn.lock index 294c002f7..af6ab7ced 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18296,7 +18296,7 @@ prelude-ls@^1.2.1: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== -"prettier-fallback@npm:prettier@^3", prettier@^3.1.1, prettier@^3.3.2: +"prettier-fallback@npm:prettier@^3": version "3.3.2" resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.2.tgz#03ff86dc7c835f2d2559ee76876a3914cec4a90a" integrity sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA== @@ -18313,6 +18313,11 @@ prettier@^2.7.1: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== +prettier@^3.1.1, prettier@^3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.2.tgz#03ff86dc7c835f2d2559ee76876a3914cec4a90a" + integrity sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA== + pretty-bytes@^5.3.0, pretty-bytes@^5.6.0: version "5.6.0" resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb" @@ -20962,7 +20967,7 @@ string-to-arraybuffer@^1.0.0: atob-lite "^2.0.0" is-base64 "^0.1.0" -"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -20980,6 +20985,15 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string-width@^5.0.0, string-width@^5.0.1, string-width@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" @@ -21085,7 +21099,7 @@ stringify-object@^3.3.0: is-obj "^1.0.1" is-regexp "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -21099,6 +21113,13 @@ strip-ansi@^3.0.0, strip-ansi@^3.0.1: dependencies: ansi-regex "^2.0.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1, strip-ansi@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -21877,7 +21898,7 @@ turbo-windows-arm64@1.13.4: resolved "https://registry.yarnpkg.com/turbo-windows-arm64/-/turbo-windows-arm64-1.13.4.tgz#0adfddb0d6c167a46ecff646666e347a7d372d76" integrity sha512-u5A+VOKHswJJmJ8o8rcilBfU5U3Y1TTAfP9wX8bFh8teYF1ghP0EhtMRLjhtp6RPa+XCxHHVA2CiC3gbh5eg5g== -turbo@^1.9.8: +turbo@^1.13.3: version "1.13.4" resolved "https://registry.yarnpkg.com/turbo/-/turbo-1.13.4.tgz#06767fff53f0aae43f78e12e5ac7d5e7652d40d0" integrity sha512-1q7+9UJABuBAHrcC4Sxp5lOqYS5mvxRrwa33wpIyM18hlOCpRD/fTJNxZ0vhbMcJmz15o9kkVm743mPn7p6jpQ== @@ -22958,7 +22979,7 @@ workerpool@^6.5.1: resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.5.1.tgz#060f73b39d0caf97c6db64da004cd01b4c099544" integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -22976,6 +22997,15 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.0.1, wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"