Skip to content

Commit

Permalink
gh/actions: run benchmark & diff-npm-package only on PRs (#3435)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov authored Dec 20, 2021
1 parent e2ebf04 commit 67e14cf
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,15 @@ jobs:
benchmark:
name: Run benchmark
runs-on: ubuntu-latest
env:
COMMITS_TO_TEST: ${{ github.event.pull_request.commits || 1 }}
if: github.event_name == 'pull_request'
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Deepen cloned repo
run: 'git fetch --deepen=$COMMITS_TO_TEST'
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: 'git fetch --depth=1 origin $BASE_SHA:refs/tags/BASE'

- name: Setup Node.js
uses: actions/setup-node@v2
Expand All @@ -179,19 +180,20 @@ jobs:
run: npm ci --ignore-scripts

- name: Run Benchmark
run: 'npm run benchmark -- --revs HEAD "HEAD~$COMMITS_TO_TEST"'
run: 'npm run benchmark -- --revs HEAD BASE'

diff-npm-package:
name: Diff content of NPM package
runs-on: ubuntu-latest
env:
COMMITS_TO_TEST: ${{ github.event.pull_request.commits || 1 }}
if: github.event_name == 'pull_request'
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Deepen cloned repo
run: 'git fetch --deepen=$COMMITS_TO_TEST'
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: 'git fetch --depth=1 origin $BASE_SHA:refs/tags/BASE'

- name: Setup Node.js
uses: actions/setup-node@v2
Expand All @@ -203,7 +205,7 @@ jobs:
run: npm ci --ignore-scripts

- name: Generate report
run: 'node resources/diff-npm-package.js HEAD~$COMMITS_TO_TEST HEAD'
run: 'node resources/diff-npm-package.js BASE HEAD'

- name: Upload generated report
uses: actions/upload-artifact@v2
Expand Down

0 comments on commit 67e14cf

Please sign in to comment.