-
Notifications
You must be signed in to change notification settings - Fork 25
178 lines (151 loc) · 5.4 KB
/
e2e-test.yml
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: E2E Test
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
defaults:
run:
working-directory: ./tests/e2e/
permissions:
contents: read
jobs:
main:
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
runs-on: ${{ matrix.config.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-22.04, r: 'devel'}
- {os: ubuntu-22.04, r: 'release'}
- {os: ubuntu-22.04, r: 'oldrel'}
steps:
- name: Checkout E2E directory
uses: actions/checkout@v4
with:
# Only checkout the necessary files; the DESCRIPTION file breaks test_r():
# https://github.com/Appsilon/rhino/issues/461
sparse-checkout: /tests/e2e/
sparse-checkout-cone-mode: false
- name: Install R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
use-public-rspm: true # Dramatically speeds up installation of dependencies.
- name: Install R package dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
packages: Appsilon/rhino@${{ github.sha }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: init() should create a Rhino directory
if: always()
shell: Rscript {0}
run: rhino::init('RhinoApp')
- name: diagnostics() should print system information and Rhino version
if: always()
shell: Rscript {0}
run: rhino::diagnostics()
- name: pkg_install() and pkg_remove() should work for managing dependencies
if: always()
run: |
cd RhinoApp
Rscript ../test-dependencies.R
env:
# Without `GITHUB_PAT`, `renv::install()` fails randomly on macOS
# when installing packages from GitHub (see issue #591).
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- name: Node.js commands should respect RHINO_NPM
# Skip this test on Windows because it requires a Unix shell.
if: runner.os != 'Windows'
run: |
cd RhinoApp
Rscript ../test-custom-npm.R
- name: lint_r() should detect lint errors in R scripts
if: always()
run: |
cd RhinoApp
Rscript ../test-lint-r.R
- name: format_r() should format R scripts
if: always()
run: |
cd RhinoApp
Rscript ../test-format-r.R
- name: lint_js() should detect lint errors in JS
if: always()
run: |
cd RhinoApp
Rscript ../test-lint-js.R
- name: format_js() should format JS scripts
if: always()
run: |
cd RhinoApp
Rscript ../test-format-js.R
- name: lint_sass() should detect lint errors in CSS
if: always()
run: |
cd RhinoApp
Rscript ../test-lint-sass.R
- name: format_sass() should format SASS (.scss) scripts
if: always()
run: |
cd RhinoApp
Rscript ../test-format-sass.R
- name: build_js() should build app.min.js
if: always()
run: |
cd RhinoApp
Rscript ../test-build-js.R
- name: build_css() should build app.min.css
if: always()
run: |
cd RhinoApp
Rscript ../test-build-sass.R
- name: test_r() should run testthat tests
if: always()
run: |
cd RhinoApp
Rscript -e "rhino::test_r()"
- name: test_e2e() should run cypress tests
if: always()
run: |
cd RhinoApp
Rscript -e "rhino::test_e2e()"
- name: Add shiny.react dependency
if: always()
shell: Rscript {0}
working-directory: tests/e2e/RhinoApp
run: rhino::pkg_install("shiny.react")
- name: Copy template files to RhinoApp
if: always()
shell: Rscript {0}
run: |
file.copy("app-files/config.yml", "RhinoApp/config.yml", overwrite = TRUE)
file.copy("app-files/main.R", "RhinoApp/app/main.R", overwrite = TRUE)
file.copy("app-files/say_hello.R", "RhinoApp/app/logic/say_hello.R", overwrite = TRUE)
file.copy("app-files/hello.R", "RhinoApp/app/view/hello.R", overwrite = TRUE)
file.copy("app-files/main.scss", "RhinoApp/app/styles/main.scss", overwrite = TRUE)
file.copy("app-files/index.js", "RhinoApp/app/js/index.js", overwrite = TRUE)
file.copy("app-files/Box.jsx", "RhinoApp/app/js/Box.jsx", overwrite = TRUE)
file.copy("app-files/test-hello.R", "RhinoApp/tests/testthat/test-hello.R", overwrite = TRUE)
file.copy("app-files/test-say_hello.R", "RhinoApp/tests/testthat/test-say_hello.R", overwrite = TRUE)
file.copy("app-files/hello.cy.js", "RhinoApp/tests/cypress/e2e/hello.cy.js", overwrite = TRUE)
file.remove("RhinoApp/tests/testthat/test-main.R")
- name: Cypress tests should confirm RhinoApp works
if: always()
run: |
cd RhinoApp
Rscript -e "rhino::lint_r()"
Rscript -e "rhino::lint_sass()"
Rscript -e "rhino::lint_js()"
Rscript -e "rhino::build_sass()"
Rscript -e "rhino::build_js()"
Rscript -e "rhino::test_r()"
Rscript -e "rhino::test_e2e()"