8
8
- master
9
9
jobs :
10
10
build :
11
+ if : github.event_name == 'pull_request'
11
12
runs-on : ${{ matrix.config.os }}
12
13
strategy :
13
14
fail-fast : false
14
15
matrix :
15
16
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'}
17
18
18
19
env :
19
20
R_REMOTES_NO_ERRORS_FROM_WARNINGS : true
@@ -29,29 +30,26 @@ jobs:
29
30
git config --local user.name "GitHub Actions"
30
31
git config --local user.email "[email protected] "
31
32
- name : Ensure base branch is fetched
32
- if : ${{ github.event_name == 'pull_request' }}
33
33
run : |
34
34
git checkout -b $GITHUB_HEAD_REF
35
35
git branch $GITHUB_BASE_REF remotes/origin/$GITHUB_BASE_REF
36
36
- name : Setup R
37
- if : ${{ github.event_name == 'pull_request' }}
38
37
uses : r-lib/actions/setup-r@master
39
38
- name : Query dependencies
40
- if : ${{ github.event_name == 'pull_request' }}
41
39
run : |
42
40
install.packages('remotes')
43
41
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
44
42
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
45
43
shell : Rscript {0}
46
44
- name : Cache R packages
47
- if : ${{ github.event_name == 'pull_request' }} && runner.os != 'Windows'
45
+ if : runner.os != 'Windows'
48
46
uses : actions/cache@v1
49
47
with :
50
48
path : ${{ env.R_LIBS_USER }}
51
49
key : ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-3-${{ hashFiles('.github/depends.Rds') }}
52
50
restore-keys : ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-3-
53
51
- name : Install system dependencies
54
- if : ${{ github.event_name == 'pull_request' }} && runner.os == 'Linux'
52
+ if : runner.os == 'Linux'
55
53
env :
56
54
RHUB_PLATFORM : linux-x86_64-ubuntu-gcc
57
55
run : |
@@ -60,42 +58,34 @@ jobs:
60
58
sudo -s eval "$sysreqs"
61
59
sudo apt-get install libcurl4-openssl-dev libgit2-dev
62
60
- name : Install dependencies
63
- if : ${{ github.event_name == 'pull_request' }}
64
61
run : |
65
62
Rscript -e "install.packages(c('ggplot2', 'purrr'))" -e "remotes::install_deps(dependencies = TRUE); remotes::install_github(c('r-lib/bench', 'lorenzwalthert/touchstone')); "
66
63
R CMD INSTALL .
67
64
- name : Checkout benchmarking repo
68
- if : ${{ github.event_name == 'pull_request' }}
69
65
uses : actions/checkout@v2
70
66
with :
71
67
repository : lorenzwalthert/here
72
68
ref : ca9c8e69c727def88d8ba1c8b85b0e0bcea87b3f
73
69
path : touchstone/sources/here
74
70
- name : Prepare PR comment
75
- if : ${{ github.event_name == 'pull_request' }}
76
71
run : |
77
72
mkdir -p touchstone/sources
78
73
mkdir -p touchstone/pr-comment
79
74
mkdir -p touchstone/plots
80
75
echo "Here is how the current PR would change benchmark results when merged into $GITHUB_BASE_REF:" > touchstone/pr-comment/info.txt
81
76
echo "$GITHUB_EVENT_PULL_REQUEST_HEAD_SHA" >> touchstone/pr-comment/info.txt
82
77
- name : Run benchmarks
83
- if : ${{ github.event_name == 'pull_request' }}
84
78
run : Rscript 'touchstone/script.R'
85
79
- uses : actions/upload-artifact@v2
86
- if : ${{ github.event_name == 'pull_request' }}
87
80
with :
88
81
name : visual-benchmarks
89
82
path : touchstone/plots/
90
83
- uses : actions/upload-artifact@v1
91
- if : ${{ github.event_name == 'pull_request' }}
92
84
with :
93
85
name : results
94
86
path : touchstone/pr-comment
95
87
- uses : actions/download-artifact@v1
96
- if : ${{ github.event_name == 'pull_request' }}
97
88
with :
98
89
name : results
99
90
- name : comment PR
100
- if : ${{ github.event_name == 'pull_request' }}
101
91
run : cat touchstone/pr-comment/info.txt
0 commit comments