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

chore(chromatic): Basic config #3662

Draft
wants to merge 29 commits into
base: v4-dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
51d5a85
chore(chromatic): Testing basic conf, styles not working locally
planctus Oct 3, 2024
41b3d33
chore(chromatic): Using yarn to install deps in the workflow
planctus Oct 3, 2024
61361f4
chore(chromatic): Setting fetch-depth
planctus Oct 3, 2024
97924c9
chore(chromatic): Replacing fetch-depth
planctus Oct 3, 2024
d948add
chore(chromatic): fetch-depth, the right way
planctus Oct 3, 2024
ad68feb
chore(chromatic): Trying the chromatic github action
planctus Oct 4, 2024
6a0f56d
chore(chromatic): Trying the chromatic github action
planctus Oct 4, 2024
db93a30
chore(chromatic): Using already built storybook
planctus Oct 4, 2024
83e6002
chore(chromatic): Using already built storybook
planctus Oct 4, 2024
a366a25
Merge branch 'v4-dev' of github.com:ec-europa/europa-component-librar…
planctus Oct 4, 2024
72fcd67
chore(chromatic): Running only accordion tests
planctus Oct 4, 2024
4f1b1dc
chore(chromatic): Using the right build, hopefully
planctus Oct 4, 2024
9c5af20
chore(ci): trying to reuse workspace
planctus Oct 4, 2024
b549042
chore(ci): uff, fetch depth..
planctus Oct 4, 2024
e0695fd
chore(ci): Trying reusing also the deps
planctus Oct 4, 2024
176d002
chore(chromatic): Trying with all the stories
planctus Oct 4, 2024
df888d6
chore(chromatic): fixing EU deployment
planctus Oct 4, 2024
d9242ad
chore(chromatic): Enabling page examples, gallery, excluding dummy co…
planctus Oct 4, 2024
001bc31
chore(chromatic): Search fails on EU, why..?
planctus Oct 7, 2024
0e5b161
Merge branch 'v4-dev' of github.com:ec-europa/europa-component-librar…
planctus Oct 7, 2024
c750fd5
chore(chromatic): Limiting stories to test
planctus Oct 8, 2024
6dfbe5e
chore(chromatic): Excluding the failing stories for now, trying turbo…
planctus Oct 8, 2024
742b534
Merge branch 'v4-dev' of github.com:ec-europa/europa-component-librar…
planctus Oct 21, 2024
b5260e9
chore(chromatic): Adding config file, dry-run
planctus Oct 21, 2024
13e03d7
chore(chromatic): Fixing config file
planctus Oct 21, 2024
0e54b96
chore(chromatic): Using only-changed, removing only-story-names
planctus Oct 21, 2024
a80d4da
chore(chromatic): Removing dry-run
planctus Oct 21, 2024
26acff1
Merge branch 'v4-dev' into chore-chromatic
planctus Nov 13, 2024
61c40cc
Merge branch 'v4-dev' into chore-chromatic
planctus Nov 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

audit:
name: audit
runs-on: ubuntu-latest
Expand All @@ -26,6 +27,7 @@ jobs:
node-version: 20.9.0
- name: Test
run: ./scripts/audit.sh

tests:
name: tests
runs-on: ubuntu-latest
Expand All @@ -42,6 +44,7 @@ jobs:
run: yarn build:presets
- name: Test
run: yarn test

size:
name: size
runs-on: ubuntu-latest
Expand All @@ -56,12 +59,15 @@ jobs:
run: yarn dist:presets
- name: Test
run: yarn size-limit

deploy-pull-request-preview:
name: deploy preview
name: Deploy Preview
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20.9.0
Expand All @@ -71,6 +77,7 @@ jobs:
run: yarn build:icons
- name: Package application
run: yarn dist
- uses: jpoehnelt/reusable-workspace/save@v1
- name: Deploy to Netlify
uses: nwtgck/[email protected]
with:
Expand All @@ -81,8 +88,31 @@ jobs:
NETLIFY: true
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}

chromatic-ec:
name: Run Chromatic for EC
needs: deploy-pull-request-preview
runs-on: ubuntu-latest
steps:
- uses: jpoehnelt/reusable-workspace/restore@v1
- uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
storybookBuildDir: dist/website/playground/ec

chromatic-eu:
name: Run Chromatic for EU
needs: deploy-pull-request-preview
runs-on: ubuntu-latest
steps:
- uses: jpoehnelt/reusable-workspace/restore@v1
- uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN_EU }}
storybookBuildDir: dist/website/playground/eu

deploy-release-branch:
name: deploy release branch
name: Deploy Release Branch
runs-on: ubuntu-latest
if: github.event_name == 'push' && endsWith(github.ref, '-dev')
steps:
Expand Down
6 changes: 6 additions & 0 deletions chromatic.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://www.chromatic.com/config-file.schema.json",
"autoAcceptChanges": "v4-dev",
"exitOnceUploaded": true,
"onlyChanged": true
}
15 changes: 12 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"private": true,
"author": "European Commission",
"author": {
"name": "European Commission"
},
"license": "EUPL-1.2",
"description": "Europa Component Library",
"scripts": {
Expand Down Expand Up @@ -30,7 +32,11 @@
"test": "run-p test:*",
"test:components": "jest --verbose",
"test:coding-conventions": "npm run lint && npm run pretty-check",
"update-version": "scripts/update-version.sh"
"update-version": "scripts/update-version.sh",
"chromatic-eu": "cd src/playground/eu && npm run build",
"chromatic-ec": "cd src/playground/ec && npm run build",
"chromatic-EU": "STORYBOOK_CHROMATIC=true npx chromatic --build-script-name chromatic-eu",
"chromatic-EC": "STORYBOOK_CHROMATIC=true npx chromatic --build-script-name chromatic-ec"
},
"devDependencies": {
"@babel/eslint-parser": "7.25.9",
Expand All @@ -40,6 +46,7 @@
"@prettier/plugin-xml": "3.4.1",
"@size-limit/preset-big-lib": "11.1.6",
"babel-jest": "29.7.0",
"chromatic": "11.11.0",
"classnames": "2.5.1",
"eslint": "8.57.0",
"eslint-config-airbnb": "19.0.4",
Expand Down Expand Up @@ -159,5 +166,7 @@
"port": 6007,
"host": "localhost"
}
}
},
"name": "",
"version": ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ const prepareHtmlContent = (data) =>

export default {
title: 'Components/Navigation/Inpage navigation',
parameters: { layout: 'fullscreen' },
parameters: {
layout: 'fullscreen',
chromatic: {
disable: true,
},
},
};

export const Default = (_, { loaded: { component } }) => component;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ Video.args = getArgs(dataVideo);
Video.argTypes = getArgTypes(dataVideo);
Video.parameters = {
notes: { markdown: notes, json: dataVideo },
chromatic: {
disable: true,
},
};

export const EmbeddedVideo = (_, { loaded: { component } }) => component;
Expand Down
5 changes: 5 additions & 0 deletions src/implementations/twig/components/popover/popover.story.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ const prepareData = (data, args) => {
export default {
title: 'Components/Popover',
decorators: [withNotes, withCode],
parameters: {
chromatic: {
disable: true,
},
},
};

export const Default = (_, { loaded: { component } }) => component;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ const renderStory = async (data, args) => {
export default {
title: 'Components/Loading indicator',
decorators: [withNotes, withCode],
chromatic: { ignoreSelectors: ['.ecl-u-type-paragraph'] },
};

export const Default = (_, { loaded: { component } }) => component;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const prepareHtmlContent = async (args) => {

export default {
title: 'Components/Timeline',
chromatic: { ignoreSelectors: ['.ecl-u-type-paragraph-m'] },
};

export const Default = (_, { loaded: { component } }) => component;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export default {
controls: { disable: true },
EclNotes: { disable: true },
layout: 'fullscreen',
chromatic: { ignoreSelectors: ['.ecl-u-type-paragraph'] },
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ export default {
controls: { disable: true },
EclNotes: { disable: true },
layout: 'fullscreen',
chromatic: {
disable: true,
},
},
};

Expand Down
28 changes: 28 additions & 0 deletions src/playground/ec/.storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,39 @@ import { withCssResources } from '@storybook/addon-cssresources';
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
import { Buffer } from 'buffer';
import { themes } from '@storybook/theming';
import isChromatic from 'chromatic/isChromatic';

global.Buffer = Buffer;

import './ECL';

if (isChromatic() || process.env.STORYBOOK_CHROMATIC) {
function createLink(href, media) {
var link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = href;
link.media = media || 'all';
return link;
}

// Manually inject styles
var head = document.head || document.getElementsByTagName('head')[0];

head.appendChild(createLink('./styles/optional/ecl-reset.css', 'screen'));
head.appendChild(
createLink('./styles/optional/ecl-ec-default.css', 'screen'),
);
head.appendChild(createLink('./styles/ecl-ec.css', 'screen'));
head.appendChild(
createLink('./styles/optional/ecl-ec-utilities.css', 'screen'),
);
head.appendChild(createLink('./styles/ecl-ec-print.css', 'print'));
head.appendChild(
createLink('./styles/optional/ecl-ec-default-print.css', 'print'),
);
}

export const parameters = {
disableSaveFromUI: true,
a11y: {
Expand Down
27 changes: 27 additions & 0 deletions src/playground/eu/.storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,38 @@ import { withCssResources } from '@storybook/addon-cssresources';
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
import { Buffer } from 'buffer';
import { themes } from '@storybook/theming';
import isChromatic from 'chromatic/isChromatic';

global.Buffer = Buffer;

import './ECL';

if (isChromatic() || process.env.STORYBOOK_CHROMATIC) {
function createLink(href, media) {
var link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = href;
link.media = media || 'all';
return link;
}

// Manually inject styles
var head = document.head || document.getElementsByTagName('head')[0];
head.appendChild(createLink('./styles/optional/ecl-reset.css', 'screen'));
head.appendChild(
createLink('./styles/optional/ecl-eu-default.css', 'screen'),
);
head.appendChild(createLink('./styles/ecl-eu.css', 'screen'));
head.appendChild(
createLink('./styles/optional/ecl-eu-utilities.css', 'screen'),
);
head.appendChild(createLink('./styles/ecl-eu-print.css', 'print'));
head.appendChild(
createLink('./styles/optional/ecl-eu-default-print.css', 'print'),
);
}

export const parameters = {
disableSaveFromUI: true,
a11y: {
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5541,6 +5541,11 @@ chownr@^2.0.0:
resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece"
integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==

[email protected]:
version "11.11.0"
resolved "https://registry.yarnpkg.com/chromatic/-/chromatic-11.11.0.tgz#5e5b956464acad22371d88218ea570374b541666"
integrity sha512-mwmYsNMsZlRLtlfFUEtac5zhoVRhc+O/lsuMdOpwkiDQiKX6WdSNIhic+dkLenfuzao2r18s50nphcOgFoatBg==

chrome-trace-event@^1.0.2:
version "1.0.4"
resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz#05bffd7ff928465093314708c93bdfa9bd1f0f5b"
Expand Down
Loading