Skip to content

Commit d3beb91

Browse files
run workflow only on PRs.
1 parent db90329 commit d3beb91

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

.github/workflows/benchmarking.yaml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ on:
88
- master
99
jobs:
1010
build:
11+
if: github.event_name == 'pull_request'
1112
runs-on: ${{ matrix.config.os }}
1213
strategy:
1314
fail-fast: false
1415
matrix:
1516
config:
16-
- {os: ubuntu-18.04, r: '4.0.0', rspm: 'https://packagemanager.rstudio.com/all/__linux__/bionic/291'}
17+
- {os: ubuntu-18.04, r: '4.0.0', rspm: 'https://packagemanager.rstudio.com/all/__linux__/bionic/291'}
1718

1819
env:
1920
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
@@ -29,29 +30,26 @@ jobs:
2930
git config --local user.name "GitHub Actions"
3031
git config --local user.email "[email protected]"
3132
- name: Ensure base branch is fetched
32-
if: ${{ github.event_name == 'pull_request' }}
3333
run: |
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' }}
3837
uses: r-lib/actions/setup-r@master
3938
- name: Query dependencies
40-
if: ${{ github.event_name == 'pull_request' }}
4139
run: |
4240
install.packages('remotes')
4341
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
4442
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
4543
shell: Rscript {0}
4644
- name: Cache R packages
47-
if: ${{ github.event_name == 'pull_request' }} && runner.os != 'Windows'
45+
if: runner.os != 'Windows'
4846
uses: actions/cache@v1
4947
with:
5048
path: ${{ env.R_LIBS_USER }}
5149
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-3-${{ hashFiles('.github/depends.Rds') }}
5250
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-3-
5351
- name: Install system dependencies
54-
if: ${{ github.event_name == 'pull_request' }} && runner.os == 'Linux'
52+
if: runner.os == 'Linux'
5553
env:
5654
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
5755
run: |
@@ -60,42 +58,34 @@ jobs:
6058
sudo -s eval "$sysreqs"
6159
sudo apt-get install libcurl4-openssl-dev libgit2-dev
6260
- name: Install dependencies
63-
if: ${{ github.event_name == 'pull_request' }}
6461
run: |
6562
Rscript -e "install.packages(c('ggplot2', 'purrr'))" -e "remotes::install_deps(dependencies = TRUE); remotes::install_github(c('r-lib/bench', 'lorenzwalthert/touchstone')); "
6663
R CMD INSTALL .
6764
- name: Checkout benchmarking repo
68-
if: ${{ github.event_name == 'pull_request' }}
6965
uses: actions/checkout@v2
7066
with:
7167
repository: lorenzwalthert/here
7268
ref: ca9c8e69c727def88d8ba1c8b85b0e0bcea87b3f
7369
path: touchstone/sources/here
7470
- name: Prepare PR comment
75-
if: ${{ github.event_name == 'pull_request' }}
7671
run: |
7772
mkdir -p touchstone/sources
7873
mkdir -p touchstone/pr-comment
7974
mkdir -p touchstone/plots
8075
echo "Here is how the current PR would change benchmark results when merged into $GITHUB_BASE_REF:" > touchstone/pr-comment/info.txt
8176
echo "$GITHUB_EVENT_PULL_REQUEST_HEAD_SHA" >> touchstone/pr-comment/info.txt
8277
- name: Run benchmarks
83-
if: ${{ github.event_name == 'pull_request' }}
8478
run: Rscript 'touchstone/script.R'
8579
- uses: actions/upload-artifact@v2
86-
if: ${{ github.event_name == 'pull_request' }}
8780
with:
8881
name: visual-benchmarks
8982
path: touchstone/plots/
9083
- uses: actions/upload-artifact@v1
91-
if: ${{ github.event_name == 'pull_request' }}
9284
with:
9385
name: results
9486
path: touchstone/pr-comment
9587
- uses: actions/download-artifact@v1
96-
if: ${{ github.event_name == 'pull_request' }}
9788
with:
9889
name: results
9990
- name: comment PR
100-
if: ${{ github.event_name == 'pull_request' }}
10191
run: cat touchstone/pr-comment/info.txt

0 commit comments

Comments
 (0)