From 0dc63357fa166afa2b45a47f8ce284c7fc0d4ef4 Mon Sep 17 00:00:00 2001 From: Chip Morningstar Date: Tue, 3 Nov 2020 16:41:04 -0800 Subject: [PATCH] feat: add GitHub action to run post-CI benchmark --- .github/workflows/test-all-packages.yml | 32 +++++++++++++++++++ packages/swingset-runner/autobench | 2 +- .../demo/exchangeBenchmark/bootstrap.js | 1 - packages/swingset-runner/package.json | 3 +- 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-all-packages.yml b/.github/workflows/test-all-packages.yml index b27be75037b..0035f1ac96a 100644 --- a/.github/workflows/test-all-packages.yml +++ b/.github/workflows/test-all-packages.yml @@ -78,6 +78,38 @@ jobs: - name: lint check run: yarn lint-check + benchmark: + needs: build + runs-on: ubuntu-latest + strategy: + matrix: + node-version: ['14.x'] + steps: + - uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + # BEGIN-RESTORE-BOILERPLATE + - name: restore built files + id: built + uses: actions/cache@v1 + with: + path: . + key: ${{ runner.os }}-${{ matrix.node-version }}-built-${{ github.sha }} + - uses: actions/checkout@v1 + with: + submodules: 'true' + if: steps.built.outputs.cache-hit != 'true' + - name: yarn install + run: yarn install + if: steps.built.outputs.cache-hit != 'true' + - name: yarn build + run: yarn build + if: steps.built.outputs.cache-hit != 'true' + # END-RESTORE-BOILERPLATE + + - name: benchmark changes + run: cd packages/swingset-runner && yarn ci:autobench + ################## # Fast-running tests run as a group: test-quick: diff --git a/packages/swingset-runner/autobench b/packages/swingset-runner/autobench index 743f1b52974..97149044db0 100755 --- a/packages/swingset-runner/autobench +++ b/packages/swingset-runner/autobench @@ -1,2 +1,2 @@ #!/bin/sh -bin/runner --init --benchmark 100 --statsfile benchstats.json --config demo/exchangeBenchmark/swingset.json run -- --quiet --prime +node --expose-gc -r esm bin/runner --init --benchmark 100 --statsfile benchstats.json --config demo/exchangeBenchmark/swingset.json run -- --quiet --prime diff --git a/packages/swingset-runner/demo/exchangeBenchmark/bootstrap.js b/packages/swingset-runner/demo/exchangeBenchmark/bootstrap.js index 9d9dfd5b629..58517ad747c 100644 --- a/packages/swingset-runner/demo/exchangeBenchmark/bootstrap.js +++ b/packages/swingset-runner/demo/exchangeBenchmark/bootstrap.js @@ -13,7 +13,6 @@ export function buildRootObject(_vatPowers, vatParameters) { return harden({ async bootstrap(vats, devices) { let primeContracts = false; - console.log(`@@ params = ${JSON.stringify(vatParameters)}`); for (const arg of vatParameters.argv) { if (arg === '--prime') { primeContracts = true; diff --git a/packages/swingset-runner/package.json b/packages/swingset-runner/package.json index bff6af9c416..55da87e0673 100644 --- a/packages/swingset-runner/package.json +++ b/packages/swingset-runner/package.json @@ -15,7 +15,8 @@ "test": "ava", "test:nyc": "nyc ava", "lint-fix": "eslint --fix '**/*.js'", - "lint-check": "eslint '**/*.js'" + "lint-check": "eslint '**/*.js'", + "ci:autobench": "./autobench" }, "dependencies": { "@agoric/assert": "^0.2.0",