From 8cd181784ec32da5e278baf3ffddd019b8fbc4f8 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Mon, 1 Aug 2022 02:18:28 +0000 Subject: [PATCH 1/2] ci: move chromatic to coder.yaml --- .github/workflows/chromatic.yaml | 68 -------------------------------- .github/workflows/coder.yaml | 42 ++++++++++++++++++++ 2 files changed, 42 insertions(+), 68 deletions(-) delete mode 100644 .github/workflows/chromatic.yaml diff --git a/.github/workflows/chromatic.yaml b/.github/workflows/chromatic.yaml deleted file mode 100644 index 0bc23ba403180..0000000000000 --- a/.github/workflows/chromatic.yaml +++ /dev/null @@ -1,68 +0,0 @@ -# Note: Chromatic is a separate workflow for coder.yaml as suggested by the -# chromatic docs. Explicitly, Chromatic works best on 'push' instead of other -# event types (like pull request), keep in mind that it works build-over-build -# by storing snapshots. -# -# SEE: https://www.chromatic.com/docs/ci -name: chromatic - -# REMARK: We want Chromatic to run whenever anything in the FE or its deps -# change, including node_modules and generated code. Currently, all -# node_modules and generated code live in site. If any of these are -# hoisted, we'll want to adjust the paths filter to account for them. -on: - push: - paths: - - site/** - branches: - - main - tags: - - "*" - - pull_request: - paths: - - site/** - -jobs: - deploy: - # REMARK: this is only used to build storybook and deploy it to Chromatic. - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - with: - # Required by Chromatic for build-over-build history, otherwise we - # only get 1 commit on shallow checkout. - fetch-depth: 0 - - - name: Install dependencies - run: cd site && yarn - - # This step is not meant for mainline because any detected changes to - # storybook snapshots will require manual approval/review in order for - # the check to pass. This is desired in PRs, but not in mainline. - - name: Publish to Chromatic (non-mainline) - if: github.ref != 'refs/heads/main' && github.repository_owner == 'coder' - uses: chromaui/action@v1 - with: - buildScriptName: "storybook:build" - exitOnceUploaded: true - # Chromatic states its fine to make this token public. See: - # https://www.chromatic.com/docs/github-actions#forked-repositories - projectToken: 695c25b6cb65 - workingDir: "./site" - - # This is a separate step for mainline only that auto accepts and changes - # instead of holding CI up. Since we squash/merge, this is defensive to - # avoid the same changeset from requiring review once squashed into - # main. Chromatic is supposed to be able to detect that we use squash - # commits, but it's good to be defensive in case, otherwise CI remains - # infinitely "in progress" in mainline unless we re-review each build. - - name: Publish to Chromatic (mainline) - if: github.ref == 'refs/heads/main' && github.repository_owner == 'coder' - uses: chromaui/action@v1 - with: - autoAcceptChanges: true - buildScriptName: "storybook:build" - projectToken: 695c25b6cb65 - workingDir: "./site" diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index fb41b3f1f2924..a4b8043005ff8 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -603,3 +603,45 @@ jobs: DD_CATEGORY: e2e GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }} run: go run scripts/datadog-cireport/main.go site/test-results/junit.xml + chromatic: + # REMARK: this is only used to build storybook and deploy it to Chromatic. + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + # Required by Chromatic for build-over-build history, otherwise we + # only get 1 commit on shallow checkout. + fetch-depth: 0 + + - name: Install dependencies + run: cd site && yarn + + # This step is not meant for mainline because any detected changes to + # storybook snapshots will require manual approval/review in order for + # the check to pass. This is desired in PRs, but not in mainline. + - name: Publish to Chromatic (non-mainline) + if: github.ref != 'refs/heads/main' && github.repository_owner == 'coder' + uses: chromaui/action@v1 + with: + buildScriptName: "storybook:build" + exitOnceUploaded: true + # Chromatic states its fine to make this token public. See: + # https://www.chromatic.com/docs/github-actions#forked-repositories + projectToken: 695c25b6cb65 + workingDir: "./site" + + # This is a separate step for mainline only that auto accepts and changes + # instead of holding CI up. Since we squash/merge, this is defensive to + # avoid the same changeset from requiring review once squashed into + # main. Chromatic is supposed to be able to detect that we use squash + # commits, but it's good to be defensive in case, otherwise CI remains + # infinitely "in progress" in mainline unless we re-review each build. + - name: Publish to Chromatic (mainline) + if: github.ref == 'refs/heads/main' && github.repository_owner == 'coder' + uses: chromaui/action@v1 + with: + autoAcceptChanges: true + buildScriptName: "storybook:build" + projectToken: 695c25b6cb65 + workingDir: "./site" From 7f7079553d6880beca66a449937ea3f9c7e756a1 Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Mon, 1 Aug 2022 02:21:51 +0000 Subject: [PATCH 2/2] fixup! ci: move chromatic to coder.yaml --- .github/workflows/coder.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index a4b8043005ff8..5a36799dfd8ba 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -35,6 +35,7 @@ jobs: outputs: docs-only: ${{ steps.filter.outputs.docs_count == steps.filter.outputs.all_count }} sh: ${{ steps.filter.outputs.sh }} + ts: ${{ steps.filter.outputs.ts }} steps: - uses: actions/checkout@v3 # For pull requests it's not necessary to checkout the code @@ -50,6 +51,11 @@ jobs: # - '.github/**' sh: - "**.sh" + ts: + - "**.tsx?" + - "**.jsx?" + - "**.lock" + - "**.json" - id: debug run: | echo "${{ toJSON(steps.filter )}}" @@ -606,7 +612,9 @@ jobs: chromatic: # REMARK: this is only used to build storybook and deploy it to Chromatic. runs-on: ubuntu-latest - + needs: + - changes + if: needs.changes.outputs.ts == 'true' steps: - uses: actions/checkout@v3 with: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy