Skip to content

Commit cce8814

Browse files
authored
Merge pull request #122 from DoubleML/m-check-styler
add a github actions workflow to check alignment with the style guidelines
2 parents 5526694 + 15a2b36 commit cce8814

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/check_styler.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Workflow based on https://github.com/r-lib/actions/tree/master/examples#standard-ci-workflow
2+
name: Check style guidelines
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
pull_request:
9+
branches:
10+
- master
11+
schedule:
12+
- cron: "0 9 * * 1,3,5"
13+
workflow_dispatch:
14+
15+
jobs:
16+
R-CMD-check:
17+
runs-on: ${{ matrix.config.os }}
18+
19+
name: ${{ matrix.config.os }} (R ${{ matrix.config.r }}; mlr3 ${{ matrix.config.mlr3 }})
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
config:
25+
- {os: ubuntu-20.04, r: 'release', mlr3: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
26+
27+
env:
28+
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
29+
RSPM: ${{ matrix.config.rspm }}
30+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
31+
32+
steps:
33+
- uses: actions/checkout@v2
34+
with:
35+
fetch-depth: 2
36+
37+
- uses: r-lib/actions/setup-r@v1
38+
with:
39+
r-version: ${{ matrix.config.r }}
40+
41+
- uses: r-lib/actions/setup-pandoc@v1
42+
43+
- name: Install dependencies
44+
run: |
45+
install.packages('remotes')
46+
remotes::install_github("pat-s/styler@mlr-style", dependencies=TRUE)
47+
shell: Rscript {0}
48+
49+
- name: Install system dependencies
50+
run: |
51+
while read -r cmd
52+
do
53+
eval sudo $cmd
54+
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
55+
56+
- name: Check styler
57+
run: |
58+
res = styler::style_pkg(style = styler::mlr_style)
59+
if (!all(res$changed==FALSE)) stop("Code is not in line with the style guidelines (see https://github.com/DoubleML/doubleml-for-r/wiki/Style-Guidelines#use-styler-mlr-style)")
60+
shell: Rscript {0}

0 commit comments

Comments
 (0)