Skip to content

Commit d193bec

Browse files
committed
Adding new workflow and working on R CMD check
1 parent 72234a2 commit d193bec

4 files changed

Lines changed: 61 additions & 71 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
22
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
33
{
4-
"name": "epiworldR",
4+
"name": "netdiffuseR",
55
"build": {
66
"dockerfile": "Dockerfile"
77
},
@@ -11,7 +11,8 @@
1111
"reditorsupport.r",
1212
"rdebugger.r-debugger",
1313
"quarto.quarto",
14-
"tianyishi.rmarkdown"
14+
"tianyishi.rmarkdown",
15+
"github.vscode-github-actions"
1516
]
1617
}
1718
},

.github/workflows/build-targz.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
2+
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
pull_request:
9+
branches:
10+
- main
11+
- master
12+
workflow_dispatch:
13+
14+
name: Build and upload the tar.gz
15+
16+
jobs:
17+
R-build:
18+
runs-on: ubuntu-latest
19+
name: Build the package
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- uses: r-lib/actions/setup-r@v2
24+
with:
25+
r-version: 'release'
26+
27+
- uses: r-lib/actions/setup-pandoc@v2
28+
29+
- uses: r-lib/actions/setup-r-dependencies@v2
30+
31+
- name: Build the package
32+
run: R CMD build .
33+
34+
- name: Upload the artifact
35+
uses: actions/upload-artifact@v5
36+
with:
37+
name: package
38+
path: "*.tar.gz"

.github/workflows/pkgdown.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
shell: Rscript {0}
4545

4646
- name: Upload artifact for GH pages deployment
47-
uses: actions/upload-pages-artifact@v3
47+
uses: actions/upload-pages-artifact@v5
4848
with:
4949
path: "docs/"
5050

.github/workflows/r.yml

Lines changed: 19 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ jobs:
2222
fail-fast: false
2323
matrix:
2424
config:
25-
- {os: windows-latest, r: 'release'}
26-
- {os: macOS-latest, r: 'release'}
27-
- {os: ubuntu-latest, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
28-
- {os: ubuntu-latest, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
29-
- {os: ubuntu-latest, r: 'devel', valgrind: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
25+
- {os: windows-latest, r: 'release', valgrind: false}
26+
- {os: macOS-latest, r: 'release', valgrind: false}
27+
- {os: ubuntu-latest, r: 'release', valgrind: false}
28+
- {os: ubuntu-latest, r: 'devel', valgrind: false}
29+
- {os: ubuntu-latest, r: 'devel', valgrind: true}
30+
- {os: macos-26, r: 'release', valgrind: false}
3031

3132
env:
3233
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
@@ -42,73 +43,23 @@ jobs:
4243

4344
- uses: r-lib/actions/setup-pandoc@v2
4445

45-
- name: Query dependencies
46-
run: |
47-
install.packages('remotes')
48-
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
49-
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
50-
shell: Rscript {0}
51-
52-
- name: Restore R package cache
53-
if: runner.os != 'Windows'
54-
uses: actions/cache@v4
55-
with:
56-
path: ${{ env.R_LIBS_USER }}
57-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
58-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
59-
60-
- name: Install system dependencies
61-
if: runner.os == 'Linux'
62-
run: |
63-
while read -r cmd
64-
do
65-
eval sudo $cmd
66-
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
67-
- name: Install dependencies
68-
run: |
69-
remotes::install_deps(dependencies = TRUE)
70-
remotes::install_cran("rcmdcheck")
71-
shell: Rscript {0}
72-
73-
- name: Check
74-
if: ${{ matrix.config.valgrind != true }}
75-
env:
76-
_R_CHECK_CRAN_INCOMING_REMOTE_: false
77-
run: |
78-
options(crayon.enabled = TRUE)
79-
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "error", check_dir = "check")
80-
shell: Rscript {0}
46+
- uses: r-lib/actions/setup-r-dependencies@v2
8147

82-
- name: Setup valgrind
83-
if: ${{ matrix.config.valgrind == true }}
48+
- name: Install valgrind
49+
if: ${{ matrix.config.valgrind }}
8450
run: |
8551
sudo apt-get update
86-
sudo apt-get install -y valgrind --no-install-recommends
87-
shell: bash
52+
sudo apt-get install -y --no-install-recommends valgrind
8853
89-
- name: Check with Valgrind
90-
if: ${{ matrix.config.valgrind == true }}
91-
env:
92-
_R_CHECK_CRAN_INCOMING_REMOTE_: false
93-
run: |
94-
options(crayon.enabled = TRUE)
95-
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran", "--use-valgrind"), error_on = "error", check_dir = "check")
96-
shell: Rscript {0}
97-
98-
- name: Upload check results
99-
if: failure()
100-
uses: actions/upload-artifact@main
54+
- uses: r-lib/actions/check-r-package@v2
55+
if: ${{ matrix.config.valgrind }}
10156
with:
102-
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
103-
path: check
57+
args: 'c("--as-cran", "--use-valgrind")'
58+
59+
- uses: r-lib/actions/check-r-package@v2
60+
if: ${{ !matrix.config.valgrind }}
61+
62+
63+
10464

105-
- name: Build the package
106-
if: ${{ matrix.config.os == 'ubuntu-latest' && (matrix.config.r == 'release' || matrix.config.r == 'devel') && (matrix.config.valgrind != true) }}
107-
run: R CMD build .
10865

109-
- uses: actions/upload-artifact@v4
110-
if: ${{ matrix.config.os == 'ubuntu-latest' && (matrix.config.r == 'release' || matrix.config.r == 'devel') && (matrix.config.valgrind != true) }}
111-
with:
112-
name: netdiffuseR-built-package-${{ matrix.config.os }}-${{ matrix.config.r }}
113-
path: netdiffuseR_*.tar.gz
114-
retention-days: 7

0 commit comments

Comments
 (0)