-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (97 loc) · 3.45 KB
/
run-shinytest.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
# from: https://github.com/rstudio/shiny-testing-gha-example/blob/single_platform_snapshot/.github/workflows/run-tests.yaml
on:
push:
branches:
- main
pull_request:
branches:
- main
name: Run shinytest
jobs:
run-tests:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
fail-fast: false
matrix:
config:
# disabled b/c shinytest on windows has an error
#- {os: windows-latest, r: 'release'}
# disabled due to race conditions / parallelism
#- {os: macOS-latest, r: 'release'}
# Match your manifest file R version
- {os: ubuntu-18.04, r: '4.0.2', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
steps:
# do not convert line feeds in windows
- name: Windows git setup
if: runner.os == 'Windows'
run:
git config --global core.autocrlf false
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@master
id: install-r
with:
r-version: ${{ matrix.config.r }}
- uses: r-lib/actions/setup-pandoc@master
- name: Cache R packages
uses: actions/cache@v1
with:
path: renv/library
key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('renv.lock') }}
restore-keys: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-
- name: Make sure renv exists
shell: Rscript {0}
run: |
if (system.file(package = "renv") == "") install.packages("renv")
- name: Verify R version matches
shell: Rscript {0}
run: |
renv::restore(packages = "jsonlite")
# Assert that R versions match
stopifnot(
compareVersion(
paste0(R.version$major, ".", R.version$minor),
jsonlite::read_json("renv.lock")$R$Version
) == 0
)
- name: Install system dependencies
if: runner.os == 'Linux'
# do not record `pak` activity
shell: Rscript {0}
run: |
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
lapply(names(jsonlite::read_json("renv.lock")$Packages), function(pkg) {
pak::pkg_system_requirements(pkg, execute = TRUE)
})
remove.packages("pak")
- name: Restore renv packages
shell: Rscript {0}
run: |
renv::restore()
- name: Find PhantomJS path
id: phantomjs
run: |
echo "::set-output name=path::$(Rscript -e 'cat(shinytest:::phantom_paths()[[1]])')"
- name: Cache PhantomJS
uses: actions/cache@v2
with:
path: ${{ steps.phantomjs.outputs.path }}
key: ${{ matrix.config.os }}-phantomjs
restore-keys: ${{ matrix.config.os }}-phantomjs
- name: Install PhantomJS
shell: Rscript {0}
run: |
if (!shinytest::dependenciesInstalled()) shinytest::installDependencies()
- name: Run tests
shell: Rscript {0}
run: |
shiny::runTests(".", assert = TRUE)
- name: Upload test results
if: failure()
uses: actions/upload-artifact@master
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-tests
path: tests