diff --git a/.github/workflows/health-metrics-test.yml b/.github/workflows/health-metrics-test.yml index 235d4d3db5e..2d95093e076 100644 --- a/.github/workflows/health-metrics-test.yml +++ b/.github/workflows/health-metrics-test.yml @@ -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 @@ -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. diff --git a/scripts/size_report/report_binary_size.ts b/scripts/size_report/report_binary_size.ts index 17d8f8da515..9f569a2ae91 100644 --- a/scripts/size_report/report_binary_size.ts +++ b/scripts/size_report/report_binary_size.ts @@ -93,12 +93,12 @@ async function generateReportForNPMPackages(): Promise { return reports; function collectBinarySize(path: string) { - const promise = new Promise(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(async resolve => { const packageJson = require(packageJsonPath); for (const field of fields) {