Skip to content

Commit 40fc53d

Browse files
skip benchmarking when not PR
1 parent 39e901f commit 40fc53d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

.github/workflows/benchmarking.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,25 @@ jobs:
3434
git checkout -b $GITHUB_HEAD_REF
3535
git branch $GITHUB_BASE_REF remotes/origin/$GITHUB_BASE_REF
3636
- name: Setup R
37+
if: ${{ github.event_name == 'pull_request' }}
3738
uses: r-lib/actions/setup-r@master
3839
- name: Query dependencies
40+
if: ${{ github.event_name == 'pull_request' }}
3941
run: |
4042
install.packages('remotes')
4143
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
4244
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
4345
shell: Rscript {0}
4446
- name: Cache R packages
47+
if: ${{ github.event_name == 'pull_request' }}
4548
if: runner.os != 'Windows'
4649
uses: actions/cache@v1
4750
with:
4851
path: ${{ env.R_LIBS_USER }}
4952
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-3-${{ hashFiles('.github/depends.Rds') }}
5053
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-3-
5154
- name: Install system dependencies
55+
if: ${{ github.event_name == 'pull_request' }}
5256
if: runner.os == 'Linux'
5357
env:
5458
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
@@ -58,34 +62,42 @@ jobs:
5862
sudo -s eval "$sysreqs"
5963
sudo apt-get install libcurl4-openssl-dev libgit2-dev
6064
- name: Install dependencies
65+
if: ${{ github.event_name == 'pull_request' }}
6166
run: |
6267
Rscript -e "install.packages(c('ggplot2', 'purrr'))" -e "remotes::install_deps(dependencies = TRUE); remotes::install_github(c('r-lib/bench', 'lorenzwalthert/touchstone')); "
6368
R CMD INSTALL .
6469
- name: Checkout benchmarking repo
70+
if: ${{ github.event_name == 'pull_request' }}
6571
uses: actions/checkout@v2
6672
with:
6773
repository: lorenzwalthert/here
6874
ref: ca9c8e69c727def88d8ba1c8b85b0e0bcea87b3f
6975
path: touchstone/sources/here
7076
- name: Prepare PR comment
77+
if: ${{ github.event_name == 'pull_request' }}
7178
run: |
7279
mkdir -p touchstone/sources
7380
mkdir -p touchstone/pr-comment
7481
mkdir -p touchstone/plots
7582
echo "Here is how the current PR would change benchmark results when merged into $GITHUB_BASE_REF:" > touchstone/pr-comment/info.txt
7683
echo "$GITHUB_EVENT_PULL_REQUEST_HEAD_SHA" >> touchstone/pr-comment/info.txt
7784
- name: Run benchmarks
85+
if: ${{ github.event_name == 'pull_request' }}
7886
run: Rscript 'touchstone/script.R'
7987
- uses: actions/upload-artifact@v2
88+
if: ${{ github.event_name == 'pull_request' }}
8089
with:
8190
name: visual-benchmarks
8291
path: touchstone/plots/
8392
- uses: actions/upload-artifact@v1
93+
if: ${{ github.event_name == 'pull_request' }}
8494
with:
8595
name: results
8696
path: touchstone/pr-comment
8797
- uses: actions/download-artifact@v1
98+
if: ${{ github.event_name == 'pull_request' }}
8899
with:
89100
name: results
90101
- name: comment PR
102+
if: ${{ github.event_name == 'pull_request' }}
91103
run: cat touchstone/pr-comment/info.txt

0 commit comments

Comments
 (0)