Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh/actions: run benchmark & diff-npm-package only on PRs #3435

Merged
merged 1 commit into from
Dec 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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