gradio/.github/workflows/storybook-deploy.yml
pngwn f461b6ac52
more ci (#9004)
* asd

* asd

* asd

* asd

* asd

* asd

* asd

* asd

* asd

* asd
2024-08-05 19:01:52 +01:00

117 lines
4.1 KiB
YAML

name: "test / visual"
on:
workflow_run:
workflows: ["storybook-build"]
types:
- requested
concurrency:
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: changes
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
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: list artifacts
run: ls -R .
- 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}}/