Repository navigation
72 lines (61 loc) · 1.83 KB
/
Copy pathtest-ggplot2.yaml
File metadata and controls
72 lines (61 loc) · 1.83 KB
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
on:
push:
branches: [main, master]
pull_request:
name: test-ggplot2.yaml
permissions: read-all
jobs:
ggplot2:
runs-on: ubuntu-latest
# `binary` uses ggplot2 built against CRAN S7; `source` rebuilds it
# against this S7, which changes the stored S7 class definitions.
name: ggplot2 (release, ${{ matrix.ggplot2-build }})
strategy:
fail-fast: false
matrix:
ggplot2-build: [binary, source]
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v6
- uses: r-lib/actions/setup-r@v2
with:
r-version: release
- uses: r-lib/actions/setup-r-dependencies@v2
with:
dependencies: '"hard"'
extra-packages: any::ggplot2, local::.
install-pandoc: false
- name: Rebuild ggplot2 from source
if: matrix.ggplot2-build == 'source'
run: |
install.packages(
"ggplot2",
repos = "https://cloud.r-project.org",
type = "source",
dependencies = FALSE
)
shell: Rscript {0}
- name: Test ggplot2 compatibility
run: |
library(S7)
library(ggplot2)
output <- tempfile(fileext = ".png")
grDevices::png(filename = output)
plot <- ggplot(
data = mtcars,
mapping = aes(wt, mpg, colour = factor(cyl))
) +
geom_point() +
theme(legend.key.spacing = grid::unit(1, "cm"))
built <- ggplot_build(plot)
grob <- ggplotGrob(plot)
print(plot)
invisible(grDevices::dev.off())
stopifnot(
inherits(plot, "ggplot"),
inherits(built, "ggplot_built"),
inherits(grob, "gtable"),
file.size(output) > 0
)
shell: Rscript {0}