forked from stan-dev/cmdstanr
-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (98 loc) · 3.48 KB
/
Test-coverage.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
---
# Github Actions workflow to analyze CmdStanR code, test coverage
# yamllint disable rule:line-length
name: Test coverage
'on':
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test-coverage-ubuntu:
name: "Linux"
if: "! contains(github.event.head_commit.message, '[ci skip]')"
runs-on: ubuntu-20.04
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
NOT_CRAN: true
steps:
- name: cmdstan env vars
run: |
echo "CMDSTAN_PATH=${HOME}/.cmdstan" >> $GITHUB_ENV
shell: bash
- uses: n1hility/cancel-previous-runs@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
workflow: Test-coverage.yml
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'"
- uses: actions/checkout@v3
- uses: r-lib/actions/[email protected]
- uses: r-lib/actions/[email protected]
- name: Install Ubuntu dependencies
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev
sudo apt-get install -y openmpi-bin openmpi-common openmpi-doc libopenmpi-dev
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
shell: Rscript {0}
- name: Cache R packages
uses: actions/cache@v3
with:
path: ${{ env.R_LIBS_USER }}
key: ubuntu-r-4.0-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ubuntu-r-4.0-1-
- name: Install dependencies
run: |
install.packages(c("remotes", "curl"), dependencies = TRUE)
remotes::install_local(path = ".", INSTALL_opts = "--no-test-load")
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("covr")
remotes::install_cran("gridExtra")
shell: Rscript {0}
- name: Install cmdstan
run: |
cmdstanr::check_cmdstan_toolchain(fix = TRUE)
cmdstanr::install_cmdstan(cores = 2)
shell: Rscript {0}
- name: Test coverage
run: covr::codecov(type = "tests")
shell: Rscript {0}
test-coverage-windows:
name: "Windows"
if: "! contains(github.event.head_commit.message, '[ci skip]')"
runs-on: windows-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
NOT_CRAN: true
steps:
- uses: actions/checkout@v3
- uses: r-lib/actions/[email protected]
with:
r-version: 'release'
rtools-version: '42'
- uses: r-lib/actions/[email protected]
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
shell: Rscript {0}
- name: Install dependencies
run: |
install.packages(c("remotes", "curl"), dependencies = TRUE)
remotes::install_local(path = ".")
cmdstanr::check_cmdstan_toolchain(fix = TRUE)
cmdstanr::install_cmdstan(cores = 2, overwrite = TRUE)
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("covr")
remotes::install_cran("gridExtra")
shell: Rscript {0}
- name: Test coverage
run: |
options(covr.gcov = 'C:/rtools40/mingw64/bin/gcov.exe');
covr::codecov(type = "tests", function_exclusions = "sample_mpi")
shell: Rscript {0}