gradio/.github/workflows/storybook-deploy.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

116 lines
4.1 KiB
YAML
Raw Normal View History

name: "test / visual"
on:
workflow_run:
workflows: ["storybook-build"]
types:
- requested
concurrency:
2024-02-01 18:24:15 +08:00
group: "${{ github.event.workflow_run.head_repository.full_name }}-${{ github.event.workflow_run.head_branch }}-${{ github.workflow_ref }}"
cancel-in-progress: true
jobs:
changes:
name: "changes"
runs-on: ubuntu-latest
permissions:
actions: read
outputs:
should_run: ${{ steps.json.outputs.should_run }}
sha: ${{ steps.json.outputs.sha }}
pr_number: ${{ steps.json.outputs.pr_number }}
source_branch: ${{ steps.json.outputs.source_branch }}
source_repo: ${{ steps.json.outputs.source_repo }}
labels: ${{ steps.json.outputs.labels }}
run_id: ${{ steps.json.outputs.run_id }}
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: artifact-dir
path: different_dir
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- uses: gradio-app/github/actions/json-to-output@main
id: json
with:
path: output.json
comment-chromatic-start:
uses: "./.github/workflows/comment-queue.yml"
needs: changes
if: ${{ needs.changes.outputs.should_run == 'true' }}
secrets:
gh_token: ${{ secrets.COMMENT_TOKEN }}
with:
pr_number: ${{ needs.changes.outputs.pr_number }}
message: |
storybook~pending~null
update-status:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.should_run == 'false' || github.repository == 'gradio-app/gradio' || contains(needs.changes.outputs.labels, 'no-visual-update') }}
steps:
- name: update status
uses: gradio-app/github/actions/set-commit-status@main
with:
sha: ${{ needs.changes.outputs.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
name: "storybook"
run_id: ${{ needs.changes.outputs.run_id }}
test-visual:
environment: storybook
2024-02-02 03:39:12 +08:00
name: "test-visual"
needs: changes
if: ${{ needs.changes.outputs.should_run == 'true' && github.repository == 'gradio-app/gradio' && !contains(needs.changes.outputs.labels, 'no-visual-update') }}
runs-on: ubuntu-latest
outputs:
changes: ${{ steps.publish-chromatic.outputs.changeCount }}
errors: ${{ steps.publish-chromatic.outputs.errorCount }}
storybook_url: ${{ steps.publish-chromatic.outputs.storybookUrl }}
build_url: ${{ steps.publish-chromatic.outputs.buildUrl }}
permissions:
actions: read
steps:
- name: dowload storybook artifacts
uses: actions/download-artifact@v4
with:
name: storybook-static
path: storybook-static
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: publish to chromatic
id: publish-chromatic
uses: chromaui/action@v11
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
token: ${{ secrets.COMMIT_STATUS }}
onlyChanged: true
exitOnceUploaded: true
storybookBuildDir: storybook-static
comment-chromatic-end:
uses: "./.github/workflows/comment-queue.yml"
needs: [test-visual, changes]
secrets:
gh_token: ${{ secrets.COMMENT_TOKEN }}
with:
pr_number: ${{ needs.changes.outputs.pr_number }}
message: |
storybook~success~${{ needs.test-visual.outputs.storybook_url }}
comment-chromatic-fail:
uses: "./.github/workflows/comment-queue.yml"
needs: [test-visual, changes]
if: always() && needs.test-visual.result == 'failure'
secrets:
gh_token: ${{ secrets.COMMENT_TOKEN }}
with:
pr_number: ${{ needs.changes.outputs.pr_number }}
message: |
storybook~failure~https://github.com/gradio-app/gradio/actions/runs/${{github.run_id}}/
# visual~success~${{ needs.chromatic-deployment.outputs.changes }}~${{ needs.chromatic-deployment.outputs.errors }}~${{ needs.chromatic-deployment.outputs.build_url }}
# visual~failure~0~0~https://github.com/gradio-app/gradio/actions/runs/${{github.run_id}}/