Skip to content

Instantly share code, notes, and snippets.

@danyim
Last active October 30, 2023 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danyim/b1426079ec87baf4dbf660f91b1237dd to your computer and use it in GitHub Desktop.
Save danyim/b1426079ec87baf4dbf660f91b1237dd to your computer and use it in GitHub Desktop.
Storybook CI

Current State

stateDiagram-v2
	direction TB
	state "Commit on feature branch" as FeatureCommit
	state "Merge to main" as MergeToMain
	state "Author & reviewer review published screenshots" as ReviewSS
	state "Storyshots CI Step Triggered" as TriggerCI
	state "Publish feature<>main diff on GH Pages" as PublishDiff
	state "Post result to PR w/ link" as PostToPR
	state "Screenshot diff detected?" as DiffDetection
	state "Investigate and fix issue w/ new commit" as Investigate
	state "✅ Build Step Succeeds" as CISucceeds
	state "❌ Build Step Fails" as CIFails
	state "Run Storyshots job to generate new screenshots" as StoryshotsJob
	state "Storyshots job produces a commit" as StoryshotsCommit
	state "(?) Is there's a discrepancy?" as IfIssue

	[*] --> FeatureCommit
    FeatureCommit --> TriggerCI

	TriggerCI --> PublishDiff
	
	state GithubActions {
	    PublishDiff --> PostToPR
	    PostToPR --> DiffDetection
    }
	
	DiffDetection --> CIFails
	CIFails --> Investigate
	Investigate --> FeatureCommit
	Investigate --> StoryshotsJob
	StoryshotsJob --> StoryshotsCommit
	StoryshotsCommit --> TriggerCI
	
	DiffDetection --> CISucceeds
	CISucceeds --> ReviewSS
	ReviewSS --> IfIssue
	IfIssue --> Investigate
	ReviewSS --> MergeToMain
	MergeToMain --> [*]

Future State

stateDiagram-v2
	direction TB
	state "Commit on feature branch" as FeatureCommit
	state "Merge to main" as MergeToMain
	state "Author & reviewer review published screenshots" as ReviewSS
	state "Storyshots CI Step Triggered" as TriggerCI
	state "Generate screenshots" as GenerateSS
	state "Publish feature<>main diff on GH Pages" as PublishDiff
	state "Post diff result to PR w/ link" as PostToPR
	state "Screenshot diff detected?" as DiffDetection
	state "Investigate and fix issue w/ new commit" as Investigate
	state "✅ Build Step Succeeds" as CISucceeds
	state "❌ Build Step Fails" as CIFails
	state "Upload screenshots to S3" as UploadS3
	state "CI (for main only): Upload baseline screenshots to S3" as UpdateBaselineS3
	state "(?) Is there's a discrepancy?" as IfIssue

	[*] --> FeatureCommit
    FeatureCommit--> TriggerCI
	TriggerCI --> GenerateSS
	
	state GithubActions {
	    GenerateSS --> UploadS3
	    UploadS3 --> PublishDiff
	    PublishDiff --> PostToPR
	    PostToPR --> DiffDetection
    }
	
	DiffDetection --> CIFails
	CIFails --> Investigate
	Investigate --> FeatureCommit
	
	DiffDetection --> CISucceeds
	CISucceeds --> ReviewSS
	ReviewSS --> IfIssue
	IfIssue --> Investigate
	ReviewSS --> MergeToMain
	MergeToMain --> UpdateBaselineS3
	UpdateBaselineS3 --> [*]
		
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment