From 6241ae65ee0cf4305d6933cc1726c4a6be2d20c1 Mon Sep 17 00:00:00 2001 From: TaraT Date: Thu, 13 Mar 2025 01:23:28 +0530 Subject: [PATCH 1/3] fix(search): update disabled state in spectrum two (#3593) Co-authored-by: rise-erpelding <54716846+rise-erpelding@users.noreply.github.com> Co-authored-by: [ Cassondra ] --- .changeset/four-phones-agree.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/four-phones-agree.md diff --git a/.changeset/four-phones-agree.md b/.changeset/four-phones-agree.md new file mode 100644 index 00000000000..905672c4a21 --- /dev/null +++ b/.changeset/four-phones-agree.md @@ -0,0 +1,7 @@ +--- +"@spectrum-css/search": patch +--- + +Updated `--spectrum-search-background-color-disabled` to `--spectrum-gray-25` and `--spectrum-search-border-color-disabled` to `--spectrum-gray-300` for the S2 foundations contexts. + +Also defines disabled quiet border and background colors (`--system-search-quiet-background-color-disabled` and `--system-search-quiet-border-color-disabled`) in order to maintain disabled quiet styling. From 67e01c4e52c767037f9d06e3426ed1d9a4a009d3 Mon Sep 17 00:00:00 2001 From: castastrophe Date: Wed, 12 Mar 2025 10:38:33 -0400 Subject: [PATCH 2/3] chore: compare compiled output fixes --- .github/actions/file-diff/index.js | 18 +- .github/workflows/compare-results.yml | 444 +++++++++++++------------- .github/workflows/development.yml | 400 ++++++++++++----------- .github/workflows/publish-site.yml | 149 +++++---- netlify.toml | 22 -- tasks/templates/compare-listing.njk | 2 +- tasks/templates/diff-preview.njk | 2 +- 7 files changed, 504 insertions(+), 533 deletions(-) delete mode 100644 netlify.toml diff --git a/.github/actions/file-diff/index.js b/.github/actions/file-diff/index.js index 1bb35b58e37..06e113d9a27 100644 --- a/.github/actions/file-diff/index.js +++ b/.github/actions/file-diff/index.js @@ -331,22 +331,16 @@ async function run() { 0 ); core.setOutput("total-size", headMainSize); - - if (hasBase) { - const baseMainSize = [...baseOutput.entries()].reduce( - (acc, [, size]) => acc + size, - 0 - ); - - core.setOutput( - "has-changed", - hasBase && headMainSize !== baseMainSize ? "true" : "false" - ); - } } else { core.setOutput("total-size", 0); } + + core.setOutput( + "has-changed", + sections.length === 0 ? "true" : "false" + ); + } catch (error) { core.error(error.stack); core.setFailed(error.message); diff --git a/.github/workflows/compare-results.yml b/.github/workflows/compare-results.yml index 70d02e11226..14de781c7c0 100644 --- a/.github/workflows/compare-results.yml +++ b/.github/workflows/compare-results.yml @@ -8,229 +8,235 @@ name: Compare on: - workflow_call: - inputs: - base-sha: - description: The branch or tag to compare against - required: false - type: string - default: main - head-sha: - description: The branch or tag to checkout - required: false - type: string - default: ${{ github.event.workflow_call.head.ref }} - outputs: - has-changed: - value: ${{ jobs.compare.outputs.has-changed }} - total-size: - value: ${{ jobs.compare.outputs.total-size }} + workflow_call: + inputs: + deploy-message: + required: false + type: string + alias: + required: false + type: string + base-sha: + description: The branch or tag to compare against + required: false + type: string + default: main + head-sha: + description: The branch or tag to checkout + required: false + type: string + default: ${{ github.event.workflow_call.head.ref }} + outputs: + has-changed: + value: ${{ jobs.compare.outputs.has-changed }} + total-size: + value: ${{ jobs.compare.outputs.total-size }} permissions: - contents: read - pull-requests: write + contents: read + pull-requests: write defaults: - run: - shell: bash + run: + shell: bash jobs: - compare: - name: Compare compiled assets - runs-on: ubuntu-latest - timeout-minutes: 10 - needs: [fetch-build-artifacts] - outputs: - has-changed: ${{ steps.compare.outputs.has-changed }} - total-size: ${{ steps.compare.outputs.total-size }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - ## --- SETUP --- ## - - name: Use Node LTS version - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: yarn - cache-dependency-path: yarn.lock - - - name: Enable Corepack - run: corepack enable - - ## --- YARN CACHE --- ## - - name: Check for cached dependencies - continue-on-error: true - id: cache-dependencies - uses: actions/cache@v4 - with: - path: | - .cache/yarn - node_modules - key: ubuntu-latest-node20-${{ hashFiles('yarn.lock') }} - - ## --- INSTALL --- ## - # note: if cache-hit isn't needed b/c yarn will leverage the cache if it exists - - name: Install dependencies - shell: bash - run: yarn install --immutable - - - name: Set the cache key for builds - id: derive-key - shell: bash - run: | - BRANCH=${{ inputs.head-sha }} - echo "head-path=${BRANCH//\//_}" >> "$GITHUB_OUTPUT" - BRANCH=${{ inputs.base-sha }} - echo "base-path=${BRANCH//\//_}" >> "$GITHUB_OUTPUT" - - - name: Download build artifacts for head - uses: actions/download-artifact@v4 - with: - name: ubuntu-latest-node20-compiled-assets-${{ steps.derive-key.outputs.head-path }} - path: ${{ github.workspace }}/${{ steps.derive-key.outputs.head-path }} - merge-multiple: true - - - name: Download build artifacts for base - uses: actions/download-artifact@v4 - with: - name: ubuntu-latest-node20-compiled-assets-${{ steps.derive-key.outputs.base-path }} - path: ${{ github.workspace }}/${{ steps.derive-key.outputs.base-path }} - merge-multiple: true - - - name: Compare compiled output file size - id: compare - uses: ./.github/actions/file-diff - # uses: spectrum-tools/gh-action-file-diff@v1 - with: - head-path: ${{ github.workspace }}/${{ steps.derive-key.outputs.head-path }}/ - base-path: ${{ github.workspace }}/${{ steps.derive-key.outputs.base-path }}/ - file-glob-pattern: | - components/*/dist/** - tokens/dist/** - ui-icons/dist/** - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Generate rich diff if changes detected - id: rich-diff - if: ${{ steps.compare.outputs.has-changed }} - shell: bash - run: yarn compare - - - name: Upload changes - if: ${{ steps.compare.outputs.has-changed }} - uses: actions/upload-artifact@v4 - with: - name: rich-diff - path: | - .diff-output/index.html - .diff-output/diffs/*/*.html - components/typography/dist/index.css - components/table/dist/index.css - components/badge/dist/index.css - components/button/dist/index.css - components/card/dist/index.css - components/icon/dist/index.css - components/sidenav/dist/index.css - tokens/dist/css/index.css - node_modules/diff2html/bundles/css/diff2html.min.css - node_modules/diff2html/bundles/js/diff2html.min.js - - fetch-build-artifacts: - name: Fetch & validate build artifacts - strategy: - matrix: - branch: - - ${{ inputs.head-sha }} - - ${{ inputs.base-sha }} - runs-on: ubuntu-latest + compare: + name: Compare compiled assets + runs-on: ubuntu-latest + timeout-minutes: 10 + needs: [fetch-build-artifacts] + outputs: + has-changed: ${{ steps.compare.outputs.has-changed }} + total-size: ${{ steps.compare.outputs.total-size }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + ## --- SETUP --- ## + - name: Use Node LTS version + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: yarn + cache-dependency-path: yarn.lock + + - name: Enable Corepack + run: corepack enable + + ## --- YARN CACHE --- ## + - name: Check for cached dependencies + continue-on-error: true + id: cache-dependencies + uses: actions/cache@v4 + with: + path: | + .cache/yarn + node_modules + key: ubuntu-latest-node20-${{ hashFiles('yarn.lock') }} + + ## --- INSTALL --- ## + # note: if cache-hit isn't needed b/c yarn will leverage the cache if it exists + - name: Install dependencies + shell: bash + run: yarn install --immutable + + - name: Set the cache key for builds + id: derive-key + shell: bash + run: | + BRANCH=${{ inputs.head-sha }} + echo "head-path=${BRANCH//\//_}" >> "$GITHUB_OUTPUT" + BRANCH=${{ inputs.base-sha }} + echo "base-path=${BRANCH//\//_}" >> "$GITHUB_OUTPUT" + + - name: Download build artifacts for head + uses: actions/download-artifact@v4 + with: + name: ubuntu-latest-node20-compiled-assets-${{ steps.derive-key.outputs.head-path }} + path: ${{ github.workspace }}/${{ steps.derive-key.outputs.head-path }} + merge-multiple: true + + - name: Download build artifacts for base + uses: actions/download-artifact@v4 + with: + name: ubuntu-latest-node20-compiled-assets-${{ steps.derive-key.outputs.base-path }} + path: ${{ github.workspace }}/${{ steps.derive-key.outputs.base-path }} + merge-multiple: true + + - name: Compare compiled output file size + id: compare + uses: ./.github/actions/file-diff + # uses: spectrum-tools/gh-action-file-diff@v1 + with: + head-path: ${{ github.workspace }}/${{ steps.derive-key.outputs.head-path }}/ + base-path: ${{ github.workspace }}/${{ steps.derive-key.outputs.base-path }}/ + file-glob-pattern: | + components/*/dist/** + tokens/dist/** + ui-icons/dist/** + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Generate rich diff for compiled assets + if: ${{ steps.compare.outputs.has-changed }} + id: rich-diff + shell: bash + run: yarn compare + + ## --- DEPLOY DIFFS TO NETLIFY --- ## + - name: Deploy rich diff to Netlify + uses: nwtgck/actions-netlify@v3 + if: ${{ steps.compare.outputs.has-changed }} + with: + publish-dir: .diff-output + production-branch: main + production-deploy: false + github-token: ${{ secrets.GITHUB_TOKEN }} + deploy-message: ${{ inputs.deploy-message }} + enable-pull-request-comment: true + enable-commit-comment: false + overwrites-pull-request-comment: true + alias: ${{ inputs.alias }} + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN_GH_ACTIONS_DEPLOY }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_DIFF }} timeout-minutes: 10 - outputs: - artifact-id: ${{ steps.upload.outputs.artifact-id }} - steps: - - name: Set the cache key for builds - id: derive-key - shell: bash - run: | - BRANCH=${{ matrix.branch }} - BRANCH=${BRANCH//\//_} - echo "key=ubuntu-latest-node20-compiled-assets-${BRANCH}" >> "$GITHUB_OUTPUT" - - - name: Check if build artifacts already exist - uses: actions/download-artifact@v4 - id: artifact-found - continue-on-error: true - with: - name: ${{ steps.derive-key.outputs.key }} - - - name: Exit if artifact already exists - if: ${{ success() }} - shell: bash - run: exit 0 - - - name: Check out code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: ${{ matrix.branch }} - - ## --- SETUP --- ## - - name: Use Node LTS version - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: yarn - - - name: Enable Corepack - run: corepack enable - - ## --- YARN CACHE --- ## - - name: Check for cached dependencies - continue-on-error: true - id: cache-dependencies - uses: actions/cache@v4 - with: - path: | - .cache/yarn - node_modules - key: ubuntu-latest-node20-${{ hashFiles('yarn.lock') }} - - ## --- INSTALL --- ## - # note: if cache-hit isn't needed b/c yarn will leverage the cache if it exists - - name: Install dependencies - shell: bash - run: yarn install --immutable - - ## --- BUILD --- ## - - name: Check for built assets - continue-on-error: true - id: download - uses: actions/download-artifact@v4 - with: - path: | - ${{ github.workspace }}/components/*/dist/** - ${{ github.workspace }}/tokens/dist/** - ${{ github.workspace }}/ui-icons/dist/** - name: ${{ steps.derive-key.outputs.key }} - - - name: Build - if: ${{ steps.download.outcome != 'success' }} - shell: bash - run: yarn ci - - - name: Upload compiled assets - if: ${{ steps.download.outcome != 'success' }} - continue-on-error: true - id: upload - uses: actions/upload-artifact@v4 - with: - path: | - ${{ github.workspace }}/components/*/dist/** - ${{ github.workspace }}/tokens/dist/** - ${{ github.workspace }}/ui-icons/dist/** - name: ${{ steps.derive-key.outputs.key }} - # this is important, it lets us catch if the build failed silently - # by alterting us that no compiled assets were generated - if-no-files-found: error - retention-days: 5 + + fetch-build-artifacts: + name: Fetch & validate build artifacts + strategy: + matrix: + branch: + - ${{ inputs.head-sha }} + - ${{ inputs.base-sha }} + runs-on: ubuntu-latest + timeout-minutes: 10 + outputs: + artifact-id: ${{ steps.upload.outputs.artifact-id }} + steps: + - name: Set the cache key for builds + id: derive-key + shell: bash + run: | + BRANCH=${{ matrix.branch }} + BRANCH=${BRANCH//\//_} + echo "key=ubuntu-latest-node20-compiled-assets-${BRANCH}" >> "$GITHUB_OUTPUT" + + - name: Check if build artifacts already exist + uses: actions/download-artifact@v4 + id: artifact-found + continue-on-error: true + with: + name: ${{ steps.derive-key.outputs.key }} + + - name: Exit if artifact already exists + if: ${{ success() }} + shell: bash + run: exit 0 + + - name: Check out code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ matrix.branch }} + + ## --- SETUP --- ## + - name: Use Node LTS version + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: yarn + + - name: Enable Corepack + run: corepack enable + + ## --- YARN CACHE --- ## + - name: Check for cached dependencies + continue-on-error: true + id: cache-dependencies + uses: actions/cache@v4 + with: + path: | + .cache/yarn + node_modules + key: ubuntu-latest-node20-${{ hashFiles('yarn.lock') }} + + ## --- INSTALL --- ## + # note: if cache-hit isn't needed b/c yarn will leverage the cache if it exists + - name: Install dependencies + shell: bash + run: yarn install --immutable + + ## --- BUILD --- ## + - name: Check for built assets + continue-on-error: true + id: download + uses: actions/download-artifact@v4 + with: + path: | + ${{ github.workspace }}/components/*/dist/** + ${{ github.workspace }}/tokens/dist/** + ${{ github.workspace }}/ui-icons/dist/** + name: ${{ steps.derive-key.outputs.key }} + + - name: Build + if: ${{ steps.download.outcome != 'success' }} + shell: bash + run: yarn ci + + - name: Upload compiled assets + if: ${{ steps.download.outcome != 'success' }} + continue-on-error: true + id: upload + uses: actions/upload-artifact@v4 + with: + path: | + ${{ github.workspace }}/components/*/dist/** + ${{ github.workspace }}/tokens/dist/** + ${{ github.workspace }}/ui-icons/dist/** + name: ${{ steps.derive-key.outputs.key }} + # this is important, it lets us catch if the build failed silently + # by alterting us that no compiled assets were generated + if-no-files-found: error + retention-days: 5 diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index 59831db7359..6340ac788cb 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -1,217 +1,211 @@ name: - Verify - # ------------------------------------------------------------- - # This workflow will build and verify pull requests. It will: - # - Build the base branch and the PR branch - # - Compare the compiled output of the two branches - # - Run visual regression tests on the PR branch - # - Publish the PR branch to Netlify for review - # ------------------------------------------------------------- + Verify + # ------------------------------------------------------------- + # This workflow will build and verify pull requests. It will: + # - Build the base branch and the PR branch + # - Compare the compiled output of the two branches + # - Run visual regression tests on the PR branch + # - Publish the PR branch to Netlify for review + # ------------------------------------------------------------- on: - merge_group: - pull_request: - branches: - - main - - spectrum-two - # Allow us to run tests for PRs updating github actions - - chore-*ci* - - chore-*github-actions* - - types: - - opened - - synchronize - - reopened - - labeled - - unlabeled - - auto_merge_enabled + merge_group: + pull_request: + branches: + - main + - spectrum-two + # Allow us to run tests for PRs updating github actions + - chore-*ci* + - chore-*github-actions* + + types: + - opened + - synchronize + - reopened + - labeled + - unlabeled + - auto_merge_enabled permissions: - contents: read - pull-requests: write + contents: read + pull-requests: write concurrency: - group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" - cancel-in-progress: true + group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" + cancel-in-progress: true defaults: - run: - shell: bash + run: + shell: bash jobs: - # ------------------------------------------------------------- - # Validate build for various environments - # ------------------------------------------------------------- - verify_builds: - name: Verify - # Check that the PR is not in draft mode (or if it is, that it has the run_ci label to force a build) - if: ${{ github.event.pull_request.draft != 'true' || contains(github.event.pull_request.labels.*.name, 'run_ci') }} - strategy: - fail-fast: false - matrix: - system: - - macos-latest - - ubuntu-latest - node-version: - - 20 - # experimental: - # - false - # include: - # - system: windows-latest - # experimental: true - # - system: windows-latest - # experimental: true - uses: ./.github/workflows/build.yml - with: - system: ${{ matrix.system }} - node-version: ${{ matrix.node-version }} - secrets: inherit - - # ------------------------------------------------------------- - # Compare the compiled assets - # ------------------------------------------------------------- - compare: - name: Compare - # Check that the PR is not in draft mode (or if it is, that it has the run_ci label to force a build) - if: ${{ github.event.pull_request.draft != 'true' || contains(github.event.pull_request.labels.*.name, 'run_ci') }} - uses: ./.github/workflows/compare-results.yml - with: - base-sha: ${{ github.event.pull_request.base.ref }} - head-sha: ${{ github.event.pull_request.head.ref }} - secrets: inherit - - # ------------------------------------------------------------- - # Returns all changed pull request files. - # -------------------------------------------------------------- - changed_files: - runs-on: ubuntu-latest - name: Capture changed-files - outputs: - styles_added_files: ${{ steps.changed-files.outputs.styles_added_files }} - styles_modified_files: ${{ steps.changed-files.outputs.styles_modified_files }} - eslint_added_files: ${{ steps.changed-files.outputs.eslint_added_files }} - eslint_modified_files: ${{ steps.changed-files.outputs.eslint_modified_files }} - mdlint_added_files: ${{ steps.changed-files.outputs.mdlint_added_files }} - mdlint_modified_files: ${{ steps.changed-files.outputs.mdlint_modified_files }} - plugins_modified_files: ${{ steps.changed-files.outputs.plugins_modified_files }} - plugins_added_files: ${{ steps.changed-files.outputs.plugins_added_files }} - permissions: - pull-requests: read - - steps: - - name: Get changed files - id: changed-files - uses: step-security/changed-files@v45 - with: - files_yaml: | - styles: - - components/*/index.css - - components/*/themes/spectrum.css - - components/*/themes/express.css - eslint: - - components/*/stories/*.js - mdlint: - - '*.md' - - .storybook/*.md - - .storybook/*/*.md - - .storybook/*/*.mdx - - components/*/*.md - - components/*/stories/*.mdx - - plugins/*/*.md - - tokens/*.md - - tools/*/*.md - - ui-icons/*.md - plugins: - - plugins/**/* - - # ------------------------------------------------------------- - # Lint pre-compiled assets for consistency - # ------------------------------------------------------------- - lint: - name: Lint - if: ${{ contains(github.event.pull_request.labels.*.name, 'skip_lint') == false }} - needs: [changed_files] - uses: ./.github/workflows/lint.yml + # ------------------------------------------------------------- + # Validate build for various environments + # ------------------------------------------------------------- + verify_builds: + name: Verify + # Check that the PR is not in draft mode (or if it is, that it has the run_ci label to force a build) + if: ${{ github.event.pull_request.draft != 'true' || contains(github.event.pull_request.labels.*.name, 'run_ci') }} + strategy: + fail-fast: false + matrix: + system: + - macos-latest + - ubuntu-latest + # - windows-latest # todo: debug token style-dictionary failures on windows + node-version: + - 20 + uses: ./.github/workflows/build.yml + with: + system: ${{ matrix.system }} + node-version: ${{ matrix.node-version }} + secrets: inherit + + # ------------------------------------------------------------- + # Compare the compiled assets + # ------------------------------------------------------------- + compare: + name: Compare + # Check that the PR is not in draft mode (or if it is, that it has the run_ci label to force a build) + if: ${{ github.event.pull_request.draft != 'true' || contains(github.event.pull_request.labels.*.name, 'run_ci') }} + uses: ./.github/workflows/compare-results.yml + with: + deploy-message: ${{ github.event.pull_request.title }} + alias: pr-${{ github.event.number }} + base-sha: ${{ github.event.pull_request.base.ref }} + head-sha: ${{ github.event.pull_request.head.ref }} + secrets: inherit + + # ------------------------------------------------------------- + # Returns all changed pull request files. + # -------------------------------------------------------------- + changed_files: + runs-on: ubuntu-latest + name: Capture changed-files + outputs: + styles_added_files: ${{ steps.changed-files.outputs.styles_added_files }} + styles_modified_files: ${{ steps.changed-files.outputs.styles_modified_files }} + eslint_added_files: ${{ steps.changed-files.outputs.eslint_added_files }} + eslint_modified_files: ${{ steps.changed-files.outputs.eslint_modified_files }} + mdlint_added_files: ${{ steps.changed-files.outputs.mdlint_added_files }} + mdlint_modified_files: ${{ steps.changed-files.outputs.mdlint_modified_files }} + plugins_modified_files: ${{ steps.changed-files.outputs.plugins_modified_files }} + plugins_added_files: ${{ steps.changed-files.outputs.plugins_added_files }} + permissions: + pull-requests: read + + steps: + - name: Get changed files + id: changed-files + uses: step-security/changed-files@v45 with: - styles_added_files: ${{ needs.changed_files.outputs.styles_added_files }} - styles_modified_files: ${{ needs.changed_files.outputs.styles_modified_files }} - eslint_added_files: ${{ needs.changed_files.outputs.eslint_added_files }} - eslint_modified_files: ${{ needs.changed_files.outputs.eslint_modified_files }} - mdlint_added_files: ${{ needs.changed_files.outputs.mdlint_added_files }} - mdlint_modified_files: ${{ needs.changed_files.outputs.mdlint_modified_files }} - secrets: inherit - - # ------------------------------------------------------------- - # Run the test suites for the plugins if there are changes - # to any of the plugin files - # ------------------------------------------------------------- - plugin_tests: - name: Plugin tests - runs-on: ubuntu-latest - needs: [changed_files] - if: ${{ needs.changed_files.outputs.plugins_added_files != '' || needs.changed_files.outputs.plugins_modified_files != '' }} - steps: - - name: Check out code - uses: actions/checkout@v4 - - - name: Use Node LTS version - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: yarn - - - name: Enable Corepack - run: corepack enable - - ## --- YARN CACHE --- ## - - name: Check for cached dependencies - continue-on-error: true - id: cache-dependencies - uses: actions/cache@v4 - with: - path: | - .cache/yarn - node_modules - key: ubuntu-latest-node20-${{ hashFiles('yarn.lock') }} - - ## --- INSTALL --- ## - # If statement isn't needed here b/c yarn will leverage the cache if it exists - - name: Install dependencies - shell: bash - run: yarn install --immutable - - ## --- Run plugins test suites --- ## - - name: Run plugin tests - run: yarn test:plugins - - # ------------------------------------------------------------- - # RUN VISUAL REGRESSION TESTS --- # - # Run VRT on: - # - ALL pull_request where: - # - PR has label 'run_vrt' - # - NOT in draft UNLESS labels includes 'run_ci' - # - PR is mergeable - # Note: mergeable implies ONLY that no merge conflicts with the base - # branch; nothing about other checks, like CI, passing. - # Note: 'skip_vrt' label is used to pass the tasks but not actually - # publish to Chromatic - # ------------------------------------------------------------- - vrt: - name: Testing - if: ${{ contains(github.event.pull_request.labels.*.name, 'run_vrt') || ((github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'run_ci')) && github.event.pull_request.mergeable == true) }} - uses: ./.github/workflows/vrt.yml + files_yaml: | + styles: + - components/*/index.css + - components/*/themes/spectrum.css + - components/*/themes/express.css + eslint: + - components/*/stories/*.js + mdlint: + - '*.md' + - .storybook/*.md + - .storybook/*/*.md + - .storybook/*/*.mdx + - components/*/*.md + - components/*/stories/*.mdx + - plugins/*/*.md + - tokens/*.md + - tools/*/*.md + - ui-icons/*.md + plugins: + - plugins/**/* + + # ------------------------------------------------------------- + # Lint pre-compiled assets for consistency + # ------------------------------------------------------------- + lint: + name: Lint + if: ${{ contains(github.event.pull_request.labels.*.name, 'skip_lint') == false }} + needs: [changed_files] + uses: ./.github/workflows/lint.yml + with: + styles_added_files: ${{ needs.changed_files.outputs.styles_added_files }} + styles_modified_files: ${{ needs.changed_files.outputs.styles_modified_files }} + eslint_added_files: ${{ needs.changed_files.outputs.eslint_added_files }} + eslint_modified_files: ${{ needs.changed_files.outputs.eslint_modified_files }} + secrets: inherit + + # ------------------------------------------------------------- + # Run the test suites for the plugins if there are changes + # to any of the plugin files + # ------------------------------------------------------------- + plugin_tests: + name: Plugin tests + runs-on: ubuntu-latest + needs: [changed_files] + if: ${{ needs.changed_files.outputs.plugins_added_files != '' || needs.changed_files.outputs.plugins_modified_files != '' }} + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Use Node LTS version + uses: actions/setup-node@v4 with: - skip: ${{ github.base_ref == 'spectrum-two' || contains(github.event.pull_request.labels.*.name, 'skip_vrt') }} - secrets: inherit - - # ------------------------------------------------------------- - # PUBLISH TO NETLIFY --- # - # Publish to netlify by leveraging the previous build and then building the site as well - # ------------------------------------------------------------- - publish_site: - name: Publish - uses: ./.github/workflows/publish-site.yml + node-version: 20 + cache: yarn + + - name: Enable Corepack + run: corepack enable + + ## --- YARN CACHE --- ## + - name: Check for cached dependencies + continue-on-error: true + id: cache-dependencies + uses: actions/cache@v4 with: - deploy-message: ${{ github.event.pull_request.title }} - alias: pr-${{ github.event.number }} - secrets: inherit + path: | + .cache/yarn + node_modules + key: ubuntu-latest-node20-${{ hashFiles('yarn.lock') }} + + ## --- INSTALL --- ## + # If statement isn't needed here b/c yarn will leverage the cache if it exists + - name: Install dependencies + shell: bash + run: yarn install --immutable + + ## --- Run plugins test suites --- ## + - name: Run plugin tests + run: yarn test:plugins + + # ------------------------------------------------------------- + # RUN VISUAL REGRESSION TESTS --- # + # Run VRT on: + # - ALL pull_request where: + # - PR has label 'run_vrt' + # - NOT in draft UNLESS labels includes 'run_ci' + # - PR is mergeable + # Note: mergeable implies ONLY that no merge conflicts with the base + # branch; nothing about other checks, like CI, passing. + # Note: 'skip_vrt' label is used to pass the tasks but not actually + # publish to Chromatic + # ------------------------------------------------------------- + vrt: + name: Testing + if: contains(github.event.pull_request.labels.*.name, 'run_vrt') || ((github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'run_ci')) && github.event.pull_request.mergeable == true) + uses: ./.github/workflows/vrt.yml + with: + skip: ${{ github.base_ref == 'spectrum-two' || contains(github.event.pull_request.labels.*.name, 'skip_vrt') }} + secrets: inherit + + # ------------------------------------------------------------- + # PUBLISH TO NETLIFY --- # + # Publish to netlify by leveraging the previous build and then building the site as well + # ------------------------------------------------------------- + publish_site: + name: Publish + uses: ./.github/workflows/publish-site.yml + with: + deploy-message: ${{ github.event.pull_request.title }} + alias: pr-${{ github.event.number }} + secrets: inherit diff --git a/.github/workflows/publish-site.yml b/.github/workflows/publish-site.yml index bd7bd9fe603..7e37f87a06f 100644 --- a/.github/workflows/publish-site.yml +++ b/.github/workflows/publish-site.yml @@ -4,88 +4,87 @@ name: Publish documentation # on: - workflow_dispatch: - inputs: - deploy-message: - required: false - type: string - alias: - required: false - type: string - workflow_call: - inputs: - deploy-message: - required: false - type: string - alias: - required: false - type: string + workflow_dispatch: + inputs: + deploy-message: + required: false + type: string + alias: + required: false + type: string + workflow_call: + inputs: + deploy-message: + required: false + type: string + alias: + required: false + type: string permissions: - contents: read - pull-requests: write + contents: read + pull-requests: write jobs: - # --- PUBLISH TO NETLIFY --- # - # Publish to netlify by leveraging the previous build and then building the site as well - # --- # - publish_site: - name: Publish - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - ## --- SETUP --- ## - - name: Check out code - uses: actions/checkout@v4 - with: - fetch-depth: 0 + # --- PUBLISH TO NETLIFY --- # + # Publish to netlify by leveraging the previous build and then building the site as well + # --- # + publish_site: + name: Publish + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + ## --- SETUP --- ## + - name: Check out code + uses: actions/checkout@v4 + with: + fetch-depth: 0 - - name: Use Node LTS version - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: yarn + - name: Use Node LTS version + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: yarn - - name: Enable Corepack - run: corepack enable + - name: Enable Corepack + run: corepack enable - ## --- YARN CACHE --- ## - - name: Check for cached dependencies - continue-on-error: true - id: cache-dependencies - uses: actions/cache@v4 - with: - path: | - .cache/yarn - node_modules - key: ubuntu-latest-node20-${{ hashFiles('yarn.lock') }} + ## --- YARN CACHE --- ## + - name: Check for cached dependencies + continue-on-error: true + id: cache-dependencies + uses: actions/cache@v4 + with: + path: | + .cache/yarn + node_modules + key: ubuntu-latest-node20-${{ hashFiles('yarn.lock') }} - ## --- INSTALL --- ## - # note: if cache-hit isn't needed b/c yarn will leverage the cache if it exists - - name: Install dependencies - shell: bash - run: yarn install --immutable + ## --- INSTALL --- ## + # note: if cache-hit isn't needed b/c yarn will leverage the cache if it exists + - name: Install dependencies + shell: bash + run: yarn install --immutable - ## --- BUILD --- ## - - name: Build storybook - shell: bash - run: yarn build:docs + ## --- BUILD --- ## + - name: Build storybook + shell: bash + run: yarn build:docs - ## --- DEPLOY WEBSITE TO NETLIFY --- ## - - name: Deploy - uses: nwtgck/actions-netlify@v3 - with: - publish-dir: dist - production-branch: main - production-deploy: false - netlify-config-path: ./netlify.toml - github-token: ${{ secrets.GITHUB_TOKEN }} - deploy-message: ${{ inputs.deploy-message }} - enable-pull-request-comment: true - enable-commit-comment: false - overwrites-pull-request-comment: true - alias: ${{ inputs.alias }} - env: - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN_GH_ACTIONS_DEPLOY }} - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} - timeout-minutes: 10 + ## --- DEPLOY WEBSITE TO NETLIFY --- ## + - name: Deploy + uses: nwtgck/actions-netlify@v3 + with: + publish-dir: dist + production-branch: main + production-deploy: false + github-token: ${{ secrets.GITHUB_TOKEN }} + deploy-message: ${{ inputs.deploy-message }} + enable-pull-request-comment: true + enable-commit-comment: false + overwrites-pull-request-comment: true + alias: ${{ inputs.alias }} + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN_GH_ACTIONS_DEPLOY }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + timeout-minutes: 10 diff --git a/netlify.toml b/netlify.toml deleted file mode 100644 index cb2a3a27944..00000000000 --- a/netlify.toml +++ /dev/null @@ -1,22 +0,0 @@ -[build] - publish = "dist/" - command = "yarn build:docs" - -# If skip_processing = true, all other settings are ignored -[build.processing] - skip_processing = false -[build.processing.css] - bundle = true - minify = true -[build.processing.js] - bundle = true - minify = true -[build.processing.html] - pretty_urls = true -[build.processing.images] - compress = true - -# Skip all post processing in deploy previews, -# ignoring any other settings -[context.deploy-preview.processing] - skip_processing = true diff --git a/tasks/templates/compare-listing.njk b/tasks/templates/compare-listing.njk index f47eff8126e..dd436ac74a3 100644 --- a/tasks/templates/compare-listing.njk +++ b/tasks/templates/compare-listing.njk @@ -7,7 +7,7 @@ - +