Skip to content

Commit ff51b7d

Browse files
add touchstone artifacts
1 parent 6d6131b commit ff51b7d

File tree

3 files changed

+41
-20
lines changed

3 files changed

+41
-20
lines changed

.github/workflows/benchmarking.yaml

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,20 @@ jobs:
2121
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
2222
steps:
2323
- name: Checkout repo
24-
with:
25-
fetch-depth: 0
26-
uses: actions/checkout@master
24+
uses: actions/checkout@v2
2725
- name: Set up git user
2826
run: |
2927
git config --local user.name "GitHub Actions"
3028
git config --local user.email "[email protected]"
3129
- name: Ensure base branch is fetched
3230
if: ${{ github.event_name == 'pull_request' }}
33-
run: git branch $GITHUB_BASE_REF remotes/origin/$GITHUB_BASE_REF; git branch
31+
uses: FranzDiebold/[email protected]
32+
run: |
33+
git checkout -b $GITHUB_REF_NAME
34+
echo "$GITHUB_REF_NAME" > github_ref_name
35+
echo "$GITHUB_REF_NAME"
36+
git branch $GITHUB_BASE_REF remotes/origin/$GITHUB_BASE_REF
37+
git branch
3438
- name: Setup R
3539
uses: r-lib/actions/setup-r@master
3640
- name: Query dependencies
@@ -57,39 +61,33 @@ jobs:
5761
sudo apt-get install libcurl4-openssl-dev libgit2-dev
5862
- name: Install dependencies
5963
run: |
60-
Rscript -e "install.packages(c('gert', 'ggplot2', 'purrr'))" -e "remotes::install_deps(dependencies = TRUE); remotes::install_github('r-lib/bench')"
64+
Rscript -e "install.packages(c('ggplot2', 'purrr'))" -e "remotes::install_deps(dependencies = TRUE); remotes::install_github(c('r-lib/bench', 'lorenzwalthert/touchstone')); "
6165
R CMD INSTALL .
6266
- name: Checkout benchmarking repo
6367
uses: actions/checkout@v2
6468
with:
6569
repository: lorenzwalthert/here
6670
ref: ca9c8e69c727def88d8ba1c8b85b0e0bcea87b3f
67-
path: bench/sources/here
68-
- name: Fetch existing benchmarks
69-
run: Rscript -e 'rlang::with_handlers(bench::cb_fetch(), error = function(e) paste("Could not fetch benchmarks, skipping. The error was", conditionMessage(e)))'
71+
path: touchstone/sources/here
7072
- name: Prepare PR comment
7173
run: |
72-
mkdir -p bench/pr-comment
73-
echo "Here is how the current PR would change benchmark results when merged into $GITHUB_BASE_REF:" > bench/pr-comment/info.txt
74-
echo "$GITHUB_EVENT_PULL_REQUEST_HEAD_SHA" >> bench/pr-comment/info.txt
74+
mkdir -p touchstone/sources
75+
mkdir -p touchstone/pr-comment
76+
echo "Here is how the current PR would change benchmark results when merged into $GITHUB_BASE_REF:" > touchstone/pr-comment/info.txt
77+
echo "$GITHUB_EVENT_PULL_REQUEST_HEAD_SHA" >> touchstone/pr-comment/info.txt
7578
- name: Run benchmarks
76-
run: Rscript -e 'bench::cb_run()'
77-
- name: Show benchmarks
78-
run: git notes --ref benchmarks show
79+
run: Rscript 'touchstone/script.R'
7980
- uses: actions/upload-artifact@v2
8081
with:
8182
name: visual-benchmarks
82-
path: bench/plots/
83-
- name: Push benchmarks
84-
if: ${{ github.event_name == 'push' }}
85-
run: Rscript -e "bench::cb_push()"
83+
path: touchstone/plots/
8684
- uses: actions/upload-artifact@v1
8785
with:
8886
name: results
89-
path: bench/pr-comment
87+
path: touchstone/pr-comment
9088
- uses: actions/download-artifact@v1
9189
with:
9290
name: results
9391
- name: comment PR
9492
#uses: machine-learning-apps/pr-comment@master
95-
run: cat bench/pr-comment/info.txt
93+
run: cat touchstone/pr-comment/info.txt

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ R/scratch
1111
revdep/
1212
!revdep/*.md
1313
!revdep/problems.md
14+
touchstone/*
15+
!touchstone/script.R

touchstone/script.R

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
touchstone:::touchstone_clear()
2+
warning(Sys.getenv("GITHUB_EVENT_PULL_REQUEST_HEAD_SHA"))
3+
4+
refs <- c(Sys.getenv("GITHUB_BASE_REF"), readLines("github_ref_name"))
5+
warning(refs)
6+
timings <- touchstone::benchmark_run_ref(
7+
refs,
8+
expr_before_benchmark = c("library(styler)", "cache_deactivate()"),
9+
expr_to_benchmark = 'style_pkg("touchstone/sources/here", filetype = c("R", "rmd"))',
10+
n = 1,
11+
)
12+
13+
timings <- touchstone::benchmark_read(refs)
14+
15+
library(ggplot2)
16+
library(magrittr)
17+
timings %>%
18+
ggplot(aes(x = elapsed, color = ref)) +
19+
geom_density()
20+
21+
ggsave("touchstone/plots/density.png")

0 commit comments

Comments
 (0)