Analyze #294
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# After a build completes, this workflow analyzes the artifacts and reports back in a comment | |
name: Analyze | |
on: | |
workflow_run: | |
workflows: ["Build"] | |
types: | |
- completed | |
jobs: | |
check-size: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }} | |
timeout-minutes: 20 | |
steps: | |
# report status back to pull request | |
- uses: haya14busa/action-workflow_run-status@v1 | |
- uses: actions/checkout@v2 | |
- name: Use Node.js 16 x64 | |
uses: actions/setup-node@v2-beta | |
with: | |
node-version: 16 | |
architecture: x64 | |
- run: npm ci | |
- name: Download branch artifact | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
workflow: ${{ github.event.workflow_run.workflow_id }} | |
name: dist | |
path: after | |
repo: maplibre/maplibre-gl-js | |
- name: Download branch build info | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
workflow: ${{ github.event.workflow_run.workflow_id }} | |
name: build-info | |
path: build-info | |
repo: maplibre/maplibre-gl-js | |
- name: Get build info | |
id: build_info | |
run: | | |
echo "::set-output name=pr_number::$(cat build-info/pull_request_number)" | |
echo "::set-output name=base_sha::$(cat build-info/base_sha)" | |
- name: Download base artifact | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
workflow: build.yml | |
commit: ${{ steps.build_info.outputs.base_sha }} | |
name: dist | |
path: before | |
repo: maplibre/maplibre-gl-js | |
- run: npx source-map-explorer before/maplibre-gl.js --gzip --json before.json | |
- run: npx source-map-explorer after/maplibre-gl.js --gzip --json after.json | |
- name: Build bundle size report | |
run: node build/check-bundle-size.js > comment-body.txt | |
- name: Dump bundle size report | |
run: cat comment-body.txt | |
- uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
path: comment-body.txt | |
header: bundle-size-report | |
number: ${{ steps.build_info.outputs.pr_number }} |