Skip to content

Commit 38af4ad

Browse files
use touchstone action
1 parent bfa8309 commit 38af4ad

File tree

2 files changed

+6
-117
lines changed

2 files changed

+6
-117
lines changed
Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
name: Continuous Benchmarks (Comment)
22

3-
concurrency:
4-
group: ${{ github.workflow }}-${{ github.head_ref }}
5-
cancel-in-progress: true
6-
73
# read-write repo token
84
# access to secrets
95
on:
@@ -19,38 +15,4 @@ jobs:
1915
${{ github.event.workflow_run.event == 'pull_request' &&
2016
github.event.workflow_run.conclusion == 'success' }}
2117
steps:
22-
- name: 'Download artifact'
23-
uses: actions/[email protected]
24-
with:
25-
script: |
26-
var artifacts = await github.actions.listWorkflowRunArtifacts({
27-
owner: context.repo.owner,
28-
repo: context.repo.repo,
29-
run_id: ${{github.event.workflow_run.id }},
30-
});
31-
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
32-
return artifact.name == "pr"
33-
})[0];
34-
var download = await github.actions.downloadArtifact({
35-
owner: context.repo.owner,
36-
repo: context.repo.repo,
37-
artifact_id: matchArtifact.id,
38-
archive_format: 'zip',
39-
});
40-
var fs = require('fs');
41-
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
42-
- run: unzip pr.zip
43-
- name: 'Comment on PR'
44-
uses: actions/github-script@v3
45-
with:
46-
github-token: ${{ secrets.GITHUB_TOKEN }}
47-
script: |
48-
var fs = require('fs');
49-
var issue_number = Number(fs.readFileSync('./NR'));
50-
var body = fs.readFileSync('./info.txt').toString();
51-
await github.issues.createComment({
52-
owner: context.repo.owner,
53-
repo: context.repo.repo,
54-
issue_number: issue_number,
55-
body: body
56-
});
18+
- uses: lorenzwalthert/touchstone/actions/comment@standalone-action
Lines changed: 5 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
name: Continuous Benchmarks (Receive)
2-
concurrency:
3-
group: ${{ github.workflow }}-${{ github.head_ref }}
4-
cancel-in-progress: true
5-
62
on: pull_request
73
jobs:
84
prepare:
@@ -37,78 +33,9 @@ jobs:
3733
RSPM: ${{ matrix.config.rspm }}
3834
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
3935
steps:
40-
- name: Checkout repo
41-
uses: actions/checkout@v2
42-
with:
43-
fetch-depth: 0
44-
- name: Set up git user
45-
run: |
46-
git config --local user.name "GitHub Actions"
47-
git config --local user.email "[email protected]"
48-
- name: Ensure base branch is fetched
49-
run: |
50-
git checkout -b $GITHUB_HEAD_REF # this is current ref. This is required for naming.
51-
git branch $GITHUB_BASE_REF remotes/origin/$GITHUB_BASE_REF
52-
- name: Setup R
53-
uses: r-lib/actions/setup-r@master
54-
- name: Query dependencies
55-
run: |
56-
install.packages('remotes')
57-
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
58-
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
59-
shell: Rscript {0}
60-
- name: Cache R packages
61-
if: runner.os != 'Windows'
62-
uses: actions/cache@v1
63-
with:
64-
path: ${{ env.R_LIBS_USER }}
65-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-3-${{ hashFiles('.github/depends.Rds') }}
66-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-3-
67-
- name: Install system dependencies
68-
if: runner.os == 'Linux'
69-
env:
70-
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
71-
run: |
72-
Rscript -e "remotes::install_github('r-hub/sysreqs')"
73-
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
74-
sudo -s eval "$sysreqs"
75-
sudo apt-get install libcurl4-openssl-dev libgit2-dev
76-
- name: Install dependencies
77-
run: |
78-
remotes::install_deps(dependencies = TRUE)
79-
remotes::install_github("lorenzwalthert/touchstone")
80-
remotes::install_cran(c('ggplot2', 'dplyr'))
81-
pkg <- basename(getwd())
82-
if (pkg %in% rownames(installed.packages())) {
83-
remove.packages(pkg)
84-
cat('removed package ', pkg, '.', sep = "")
85-
}
86-
shell: Rscript {0}
87-
- name: Checkout benchmarking repo
88-
uses: actions/checkout@v2
89-
with:
90-
repository: ${{ matrix.config.benchmarking_repo }}
91-
ref: ${{ matrix.config.benchmarking_ref }}
92-
path: ${{ matrix.config.benchmarking_path }}
93-
- name: Run benchmarks
94-
run: Rscript -e 'touchstone::run_script("touchstone/script.R")'
95-
- name: Save PR number
96-
run: |
97-
echo ${{ github.event.number }} > ./touchstone/pr-comment/NR
98-
- uses: actions/upload-artifact@v2
99-
with:
100-
name: visual-benchmarks
101-
path: touchstone/plots/
102-
- uses: actions/upload-artifact@v1
103-
with:
104-
name: results
105-
path: touchstone/pr-comment
106-
- uses: actions/download-artifact@v1
107-
with:
108-
name: results
109-
- name: comment PR
110-
run: cat touchstone/pr-comment/info.txt
111-
- uses: actions/upload-artifact@v2
36+
- uses: lorenzwalthert/touchstone/actions/receive@standalone-action
11237
with:
113-
name: pr
114-
path: touchstone/pr-comment/
38+
cache-version: 1
39+
benchmarking_repo: ${{matrix.config.benchmarking_repo}}
40+
benchmarking_ref: ${{matrix.config.benchmarking_ref}}
41+
benchmarking_path: ${{matrix.config.benchmarking_path}}

0 commit comments

Comments
 (0)