-
Notifications
You must be signed in to change notification settings - Fork 2
109 lines (92 loc) · 3.22 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
# 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-latest, r: 'devel' }
- { os: ubuntu-latest, r: 'release' }
- { os: macOS-latest, r: 'release' }
- { os: windows-latest, r: 'release' }
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up R (latest version)
uses: r-lib/actions/[email protected]
with:
r-version: '4.4.1'
# Install system dependencies required for R packages
- name: Install system dependencies (Linux)
if: matrix.config.os == 'ubuntu-latest'
run: |
sudo apt-get update -y || true
sudo apt-get install -y pandoc
- name: Debug Installed Tools
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'
- name: Install system dependencies (macOS)
if: matrix.config.os == 'macOS-latest'
run: |
brew install pandoc
- name: Install Pandoc for Windows
if: matrix.config.os == 'windows-latest'
run: |
choco install pandoc -y
- name: Install R dependencies
run: |
Rscript -e "if (!requireNamespace('remotes', quietly = TRUE)) install.packages('remotes')"
Rscript -e "remotes::install_deps(dependencies = TRUE)"
- 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 based on os
- name: Build the package (Linux/macOS)
if: matrix.config.os != 'windows-latest'
run: |
R CMD build .
- name: Build the package (Windows)
if: matrix.config.os == 'windows-latest'
shell: cmd
run: |
R CMD build .
#Check the package
- 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
- name: Check the package (Windows)
if: matrix.config.os == 'windows-latest'
shell: cmd
run: |
FOR /F "tokens=*" %%i IN ('dir /b *.tar.gz') DO SET PKG_TAR=%%i && R CMD check "%%PKG_TAR%" --no-manual --as-cran