1
+ name : Continuous Benchmarks
1
2
on :
2
3
push :
3
4
branches :
4
5
- master
5
6
pull_request :
6
7
branches :
7
8
- master
8
-
9
- name : Continuous Benchmarks
10
-
11
9
jobs :
12
10
build :
13
- runs-on : macOS-latest
11
+ runs-on : ${{ matrix.config.os }}
12
+ strategy :
13
+ fail-fast : false
14
+ matrix :
15
+ config :
16
+ - {os: ubuntu-18.04, r: '4.0.0', rspm: 'https://packagemanager.rstudio.com/all/__linux__/bionic/291'}
17
+
18
+ env :
19
+ R_REMOTES_NO_ERRORS_FROM_WARNINGS : true
20
+ RSPM : ${{ matrix.config.rspm }}
21
+ GITHUB_PAT : ${{ secrets.GITHUB_TOKEN }}
14
22
steps :
15
23
- name : Checkout repo
16
24
with :
17
25
fetch-depth : 0
18
26
uses : actions/checkout@master
27
+ - name : Set up git user
28
+ run : |
29
+ git config --local user.name "GitHub Actions"
30
+ git config --local user.email "[email protected] "
19
31
- name : Ensure base branch is fetched
20
32
if : ${{ github.event_name == 'pull_request' }}
21
33
run : git branch $GITHUB_BASE_REF remotes/origin/$GITHUB_BASE_REF; git branch
@@ -27,15 +39,22 @@ jobs:
27
39
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
28
40
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
29
41
shell : Rscript {0}
30
-
31
42
- name : Cache R packages
32
43
if : runner.os != 'Windows'
33
44
uses : actions/cache@v1
34
45
with :
35
46
path : ${{ env.R_LIBS_USER }}
36
- key : ${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
37
- restore-keys : ${{ hashFiles('.github/R-version') }}-1-
38
-
47
+ key : ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-3-${{ hashFiles('.github/depends.Rds') }}
48
+ restore-keys : ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-3-
49
+ - name : Install system dependencies
50
+ if : runner.os == 'Linux'
51
+ env :
52
+ RHUB_PLATFORM : linux-x86_64-ubuntu-gcc
53
+ run : |
54
+ Rscript -e "remotes::install_github('r-hub/sysreqs')"
55
+ sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
56
+ sudo -s eval "$sysreqs"
57
+ sudo apt-get install libcurl4-openssl-dev libgit2-dev
39
58
- name : Install dependencies
40
59
run : |
41
60
Rscript -e "install.packages(c('gert', 'ggplot2', 'purrr'))" -e "remotes::install_deps(dependencies = TRUE); remotes::install_github('r-lib/bench')"
48
67
path : bench/sources/here
49
68
- name : Fetch existing benchmarks
50
69
run : Rscript -e 'rlang::with_handlers(bench::cb_fetch(), error = function(e) paste("Could not fetch benchmarks, skipping. The error was", conditionMessage(e)))'
70
+ - name : Prepare PR comment
71
+ run : |
72
+ mkdir -p bench/pr-comment
73
+ echo 'Here is how the current PR would change benchmark results:\n' > bench/pr-comment/info.txt
51
74
- name : Run benchmarks
52
75
run : Rscript -e 'bench::cb_run()'
53
76
- name : Show benchmarks
59
82
- name : Push benchmarks
60
83
if : ${{ github.event_name == 'push' }}
61
84
run : Rscript -e "bench::cb_push()"
85
+ - uses : actions/upload-artifact@v1
86
+ with :
87
+ name : results
88
+ path : bench/pr-comment
89
+ - uses : actions/download-artifact@v1
90
+ with :
91
+ name : results
92
+ - name : comment PR
93
+ # uses: machine-learning-apps/pr-comment@master
94
+ run : cat bench/pr-comment/info.txt
0 commit comments