Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run chromatic on branch ready #199

Merged
merged 24 commits into from
Jan 11, 2024
Merged

Run chromatic on branch ready #199

merged 24 commits into from
Jan 11, 2024

Conversation

etienneburdet
Copy link
Contributor

@etienneburdet etienneburdet commented Oct 11, 2023

Summary

The goal for this PR is to run chromatic only when the branch is ready is for review. The idea is that we would keep branches in draft state for longer and only turn them ready relatively late. It's always possible to discuss drafts or trigger manual runs.

For now:

  • API client code coverage run for each commit where api-client files has been edited
  • Viz CI run for each commit in a PR. Chromatic job run only when test and lint jobs passed with the PR state as 'ready for review'

Other possibilities include : run on label change, run on review request… for exemple.

Review workflow:

  • Create a new branch from this branch
  • Add commits that should break the CI (test or lint)
  • Open a PR in draft (CI should fail and chromatic job not run)
  • Fix the CI, chromatic job should still not run
  • Make the PR ready for review. CI should re-run with now chromatic running
  • Make a commit that break lint or test. CI should fail, chromatic job should not run

@etienneburdet etienneburdet marked this pull request as ready for review October 12, 2023 06:21
@etienneburdet etienneburdet marked this pull request as draft October 12, 2023 06:21
@github-actions
Copy link

Total Coverage: 95.18%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
src
   index.ts100%100%100%
src/client
   error.ts100%100%100%
   index.ts73.97%100%96.83%117, 139, 14, 141, 141, 142, 144, 155, 16, 16, 162, 162, 164, 169, 172, 175, 177, 18, 18, 51, 76
   types.ts100%100%100%
src/odsql
   clauses.ts71.43%80%90.91%14, 32, 42
   index.ts83.72%95.65%94.12%111, 140, 25, 28, 56, 57, 57, 57, 58, 68, 78, 79

@etienneburdet etienneburdet marked this pull request as ready for review October 12, 2023 06:58
@github-actions
Copy link

Total Coverage: 95.18%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
src
   index.ts100%100%100%
src/client
   error.ts100%100%100%
   index.ts73.97%100%96.83%117, 139, 14, 141, 141, 142, 144, 155, 16, 16, 162, 162, 164, 169, 172, 175, 177, 18, 18, 51, 76
   types.ts100%100%100%
src/odsql
   clauses.ts71.43%80%90.91%14, 32, 42
   index.ts83.72%95.65%94.12%111, 140, 25, 28, 56, 57, 57, 57, 58, 68, 78, 79

@github-actions
Copy link

Total Coverage: 95.18%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
src
   index.ts100%100%100%
src/client
   error.ts100%100%100%
   index.ts73.97%100%96.83%117, 139, 14, 141, 141, 142, 144, 155, 16, 16, 162, 162, 164, 169, 172, 175, 177, 18, 18, 51, 76
   types.ts100%100%100%
src/odsql
   clauses.ts71.43%80%90.91%14, 32, 42
   index.ts83.72%95.65%94.12%111, 140, 25, 28, 56, 57, 57, 57, 58, 68, 78, 79

@github-actions
Copy link

Total Coverage: 95.18%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
src
   index.ts100%100%100%
src/client
   error.ts100%100%100%
   index.ts73.97%100%96.83%117, 139, 14, 141, 141, 142, 144, 155, 16, 16, 162, 162, 164, 169, 172, 175, 177, 18, 18, 51, 76
   types.ts100%100%100%
src/odsql
   clauses.ts71.43%80%90.91%14, 32, 42
   index.ts83.72%95.65%94.12%111, 140, 25, 28, 56, 57, 57, 57, 58, 68, 78, 79

@github-actions
Copy link

Total Coverage: 95.18%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
src
   index.ts100%100%100%
src/client
   error.ts100%100%100%
   index.ts73.97%100%96.83%117, 139, 14, 141, 141, 142, 144, 155, 16, 16, 162, 162, 164, 169, 172, 175, 177, 18, 18, 51, 76
   types.ts100%100%100%
src/odsql
   clauses.ts71.43%80%90.91%14, 32, 42
   index.ts83.72%95.65%94.12%111, 140, 25, 28, 56, 57, 57, 57, 58, 68, 78, 79

@github-actions
Copy link

Total Coverage: 95.18%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
src
   index.ts100%100%100%
src/client
   error.ts100%100%100%
   index.ts73.97%100%96.83%117, 139, 14, 141, 141, 142, 144, 155, 16, 16, 162, 162, 164, 169, 172, 175, 177, 18, 18, 51, 76
   types.ts100%100%100%
src/odsql
   clauses.ts71.43%80%90.91%14, 32, 42
   index.ts83.72%95.65%94.12%111, 140, 25, 28, 56, 57, 57, 57, 58, 68, 78, 79

@github-actions
Copy link

Total Coverage: 95.18%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
src
   index.ts100%100%100%
src/client
   error.ts100%100%100%
   index.ts73.97%100%96.83%117, 139, 14, 141, 141, 142, 144, 155, 16, 16, 162, 162, 164, 169, 172, 175, 177, 18, 18, 51, 76
   types.ts100%100%100%
src/odsql
   clauses.ts71.43%80%90.91%14, 32, 42
   index.ts83.72%95.65%94.12%111, 140, 25, 28, 56, 57, 57, 57, 58, 68, 78, 79

@github-actions
Copy link

Total Coverage: 95.18%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
src
   index.ts100%100%100%
src/client
   error.ts100%100%100%
   index.ts73.97%100%96.83%117, 139, 14, 141, 141, 142, 144, 155, 16, 16, 162, 162, 164, 169, 172, 175, 177, 18, 18, 51, 76
   types.ts100%100%100%
src/odsql
   clauses.ts71.43%80%90.91%14, 32, 42
   index.ts83.72%95.65%94.12%111, 140, 25, 28, 56, 57, 57, 57, 58, 68, 78, 79

@github-actions
Copy link

Total Coverage: 95.18%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
src
   index.ts100%100%100%
src/client
   error.ts100%100%100%
   index.ts73.97%100%96.83%117, 139, 14, 141, 141, 142, 144, 155, 16, 16, 162, 162, 164, 169, 172, 175, 177, 18, 18, 51, 76
   types.ts100%100%100%
src/odsql
   clauses.ts71.43%80%90.91%14, 32, 42
   index.ts83.72%95.65%94.12%111, 140, 25, 28, 56, 57, 57, 57, 58, 68, 78, 79

@github-actions
Copy link

Total Coverage: 95.18%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
src
   index.ts100%100%100%
src/client
   error.ts100%100%100%
   index.ts73.97%100%96.83%117, 139, 14, 141, 141, 142, 144, 155, 16, 16, 162, 162, 164, 169, 172, 175, 177, 18, 18, 51, 76
   types.ts100%100%100%
src/odsql
   clauses.ts71.43%80%90.91%14, 32, 42
   index.ts83.72%95.65%94.12%111, 140, 25, 28, 56, 57, 57, 57, 58, 68, 78, 79

@github-actions
Copy link

Total Coverage: 95.18%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
src
   index.ts100%100%100%
src/client
   error.ts100%100%100%
   index.ts73.97%100%96.83%117, 139, 14, 141, 141, 142, 144, 155, 16, 16, 162, 162, 164, 169, 172, 175, 177, 18, 18, 51, 76
   types.ts100%100%100%
src/odsql
   clauses.ts71.43%80%90.91%14, 32, 42
   index.ts83.72%95.65%94.12%111, 140, 25, 28, 56, 57, 57, 57, 58, 68, 78, 79

@github-actions
Copy link

Total Coverage: 95.18%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
src
   index.ts100%100%100%
src/client
   error.ts100%100%100%
   index.ts73.97%100%96.83%117, 139, 14, 141, 141, 142, 144, 155, 16, 16, 162, 162, 164, 169, 172, 175, 177, 18, 18, 51, 76
   types.ts100%100%100%
src/odsql
   clauses.ts71.43%80%90.91%14, 32, 42
   index.ts83.72%95.65%94.12%111, 140, 25, 28, 56, 57, 57, 57, 58, 68, 78, 79

@github-actions
Copy link

Total Coverage: 95.18%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
src
   index.ts100%100%100%
src/client
   error.ts100%100%100%
   index.ts73.97%100%96.83%117, 139, 14, 141, 141, 142, 144, 155, 16, 16, 162, 162, 164, 169, 172, 175, 177, 18, 18, 51, 76
   types.ts100%100%100%
src/odsql
   clauses.ts71.43%80%90.91%14, 32, 42
   index.ts83.72%95.65%94.12%111, 140, 25, 28, 56, 57, 57, 57, 58, 68, 78, 79

@github-actions
Copy link

Total Coverage: 95.18%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
src
   index.ts100%100%100%
src/client
   error.ts100%100%100%
   index.ts73.97%100%96.83%117, 139, 14, 141, 141, 142, 144, 155, 16, 16, 162, 162, 164, 169, 172, 175, 177, 18, 18, 51, 76
   types.ts100%100%100%
src/odsql
   clauses.ts71.43%80%90.91%14, 32, 42
   index.ts83.72%95.65%94.12%111, 140, 25, 28, 56, 57, 57, 57, 58, 68, 78, 79

@etienneburdet etienneburdet marked this pull request as draft October 12, 2023 09:47
@etienneburdet etienneburdet marked this pull request as ready for review October 12, 2023 09:47
@github-actions
Copy link

Total Coverage: 95.18%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
src
   index.ts100%100%100%
src/client
   error.ts100%100%100%
   index.ts73.97%100%96.83%117, 139, 14, 141, 141, 142, 144, 155, 16, 16, 162, 162, 164, 169, 172, 175, 177, 18, 18, 51, 76
   types.ts100%100%100%
src/odsql
   clauses.ts71.43%80%90.91%14, 32, 42
   index.ts83.72%95.65%94.12%111, 140, 25, 28, 56, 57, 57, 57, 58, 68, 78, 79

@etienneburdet etienneburdet marked this pull request as draft October 12, 2023 09:58
@github-actions
Copy link

Total Coverage: 95.18%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
src
   index.ts100%100%100%
src/client
   error.ts100%100%100%
   index.ts73.97%100%96.83%117, 139, 14, 141, 141, 142, 144, 155, 16, 16, 162, 162, 164, 169, 172, 175, 177, 18, 18, 51, 76
   types.ts100%100%100%
src/odsql
   clauses.ts71.43%80%90.91%14, 32, 42
   index.ts83.72%95.65%94.12%111, 140, 25, 28, 56, 57, 57, 57, 58, 68, 78, 79

@etienneburdet etienneburdet marked this pull request as ready for review October 13, 2023 15:38
@etienneburdet etienneburdet marked this pull request as draft October 19, 2023 13:53
@etienneburdet etienneburdet marked this pull request as ready for review December 29, 2023 10:00
@etienneburdet etienneburdet marked this pull request as draft December 29, 2023 10:01
@etienneburdet etienneburdet marked this pull request as ready for review December 29, 2023 10:43
@etienneburdet etienneburdet force-pushed the chore/chromatic-on-ready branch from 4630e9c to 4ed15b7 Compare December 29, 2023 10:47
@etienneburdet
Copy link
Contributor Author

Ok this PR is officially "ready for review" (I had to turn it on and off to test stuff). The conditional trigger of Chromatic on lint seems to work well.

I didn't manage to have the if working properly on this branch, for not running on draft. It seems it only works if the PR opened as draft, but if it has been turned on/off it still runs everything 🤷

@KevinFabre-ods KevinFabre-ods force-pushed the chore/chromatic-on-ready branch from 0c78984 to 73a3814 Compare January 10, 2024 13:03
@KevinFabre-ods KevinFabre-ods mentioned this pull request Jan 10, 2024
Copy link
Contributor

@KevinFabre-ods KevinFabre-ods left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking care of that

Chromatic deployment:

  • is blocked when at least one test or lint job fails ✅
  • is run only when the PR is review for review 🚫

Don't know why but the if: github.event.pull_request.draft == false condition doesn't block the job

.github/workflows/visualizations.yml Show resolved Hide resolved
@KevinFabre-ods
Copy link
Contributor

KevinFabre-ods commented Jan 10, 2024

In the viz workflow, replacing the

on: 
 - push 

by

on: 
   pull_request:
      types:
        - opened
        - synchronize
        - reopened
        - ready_for_review

it works (#214)

to access github.event.pull_request.draft we need to react to the pull_request event, that what we are doing by adding the on: pull_request

@etienneburdet
Copy link
Contributor Author

Ha nice, I think I lacked the synchronize in the early version for it to react to push. I'll just rebase to erase test commits before merging.

@KevinFabre-ods
Copy link
Contributor

I already rebased and erased tests commits => 73a3814

@KevinFabre-ods KevinFabre-ods force-pushed the chore/chromatic-on-ready branch from a6c3654 to 59f1754 Compare January 10, 2024 17:08
Copy link
Contributor

@KevinFabre-ods KevinFabre-ods left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now

@wmai you have review instructions in the PR description 😉

Copy link
Contributor

@wmai wmai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried all sorts of choreographies, the CI behaves as expected, very good job, thank you for this work. 🙏

@KevinFabre-ods KevinFabre-ods merged commit 681898d into main Jan 11, 2024
10 of 11 checks passed
@KevinFabre-ods KevinFabre-ods deleted the chore/chromatic-on-ready branch January 11, 2024 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants