-
Notifications
You must be signed in to change notification settings - Fork 2
142 lines (125 loc) · 4.54 KB
/
r.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
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
#
# See https://github.com/r-lib/actions/tree/master/examples#readme for
# additional example workflows available for the R community.
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
#
# See https://github.com/r-lib/actions/tree/master/examples#readme for
# additional example workflows available for the R community.
name: R
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- { os: ubuntu-22.04, r: 'devel' }
- { os: ubuntu-22.04, r: 'release' }
- { os: macOS-latest, r: 'next' }
- { os: windows-latest, r: 'release' }
steps:
- name: Checkout code
uses: actions/checkout@v3
# Use the latest version of setup-r that includes the fix for pkgconf
- name: Set up R (latest version)
uses: r-lib/actions/[email protected]
with:
r-version: ${{ matrix.config.r }}
# Install system dependencies for Ubuntu
- name: Install system dependencies (Ubuntu)
if: startsWith(matrix.config.os, 'ubuntu')
run: |
sudo apt-get update -y
sudo apt-get install -y pandoc
- name: Suppress Transition Warnings
if: startsWith(matrix.config.os, 'ubuntu')
run: echo "Suppressing Ubuntu transition warnings"
# Debug Installed Tools for Ubuntu
- name: Debug Installed Tools (Ubuntu)
if: startsWith(matrix.config.os, 'ubuntu')
run: |
echo "R version:"
Rscript -e "R.version"
echo "Checking pkg-config installation:"
which pkg-config || echo 'pkg-config not found'
pkg-config --version || echo 'pkg-config version issue'
# Install system dependencies for macOS
- name: Install system dependencies (macOS)
if: matrix.config.os == 'macOS-latest'
run: |
brew update
brew install pandoc
echo "pkgconf version:"
pkg-config --version
# Debug Installed Tools for macOS
- name: Debug Installed Tools (macOS)
if: matrix.config.os == 'macOS-latest'
run: |
echo "R version:"
Rscript -e "R.version"
echo "Checking pkg-config installation:"
which pkg-config || echo 'pkg-config not found'
pkg-config --version || echo 'pkg-config version issue'
# Install Pandoc for Windows
- name: Install Pandoc for Windows
if: matrix.config.os == 'windows-latest'
run: |
choco install pandoc -y
# Install R dependencies
- name: Install R dependencies
run: |
Rscript -e "if (!requireNamespace('remotes', quietly = TRUE)) install.packages('remotes')"
Rscript -e "remotes::install_deps(dependencies = TRUE)"
# Run R tests
- name: Run R tests
run: |
Rscript -e "testthat::test_file('tests/testthat/test-counts.R')"
Rscript -e "testthat::test_file('tests/testthat/test-reordering.R')"
# Build the package for Linux/macOS
- name: Build the package (Linux/macOS)
if: matrix.config.os != 'windows-latest'
run: |
R CMD build .
# Build the package for Windows
- name: Build the package (Windows)
if: matrix.config.os == 'windows-latest'
shell: cmd
run: |
R CMD build .
# Check the package for Linux/macOS
- name: Check the package (Linux/macOS)
if: matrix.config.os != 'windows-latest'
run: |
echo "Running R CMD build"
R CMD build .
echo "Running R CMD check"
PKG_TAR=$(ls *.tar.gz)
R CMD check "$PKG_TAR" --no-manual --as-cran
# Debug Build Output for Windows
- name: Debug Build Output (Windows)
if: matrix.config.os == 'windows-latest'
shell: cmd
run: |
dir /b *.tar.gz || echo "No .tar.gz file found after build"
# Check the package for Windows
- name: Check the package (Windows)
if: matrix.config.os == 'windows-latest'
shell: cmd
run: |
dir /b *.tar.gz > tarball.txt
set /p PKG_TAR=<tarball.txt
echo Checking package %PKG_TAR%
R CMD check %PKG_TAR% --no-manual --as-cran