Skip to content

Commit

Permalink
ci: diff html reporter integration
Browse files Browse the repository at this point in the history
  • Loading branch information
LingyuCoder committed Nov 30, 2023
1 parent ebf1704 commit 093d52c
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 8 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/diff-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
## This file is just for test, should be delete before review

name: Diff Assets Test

on:
issue_comment:
types: [created]
push:
branches:
- "ci/diff-html-reporter"

jobs:
get-runner-labels:
name: Get Runner Labels
uses: ./.github/workflows/get-runner-labels.yml

build:
name: Build
needs: [get-runner-labels]
strategy:
fail-fast: false # Build and test everything so we can look at all the errors
matrix:
array:
- target: x86_64-unknown-linux-gnu # For Cloud IDE
runner: ${{ needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS }}
uses: ./.github/workflows/reusable-build.yml
with:
target: ${{ matrix.array.target }}
runner: ${{ matrix.array.runner }}
test: false

diff:
name: Diff Assets
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Branch
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Pnpm Cache
uses: ./.github/actions/pnpm-cache

- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts

- name: Build node packages
run: pnpm run build:js

- name: Move artifacts
run: node scripts/build-npm.cjs

- name: Build Viewer
run: pnpm run build:viewer

- name: Run Diff
run: node scripts/diff.cjs

- name: Upload Report
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.RSPACK_REPORT_ACCESS_TOKEN }}
with:
source_file: 'diff_output'
destination_repo: 'web-infra-dev/rspack-report-website'
destination_folder: 'diff/$GITHUB_RUN_ID'
user_email: '[email protected]'
user_name: 'LingyuCoder'
commit_message: 'Auto upload diff report'

- name: Write a new comment
uses: peter-evans/create-or-update-comment@v3
continue-on-error: true
with:
issue-number: ${{ github.event.issue.number }}
body-path: 'diff_output/stats.md'
18 changes: 10 additions & 8 deletions .github/workflows/diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
name: Diff Assets

on:
workflow_dispatch:
issue_comment:
types: [created]

Expand Down Expand Up @@ -60,14 +59,17 @@ jobs:
- name: Run Diff
run: node scripts/diff.cjs

- name: Upload Diff Report
id: upload-artifact
uses: ./.github/actions/upload-artifact
- name: Upload Report
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.RSPACK_REPORT_ACCESS_TOKEN }}
with:
name: diff-report
path: diff_output
try-local-cache: false
mv-when-local: false
source_file: 'diff_output'
destination_repo: 'web-infra-dev/rspack-report-website'
destination_folder: 'diff/$GITHUB_RUN_ID'
user_email: '[email protected]'
user_name: 'LingyuCoder'
commit_message: 'Auto upload diff report'

- name: Write a new comment
uses: peter-evans/create-or-update-comment@v3
Expand Down

0 comments on commit 093d52c

Please sign in to comment.