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

ci: added test results to ci preview #824

Closed
wants to merge 8 commits into from
Closed
Changes from all commits
Commits
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
35 changes: 31 additions & 4 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ jobs:
deploy-to-s3:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
Expand All @@ -19,6 +20,7 @@ jobs:
run_number: ${{ github.event.workflow_run.run_number }}
name: dist
path: dist

- name: Download pr number
uses: dawidd6/action-download-artifact@v2
with:
Expand All @@ -29,11 +31,13 @@ jobs:
run_number: ${{ github.event.workflow_run.run_number }}
name: pr_number
path: .

- name: Read PR number
id: read-pr
run: |
pr_number=$(cat pr_number)
echo "PR_NUMBER=${pr_number}" >> $GITHUB_ENV

- uses: shallwefootball/s3-upload-action@master
name: Upload preview to S3
if: always()
Expand All @@ -45,28 +49,51 @@ jobs:
aws_bucket: noam-gaash.co.il
source_dir: dist
destination_dir: ${{ github.event.workflow_run.id }}/open-bus/${{ github.event.workflow_run.run_number }}

- name: find comment
uses: peter-evans/find-comment@v1
uses: peter-evans/find-comment@v3
if: env.PR_NUMBER
id: fc
with:
issue-number: ${{ env.PR_NUMBER }}
comment-author: 'github-actions[bot]'
body-includes: 'Preview'

- name: find comment
uses: peter-evans/find-comment@v3
if: env.PR_NUMBER
id: fc-tr
with:
issue-number: ${{ env.PR_NUMBER }}
comment-author: 'github-actions[bot]'
body-includes: 'Test results'

- name: update comment
uses: peter-evans/create-or-update-comment@v1
uses: peter-evans/create-or-update-comment@v4
if: steps.fc.outputs.comment-id
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
body: |
Preview: https://s3.amazonaws.com/noam-gaash.co.il/${{ github.event.workflow_run.id }}/open-bus/${{ github.event.workflow_run.run_number }}/index.html
Preview Storybook: https://s3.amazonaws.com/noam-gaash.co.il/${{ github.event.workflow_run.id }}/open-bus/${{ github.event.workflow_run.run_number }}/storybook/index.html

- name: update comment
uses: peter-evans/create-or-update-comment@v4
if: steps.fc-tr.outputs.comment-id
with:
comment-id: ${{ steps.fc-tr.outputs.comment-id }}
edit-mode: append
body: |
Test results: https://s3.amazonaws.com/noam-gaash.co.il/${{ github.run_id }}/open-bus/${{ github.sha }}/test-results/index.html

- name: create comment
uses: peter-evans/create-or-update-comment@v1
uses: peter-evans/create-or-update-comment@v4
if: steps.fc.outputs.comment-id == ''
with:
issue-number: ${{ env.PR_NUMBER }}
body: |
Preview: https://s3.amazonaws.com/noam-gaash.co.il/${{ github.event.workflow_run.id }}/open-bus/${{ github.event.workflow_run.run_number }}/index.html
Preview Storybook: https://s3.amazonaws.com/noam-gaash.co.il/${{ github.event.workflow_run.id }}/open-bus/${{ github.event.workflow_run.run_number }}/storybook/index.html
Test results: https://s3.amazonaws.com/noam-gaash.co.il/${{ github.run_id }}/open-bus/${{ github.sha }}/test-results/index.html

Loading