Skip to content

Commit

Permalink
Merge branch 'main' into fix-2678-tag-default-html
Browse files Browse the repository at this point in the history
  • Loading branch information
nmerget authored Jul 5, 2024
2 parents e56d378 + 3b21780 commit c404071
Show file tree
Hide file tree
Showing 137 changed files with 2,776 additions and 893 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
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: |
npx --no tsx scripts/md-resolve-svg.ts
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
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
18 changes: 10 additions & 8 deletions .github/workflows/02-e2e-showcases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@ on:
version:
required: true
type: string
showcase:
required: true
type: string

permissions:
actions: write
contents: write

jobs:
playwright-showcases:
name: 🧪🎭 - ${{ matrix.framework }}:${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
name: 🧪🎭 - ${{ inputs.showcase }}:${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v${{ inputs.version }}
strategy:
fail-fast: false
matrix:
framework: [angular, react, vue]
shardIndex: [1, 2, 3, 4, 5]
shardTotal: [5]
steps:
Expand Down Expand Up @@ -51,17 +53,17 @@ jobs:
name: db-ui-components-build
path: packages/components/build

- name: ⏬ Download showcases
- name: ⏬ Download ${{ inputs.showcase }}
uses: actions/download-artifact@v4
with:
name: db-ui-showcases
path: build-showcases
name: db-ui-${{ inputs.showcase }}
path: build-showcases/${{ inputs.showcase }}

- name: 👩‍🔬 Test showcase with Playwright 🎭
env:
HOME: /root
run: |
npm run test:e2e --workspace=${{ matrix.framework }}-showcase -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
npm run test:e2e --workspace=${{ inputs.showcase }} -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
- name: 🔣 Print GitHub Report
if: failure()
Expand All @@ -73,6 +75,6 @@ jobs:
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.framework }}-showcase-playwright-results-${{ matrix.shardIndex }}
path: ./showcases/${{ matrix.framework }}-showcase/test-results
name: ${{ inputs.showcase }}-playwright-results-${{ matrix.shardIndex }}
path: ./showcases/${{ inputs.showcase }}/test-results
retention-days: 30
6 changes: 3 additions & 3 deletions .github/workflows/03-deploy-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:
- name: 🔄 Init Cache
uses: ./.github/actions/npm-cache

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

- name: 🦵🦿 I like to move it move it
shell: bash
Expand Down
Loading

0 comments on commit c404071

Please sign in to comment.