Skip to content

Commit

Permalink
Merge branch 'main' of github.com:db-ui/mono into fix-autofocus-drawer
Browse files Browse the repository at this point in the history
  • Loading branch information
nmerget committed Jul 24, 2024
2 parents e80121a + b6ed7a4 commit c71dba3
Show file tree
Hide file tree
Showing 470 changed files with 14,810 additions and 10,766 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
/showcases/nuxt-showcase/**
build-outputs/
build-showcases/
/output/vue/scripts/fix-any-types.ts
2 changes: 1 addition & 1 deletion .github/actions/extract-branch/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ runs:
using: "composite"
steps:
- name: ⏬ Get branch name
uses: actions/github-script@v6
uses: actions/github-script@v7
id: get-branch-name
with:
result-encoding: string
Expand Down
6 changes: 6 additions & 0 deletions .github/actions/npm-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ runs:
restore-keys: |
${{ runner.os }}-node-${{ inputs.nodeVersion }}
- name: 🎄🎸🥊 Log Cache Hit
shell: bash
env:
HIT: ${{ steps.cache.outputs.cache-hit }}
run: echo $HIT

- name: ⏬ NPM ci
shell: bash
if: steps.cache.outputs.cache-hit != 'true'
Expand Down
44 changes: 44 additions & 0 deletions .github/actions/playwright-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: "Playwright Cache Action"
description: "Initialize Playwright Cache"
inputs:
version:
description: "Playwright version"
required: false
runs:
using: "composite"
steps:
- name: 🆙 Set env for os
shell: bash
env:
OS: ${{ runner.os }}
run: |
if [[ $OS == "Windows" ]]; then
echo "CACHE_PATH=C:\Users\runneradmin\AppData\Local\ms-playwright" >> "$GITHUB_ENV"
echo "BROWSERS=chromium firefox" >> "$GITHUB_ENV"
echo "OS=windows" >> "$GITHUB_ENV"
else
echo "CACHE_PATH=~/Library/Caches/ms-playwright" >> "$GITHUB_ENV"
echo "BROWSERS=webkit chromium firefox" >> "$GITHUB_ENV"
echo "OS=macos" >> "$GITHUB_ENV"
fi
- name: 🆒 Cache Playwright binaries
uses: actions/cache@v4
id: playwright-cache
with:
path: ${{ env.CACHE_PATH }}
key: "${{ runner.os }}-playwright-${{ inputs.version }}"
restore-keys: |
${{ runner.os }}-playwright-
- name: 🎄🎸🥊 Log Cache Hit
shell: bash
env:
HIT: ${{ steps.playwright-cache.outputs.cache-hit }}
run: echo $HIT

- name: ⏬ Install Playwright's dependencies
shell: bash
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx --no -- playwright install --with-deps ${{ env.BROWSERS }}
97 changes: 97 additions & 0 deletions .github/workflows/01-build-patternhub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
name: Build Patternhub

on:
workflow_call:
inputs:
release:
required: false
default: "false"
type: string
preRelease:
required: false
default: "false"
type: string

jobs:
build-patternhub:
name: Build Patternhub
runs-on: ubuntu-latest
steps:
- name: ⏬ Checkout repo
uses: actions/checkout@v4

- name: 🔄 Init Cache
uses: ./.github/actions/npm-cache

- name: ⏬ Download foundations build
uses: actions/download-artifact@v4
with:
name: db-ui-foundations-build
path: packages/foundations/build

- name: ⏬ Download output
uses: actions/download-artifact@v4
with:
name: db-ui-output
path: output

- name: ⏬ Download components build
uses: actions/download-artifact@v4
with:
name: db-ui-components-build
path: packages/components/build

- name: ↔ Extract branch name
uses: ./.github/actions/extract-branch
id: extract_branch

- name: ↔ Extract branch/tag name
shell: bash
env:
RELEASE: ${{ inputs.release }}
PRE_RELEASE: ${{ inputs.preRelease }}
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch-name }}
run: |
if [[ $RELEASE == "true" || $PRE_RELEASE == "true" ]]
then
echo "name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
else
echo "name=${BRANCH_NAME}" >> $GITHUB_OUTPUT
fi
id: extract

- name: 🛤 Get base path
uses: actions/github-script@v7
env:
NAME: ${{ steps.extract.outputs.name }}
RELEASE: ${{ inputs.release }}
PRE_RELEASE: ${{ inputs.preRelease }}
id: base-path
with:
result-encoding: string
script: |
var path = 'review';
if(process.env.RELEASE === "true" || process.env.PRE_RELEASE === "true") {
path = 'version'
}
return `/${context?.payload?.repository?.name}/${path}/${process.env.NAME}`
- name: 🔨 Build Patternhub
env:
NEXT_PUBLIC_BASE_PATH: ${{ steps.base-path.outputs.result }}
run: |
npx --no tsx scripts/md-resolve-svg.ts
npm run build --workspace=patternhub
- name: ⏫ Upload Patternhub
uses: actions/upload-artifact@v4
with:
name: db-ui-patternhub
path: build-showcases/patternhub

- name: 💀 Killing me softly
uses: ./.github/actions/cancel-workflow
if: failure()
with:
token: ${{ secrets.GITHUB_TOKEN }}
60 changes: 8 additions & 52 deletions .github/workflows/01-build-showcases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@ name: Build Showcases
on:
workflow_call:
inputs:
release:
required: false
default: "false"
type: string
preRelease:
required: false
default: "false"
showcase:
required: true
type: string

jobs:
build-showcases:
name: Build Showcases
name: Build Showcase ${{ inputs.showcase }}
runs-on: ubuntu-latest
steps:
- name: ⏬ Checkout repo
Expand All @@ -42,53 +37,14 @@ jobs:
name: db-ui-components-build
path: packages/components/build

- name: ↔ Extract branch name
uses: ./.github/actions/extract-branch
id: extract_branch

- name: ↔ Extract branch/tag name
shell: bash
env:
RELEASE: ${{ inputs.release }}
PRE_RELEASE: ${{ inputs.preRelease }}
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch-name }}
run: |
if [[ $RELEASE == "true" || $PRE_RELEASE == "true" ]]
then
echo "name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
else
echo "name=${BRANCH_NAME}" >> $GITHUB_OUTPUT
fi
id: extract

- name: 🛤 Get base path
uses: actions/github-script@v7
env:
NAME: ${{ steps.extract.outputs.name }}
RELEASE: ${{ inputs.release }}
PRE_RELEASE: ${{ inputs.preRelease }}
id: base-path
with:
result-encoding: string
script: |
var path = 'review';
if(process.env.RELEASE === "true" || process.env.PRE_RELEASE === "true") {
path = 'version'
}
return `/${context?.payload?.repository?.name}/${path}/${process.env.NAME}`
- name: 🔨 Build Showcases
env:
NEXT_PUBLIC_BASE_PATH: ${{ steps.base-path.outputs.result }}
run: |
node scripts/md-resolve-svg.js
npm run build-showcases
- name: 🔨 Build ${{ inputs.showcase }}
run: npm run build --workspace=${{ inputs.showcase }}

- name: ⏫ Upload Showcases
- name: ⏫ Upload ${{ inputs.showcase }}
uses: actions/upload-artifact@v4
with:
name: db-ui-showcases
path: build-showcases
name: db-ui-${{ inputs.showcase }}
path: build-showcases/${{ inputs.showcase }}

- name: 💀 Killing me softly
uses: ./.github/actions/cancel-workflow
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/01-init-playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 🎭 Init Playwright

on:
workflow_call:
inputs:
version:
required: true
type: string

jobs:
init-playwright:
name: 🎭 Init Playwright - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13, windows-2022]
steps:
- name: ⏬ Checkout repo
uses: actions/checkout@v4

- name: 🔄 Init Cache Default
uses: ./.github/actions/npm-cache

- name: 🔄 Init Playwright Cache
uses: ./.github/actions/playwright-cache
with:
version: ${{ inputs.version }}
62 changes: 53 additions & 9 deletions .github/workflows/02-e2e-regenerate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ on:
version:
required: true
type: string
type:
required: true
type: string

permissions:
actions: write
contents: write

jobs:
regenerate-snapshots:
name: 🧪🎭 - Regenerate snapshots
name: 🧪🎭 - Regenerate snapshots ${{ inputs.type }}
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v${{ inputs.version }}
Expand Down Expand Up @@ -46,22 +49,63 @@ jobs:
path: packages/components/build

- name: ⏬ Download showcases
if: inputs.type == 'showcases'
uses: actions/download-artifact@v4
with:
name: db-ui-react-showcase
path: build-showcases/react-showcase

- name: ⏬ Download patternhub
if: inputs.type == 'patternhub'
uses: actions/download-artifact@v4
with:
name: db-ui-showcases
path: build-showcases
name: db-ui-patternhub
path: build-showcases/patternhub

- name: 👩‍🔬 Generate snapshots 🎭
shell: bash
env:
HOME: /root
TYPE: ${{ inputs.type }}
run: |
npm run regenerate:screenshots --workspace=@db-ui/react-components
npm run regenerate:screenshots --workspace=@db-ui/foundations
npm run regenerate:screenshots --workspace=react-showcase
if [[ $TYPE == "components" ]]; then
npm run regenerate:screenshots --workspace=@db-ui/react-components
elif [[ $TYPE == "foundations" ]]; then
npm run regenerate:screenshots --workspace=@db-ui/foundations
elif [[ $TYPE == "patternhub" ]]; then
npm run regenerate:screenshots --workspace=patternhub
else
npm run regenerate:screenshots --workspace=react-showcase
fi
- name: 🆙 Upload components
if: inputs.type == 'components'
uses: actions/upload-artifact@v4
with:
name: snapshots-${{ inputs.type }}
path: ./__snapshots__/*/component
retention-days: 30

- name: 🆙 Upload foundations
if: inputs.type == 'foundations'
uses: actions/upload-artifact@v4
with:
name: snapshots-${{ inputs.type }}
path: ./__snapshots__/foundations
retention-days: 30

- name: 🆙 Upload patternhub
if: inputs.type == 'patternhub'
uses: actions/upload-artifact@v4
with:
name: snapshots-${{ inputs.type }}
path: ./__snapshots__/*/patternhub
retention-days: 30

- name: 🆙 Upload snapshots
- name: 🆙 Upload showcase
if: inputs.type == 'showcases'
uses: actions/upload-artifact@v4
with:
name: __snapshots__
path: ./__snapshots__
name: snapshots-${{ inputs.type }}
path: ./__snapshots__/*/showcase
retention-days: 30
Loading

0 comments on commit c71dba3

Please sign in to comment.