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: deploy Storybook book demo on PR #4031

Merged
merged 79 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
3d4615a
checkpoint
louis-bompart May 22, 2024
109ee4f
checkpoint
louis-bompart May 22, 2024
2a7575b
clean enough
louis-bompart May 22, 2024
a7dbc0d
rm-old-patch
louis-bompart May 22, 2024
337f92a
rm-old-story-kernel
louis-bompart May 22, 2024
42d6fe6
file-gen
louis-bompart May 22, 2024
8bf47a0
gitignore
louis-bompart May 22, 2024
39b2de6
lint
louis-bompart May 22, 2024
5d8ffba
lint
louis-bompart May 22, 2024
35b1145
cem+dope setup
louis-bompart May 22, 2024
2b0335f
interactions and cleaning
louis-bompart May 22, 2024
25af9c7
stable
louis-bompart May 22, 2024
3b15811
result-component
louis-bompart May 23, 2024
6b0fadb
touch-up
louis-bompart May 23, 2024
f348047
fix header, rm old story
louis-bompart May 23, 2024
521d036
clean-up
louis-bompart May 24, 2024
8a0f962
config for searchinterface wrapper
louis-bompart May 24, 2024
d364825
slot support
louis-bompart May 24, 2024
b0ef0cb
Migrate atomic-load-more-results stories to new format
louis-bompart May 24, 2024
d905500
migrate more
louis-bompart May 24, 2024
91d1bbd
more migration
louis-bompart May 25, 2024
aae201e
normalize @example jsdoc
louis-bompart May 25, 2024
e42b59b
docs: migrate formats
louis-bompart May 25, 2024
ffbfaaf
docs: migrate result lists
louis-bompart May 25, 2024
01a3767
docs: migrate results component
louis-bompart May 25, 2024
444c863
derp format
louis-bompart May 25, 2024
4bc29c3
docs: migrate searchbox
louis-bompart May 25, 2024
37d977a
docs: migrate smartsnippets
louis-bompart May 25, 2024
55dd6e2
last stories
louis-bompart May 25, 2024
c2ae9b5
Add generated files
May 25, 2024
b3d324a
docs: migrate atomic-search-box story (#3985)
louis-bompart May 27, 2024
3721f19
build
louis-bompart May 27, 2024
912411c
docs: migrate atomic-no-results (#3991)
louis-bompart May 27, 2024
f826c9d
docs: migrate atomic-result-icon (#3993)
louis-bompart May 27, 2024
e3ca3dc
docs: migrate atomic-numeric-range (#3995)
louis-bompart May 27, 2024
e9cafbc
docs: migrate atomic-timeframe (#3997)
louis-bompart May 27, 2024
87e2ed2
docs: migrate atomic-did-you-mean (#3999)
louis-bompart May 27, 2024
3b41333
docs: migrate atomic-facet-manager (#4005)
louis-bompart May 27, 2024
7e66dfd
build
louis-bompart May 27, 2024
195fa62
add missing cem build
louis-bompart May 27, 2024
e99c662
docs: atomic-icon
louis-bompart May 27, 2024
774a61e
fixes
louis-bompart May 27, 2024
cc7eeec
deletion
louis-bompart May 27, 2024
e4835ab
Revert "normalize @example jsdoc"
louis-bompart May 27, 2024
5bb31b8
missing prestep
louis-bompart May 27, 2024
acf00f6
refactor plugin
louis-bompart May 27, 2024
4f08dea
plugin comments
louis-bompart May 27, 2024
ec4be77
cleanup
louis-bompart May 28, 2024
4386110
ensure-dir
louis-bompart May 28, 2024
48f0e97
derp
louis-bompart May 28, 2024
1823577
cleanup
louis-bompart May 28, 2024
8298c98
derp
louis-bompart May 28, 2024
8362e31
fixed
louis-bompart May 28, 2024
0e74f30
pr artifacts
louis-bompart May 29, 2024
f6c4a0b
derp
louis-bompart May 30, 2024
5665452
derp
louis-bompart May 30, 2024
861e24c
derp
louis-bompart May 30, 2024
d500070
Add generated files
May 30, 2024
7e059ba
derp
louis-bompart May 30, 2024
e4895b9
derp
louis-bompart May 30, 2024
0c229fb
derp
louis-bompart May 30, 2024
ca51f85
derp
louis-bompart May 30, 2024
d9b44a3
derp
louis-bompart May 30, 2024
a0b5d3f
include in live example
louis-bompart May 30, 2024
26785fa
derp
louis-bompart May 30, 2024
1787c8c
derp
louis-bompart May 30, 2024
bbc15cc
derp
louis-bompart May 30, 2024
424fa09
pull
louis-bompart May 30, 2024
58473ff
formatting
louis-bompart May 30, 2024
6a5fee7
oops
louis-bompart May 30, 2024
99f977a
identifier
louis-bompart May 30, 2024
03cd4f0
cleanup
louis-bompart May 30, 2024
e4dbfee
trim
louis-bompart May 30, 2024
4b136b0
trim
louis-bompart May 30, 2024
9bbe713
clean-up wf
louis-bompart May 30, 2024
17ce5c5
switch-if-else
louis-bompart May 30, 2024
f74e690
checkout->guess
louis-bompart May 30, 2024
bdab5aa
Merge branch 'master' into pr-artifacts
louis-bompart May 30, 2024
ac23193
if-pr-only
louis-bompart May 30, 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
58 changes: 58 additions & 0 deletions .github/actions/publish-pr-review-site/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: 'Publish PR review site'
description: Publish PR review stuff

inputs:
token:
description: 'GitHub token'
required: true
copy:
description: 'Files to copy'

runs:
using: composite
steps:
- uses: actions/checkout@v4
with:
repository: coveo/ui-kit-prs
path: prs
sparse-checkout: '${{ github.event.pull_request.number }}'
token: ${{inputs.token}}
- name: 'Setup branch'
run: |
if [[ -z $(git ls-remote --heads origin refs/heads/${{github.event.pull_request.number}} | tr -s '[:blank:]') ]]; then
git switch -c "${{github.event.pull_request.number}}"
else
git fetch origin "refs/heads/${{github.event.pull_request.number}}"
git switch "${{github.event.pull_request.number}}"
git pull
fi
working-directory: prs
shell: bash
- name: 'Ensure clean directory exists'
run: |
rm -rf "${{github.event.pull_request.number}}"
mkdir -p "${{github.event.pull_request.number}}"
working-directory: prs
shell: bash
- name: 'Copy files'
if: ${{inputs.copy}}
run: |
cp -R packages/atomic/dist-storybook prs/${{github.event.pull_request.number}}
shell: bash
- name: 'Commit/Push'
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git add "${{github.event.pull_request.number}}"
git commit -m "Add ${{github.sha}}"
git push --set-upstream origin ${{github.event.pull_request.number}}
working-directory: prs
shell: bash
- name: 'Open & put PR in merge queue'
run: |
gh pr new -f
gh pr merge
env:
GH_TOKEN: ${{inputs.token}}
working-directory: prs
shell: bash
13 changes: 13 additions & 0 deletions .github/workflows/delete-pr-artifact-on-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: 'Delete PR artifact on merge'
on:
pull_request:
types: [closed]
jobs:
delete:
environment: PR Artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/publish-pr-review-site
with:
token: ${{ secrets.GH_PUBLISH_TOKEN }}
6 changes: 6 additions & 0 deletions .github/workflows/prbot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ jobs:
build:
name: 'Build'
runs-on: ubuntu-latest
environment: PR Artifacts
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- uses: ./.github/actions/build
- uses: ./.github/actions/commit-generated-files
- uses: ./.github/actions/publish-pr-review-site
if: github.event_name == 'pull_request'
with:
token: ${{ secrets.GH_PUBLISH_TOKEN }}
copy: true
lint-check:
name: 'Check with linter'
needs: build
Expand Down
12 changes: 5 additions & 7 deletions scripts/reports/bundle-size/report.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ function buildVisualReport(rows) {

const rowsWithColumnsConcatenated = rows.map((row) => '|' + row.join('|'));
const presentableRows = rowsWithColumnsConcatenated.join('\n');
const tableHead = `
| File | Old (kb) | New (kb) | Change (%)
| ---- |:--------:|:--------:|:------:`;

return `
**Bundle Size**

| File | Old (kb) | New (kb) | Change (%)
| ---- |:--------:|:--------:|:------:
${presentableRows}
`;
const table = [tableHead, presentableRows].join('\n');
return ['## Bundle Size', table].join('\n\n');
}

export function buildReport(oldSizes, newSizes) {
Expand Down
7 changes: 7 additions & 0 deletions scripts/reports/live-examples/live-examples.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {context} from '@actions/github';

export const buildLiveExampleReport = async () =>
[
'## Live demo links',
`* [Storybook](https://coveo.github.io/ui-kit-prs/${context.payload.pull_request.number}/dist-storybook/)`,
].join('\n\n');
31 changes: 18 additions & 13 deletions scripts/reports/pr-report.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import {
updatePullRequestComment,
createPullRequestComment,
} from './github-client.mjs';
import {buildLiveExampleReport} from './live-examples/live-examples.mjs';
import {buildSSRProgressReport} from './ssr-progress/ssr-progress.mjs';
import {buildTitleReport} from './title/verify-title.mjs';

const reportTitle = 'Pull Request Report';
const reportCommentIdentifier = '<!-- pr-report -->';

const reportTitle = '# Pull Request Report';

async function main() {
const report = await buildReport();
Expand All @@ -16,18 +19,18 @@ async function main() {

async function buildReport() {
const titleFormatReport = await buildTitleReport();
const ssrProgress = await buildSSRProgressReport();
const liveExamplesReport = await buildLiveExampleReport();
const bundleSizeReport = await buildBundleSizeReport();
const ssrProgress = await buildSSRProgressReport();

return `
**${reportTitle}**

${titleFormatReport}

${bundleSizeReport}

${ssrProgress}
`;
return [
reportTitle,
titleFormatReport,
liveExamplesReport,
bundleSizeReport,
ssrProgress,
reportCommentIdentifier,
].join('\n\n');
}

async function sendReport(report) {
Expand All @@ -39,9 +42,11 @@ async function sendReport(report) {
? updatePullRequestComment(comment.id, report)
: createPullRequestComment(report);
}

''.en;
function findBundleSizeComment(comments) {
return comments.find((comment) => comment.body.indexOf(reportTitle) !== -1);
return comments.find((comment) =>
comment.body.endsWith(reportCommentIdentifier)
);
}

main();
21 changes: 10 additions & 11 deletions scripts/reports/ssr-progress/ssr-progress.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,16 @@ function buildVisualReport(rows, logs) {
return `<b>${useCase}</b> : ${controller}<br>`;
});
const printableLogs = logsFormatted.join(' ');
return `
**SSR Progress**

| Use case | SSR (#) | CSR (#) | Progress (%)
| ---- |:--------:|:--------:|:------:
${printableRows}
<details>
<summary>Detailed logs</summary>
${printableLogs}
</details>
`;
const tableHeader = `
| Use case | SSR (#) | CSR (#) | Progress (%)
| ---- |:--------:|:--------:|:------:`;
const detailedLogs = `
<details>
<summary>Detailed logs</summary>
${printableLogs}
</details>`;
const message = [tableHeader, printableRows, detailedLogs].join('\n');
return ['## SSR Progress', message].join('\n\n');
}

export async function buildSSRProgressReport() {
Expand Down
23 changes: 6 additions & 17 deletions scripts/reports/title/verify-title.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,18 @@ async function getLinterConfiguration() {
function buildReport(isTitleValid) {
const message = isTitleValid ? buildSuccessMessage() : buildErrorMessage();

return `
**PR Title**

${message}
`;
return ['## PR Title', message].join('\n\n');
}

function buildSuccessMessage() {
return `
:white_check_mark: Title follows the [conventional commit](${specUrl}) spec.
`;
return `:white_check_mark: Title follows the [conventional commit](${specUrl}) spec.`;
}

function buildErrorMessage() {
return `
:x: Title should follow the [conventional commit](${specUrl}) spec:

<type>(optional scope): <description>

Example:

feat(headless): add result-list controller
`;
return `:x: Title should follow the [conventional commit](${specUrl}) spec:
\`<type>(optional scope): <description>\`

Example: \`feat(headless): add result-list controller\``;
}

export async function buildTitleReport() {
Expand Down
Loading