Skip to content

Commit

Permalink
run size reports in parallel in CI (#3735)
Browse files Browse the repository at this point in the history
* run size reports in parallel

* fix unresolved promise bug

* set global env that can be used by all jobs
  • Loading branch information
Feiyang1 authored Sep 3, 2020
1 parent 1418474 commit 1a20aef
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
27 changes: 20 additions & 7 deletions .github/workflows/health-metrics-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ name: Health Metrics

on: [push, pull_request]

env:
METRICS_SERVICE_URL: ${{ secrets.METRICS_SERVICE_URL }}
GITHUB_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }}

jobs:
binary-size-test:
binary-size:
name: Binary Size
if: github.event_name == 'push' || !(github.event.pull_request.head.repo.fork)
runs-on: ubuntu-latest
env:
METRICS_SERVICE_URL: ${{ secrets.METRICS_SERVICE_URL }}
GITHUB_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
Expand All @@ -19,12 +20,24 @@ jobs:
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
service_account_key: ${{ secrets.GCP_SA_KEY }}
- run: cp config/ci.config.json config/project.json
- run: yarn install
- run: yarn build
- name: Run health-metrics/binary-size test
run: yarn size-report
modular-export-size:
name: Binary Size For Modular Exports
if: github.event_name == 'push' || !(github.event.pull_request.head.repo.fork)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 10.x
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
service_account_key: ${{ secrets.GCP_SA_KEY }}
- run: yarn install
- run: yarn build
- name: Run health-metrics/modular-exports-binary-size test
run: yarn modular-export-size-report

# TODO(yifany): Enable startup times testing on CI.
10 changes: 5 additions & 5 deletions scripts/size_report/report_binary_size.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ async function generateReportForNPMPackages(): Promise<Report[]> {
return reports;

function collectBinarySize(path: string) {
const promise = new Promise<void>(async resolve => {
const packageJsonPath = `${path}/package.json`;
if (!fs.existsSync(packageJsonPath)) {
return;
}
const packageJsonPath = `${path}/package.json`;
if (!fs.existsSync(packageJsonPath)) {
return;
}

const promise = new Promise<void>(async resolve => {
const packageJson = require(packageJsonPath);

for (const field of fields) {
Expand Down

0 comments on commit 1a20aef

Please sign in to comment.