Skip to content

Commit fa51f4f

Browse files
committed
Add coverage workflow
1 parent 12858ef commit fa51f4f

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
- master
6+
pull_request:
7+
branches:
8+
- main
9+
- master
10+
11+
name: test-coverage
12+
13+
jobs:
14+
test-coverage:
15+
runs-on: ubuntu-18.04
16+
env:
17+
RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest
18+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- uses: r-lib/actions/setup-r@v1
24+
id: install-r
25+
26+
- name: Install pak and query dependencies
27+
run: |
28+
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
29+
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
30+
shell: Rscript {0}
31+
32+
- name: Restore R package cache
33+
uses: actions/cache@v2
34+
with:
35+
path: |
36+
${{ env.R_LIBS_USER }}
37+
!${{ env.R_LIBS_USER }}/pak
38+
key: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
39+
restore-keys: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-
40+
41+
- name: Install system dependencies
42+
if: runner.os == 'Linux'
43+
run: |
44+
pak::local_system_requirements(execute = TRUE)
45+
pak::pkg_system_requirements("covr", execute = TRUE)
46+
shell: Rscript {0}
47+
48+
- name: Install dependencies
49+
run: |
50+
pak::local_install_dev_deps(upgrade = TRUE)
51+
pak::pkg_install("covr")
52+
shell: Rscript {0}
53+
54+
- name: Test coverage
55+
run: |
56+
R CMD INSTALL .
57+
source shim_package.sh
58+
Rscript -e 'covr::codecov()'
59+
shell: Rscript {0}

0 commit comments

Comments
 (0)