Skip to content

Commit 1a20aef

Browse files
authored
run size reports in parallel in CI (firebase#3735)
* run size reports in parallel * fix unresolved promise bug * set global env that can be used by all jobs
1 parent 1418474 commit 1a20aef

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

.github/workflows/health-metrics-test.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ name: Health Metrics
22

33
on: [push, pull_request]
44

5+
env:
6+
METRICS_SERVICE_URL: ${{ secrets.METRICS_SERVICE_URL }}
7+
GITHUB_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
8+
GITHUB_PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }}
9+
510
jobs:
6-
binary-size-test:
11+
binary-size:
712
name: Binary Size
813
if: github.event_name == 'push' || !(github.event.pull_request.head.repo.fork)
914
runs-on: ubuntu-latest
10-
env:
11-
METRICS_SERVICE_URL: ${{ secrets.METRICS_SERVICE_URL }}
12-
GITHUB_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
13-
GITHUB_PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }}
1415
steps:
1516
- uses: actions/checkout@v2
1617
- uses: actions/setup-node@v1
@@ -19,12 +20,24 @@ jobs:
1920
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
2021
with:
2122
service_account_key: ${{ secrets.GCP_SA_KEY }}
22-
- run: cp config/ci.config.json config/project.json
2323
- run: yarn install
2424
- run: yarn build
2525
- name: Run health-metrics/binary-size test
2626
run: yarn size-report
27+
modular-export-size:
28+
name: Binary Size For Modular Exports
29+
if: github.event_name == 'push' || !(github.event.pull_request.head.repo.fork)
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v2
33+
- uses: actions/setup-node@v1
34+
with:
35+
node-version: 10.x
36+
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
37+
with:
38+
service_account_key: ${{ secrets.GCP_SA_KEY }}
39+
- run: yarn install
40+
- run: yarn build
2741
- name: Run health-metrics/modular-exports-binary-size test
2842
run: yarn modular-export-size-report
29-
3043
# TODO(yifany): Enable startup times testing on CI.

scripts/size_report/report_binary_size.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ async function generateReportForNPMPackages(): Promise<Report[]> {
9393
return reports;
9494

9595
function collectBinarySize(path: string) {
96-
const promise = new Promise<void>(async resolve => {
97-
const packageJsonPath = `${path}/package.json`;
98-
if (!fs.existsSync(packageJsonPath)) {
99-
return;
100-
}
96+
const packageJsonPath = `${path}/package.json`;
97+
if (!fs.existsSync(packageJsonPath)) {
98+
return;
99+
}
101100

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

104104
for (const field of fields) {

0 commit comments

Comments
 (0)