Skip to content

Commit 4dd9d79

Browse files
committed
Package skeleton
0 parents  commit 4dd9d79

14 files changed

+286
-0
lines changed

.Rbuildignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
^scripts$
2+
^Makefile$
3+
^README\.Rmd$
4+
^\.travis\.yml$
5+
^docs$
6+
^\.lintr$
7+
^tests/testthat/.*\.o$
8+
^tests/testthat/.*\.so$
9+
^tests/testthat/.*\.dll$
10+
\.dylib$
11+
^appveyor\.yml$
12+
^docker$
13+
^\.hadolint\.yaml$
14+
\.valgrind_ignore$
15+
^scripts$
16+
\.gcda$
17+
\.gcno$
18+
^pkgdown$
19+
^LICENSE\.md$
20+
^buildkite$
21+
^\.covrignore$
22+
^\.github$
23+
\.*gcov$

.github/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.html

.github/workflows/R-CMD-check.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
name: R-CMD-check
10+
11+
jobs:
12+
R-CMD-check:
13+
runs-on: ${{ matrix.config.os }}
14+
15+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
config:
21+
- {os: macos-latest, r: 'release'}
22+
- {os: windows-latest, r: 'release'}
23+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
24+
- {os: ubuntu-latest, r: 'release'}
25+
- {os: ubuntu-latest, r: 'oldrel-1'}
26+
27+
env:
28+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
29+
R_KEEP_PKG_SOURCE: yes
30+
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- uses: r-lib/actions/setup-pandoc@v2
35+
36+
- uses: r-lib/actions/setup-r@v2
37+
with:
38+
r-version: ${{ matrix.config.r }}
39+
http-user-agent: ${{ matrix.config.http-user-agent }}
40+
use-public-rspm: true
41+
42+
- uses: r-lib/actions/setup-r-dependencies@v2
43+
with:
44+
extra-packages: any::rcmdcheck
45+
needs: check
46+
47+
- uses: r-lib/actions/check-r-package@v2
48+
with:
49+
upload-snapshots: true

.github/workflows/pkgdown.yaml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
release:
9+
types: [published]
10+
workflow_dispatch:
11+
12+
name: pkgdown
13+
14+
jobs:
15+
pkgdown:
16+
runs-on: ubuntu-latest
17+
# Only restrict concurrency for non-PR jobs
18+
concurrency:
19+
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
20+
env:
21+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
22+
permissions:
23+
contents: write
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- uses: r-lib/actions/setup-pandoc@v2
28+
29+
- uses: r-lib/actions/setup-r@v2
30+
with:
31+
use-public-rspm: true
32+
33+
- uses: r-lib/actions/setup-r-dependencies@v2
34+
with:
35+
extra-packages: any::pkgdown, local::.
36+
needs: website
37+
38+
- name: Build site
39+
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
40+
shell: Rscript {0}
41+
42+
- name: Deploy to GitHub pages 🚀
43+
if: github.event_name != 'pull_request'
44+
uses: JamesIves/[email protected]
45+
with:
46+
clean: false
47+
branch: gh-pages
48+
folder: docs

.github/workflows/test-coverage.yaml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
name: test-coverage
10+
11+
jobs:
12+
test-coverage:
13+
runs-on: ubuntu-latest
14+
env:
15+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: r-lib/actions/setup-r@v2
21+
with:
22+
use-public-rspm: true
23+
24+
- uses: r-lib/actions/setup-r-dependencies@v2
25+
with:
26+
extra-packages: any::covr
27+
needs: coverage
28+
29+
- name: Test coverage
30+
run: |
31+
covr::codecov(
32+
quiet = FALSE,
33+
clean = FALSE,
34+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
35+
)
36+
shell: Rscript {0}
37+
38+
- name: Show testthat output
39+
if: always()
40+
run: |
41+
## --------------------------------------------------------------------
42+
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
43+
shell: bash
44+
45+
- name: Upload test results
46+
if: failure()
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: coverage-test-failures
50+
path: ${{ runner.temp }}/package

.gitignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.Rproj.user
2+
.Rhistory
3+
.RData
4+
.Ruserdata
5+
.DS_Store
6+
TODO.md
7+
docs
8+
*.o
9+
*.so
10+
*.dll
11+
*.dylib
12+
*.gcda
13+
*.gcno
14+
*.gcov
15+
.valgrind_ignore
16+
inst/doc
17+
pkgdown

DESCRIPTION

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Package: dust2
2+
Title: Next Generation dust
3+
Version: 0.1.0
4+
Authors@R: c(person("Rich", "FitzJohn", role = c("aut", "cre"),
5+
email = "[email protected]"),
6+
person("Imperial College of Science, Technology and Medicine",
7+
role = "cph"))
8+
Description: Experimental sources for the next generation of dust,
9+
which will properly adopt the particle filter, have support for
10+
partial parameter updates, support for multiple parameter sets and
11+
hopefully better GPU/MPI support.
12+
License: MIT + file LICENSE
13+
Encoding: UTF-8
14+
Roxygen: list(markdown = TRUE)
15+
RoxygenNote: 7.3.1
16+
Language: en-GB
17+
Config/testthat/edition: 3
18+
URL: https://github.com/mrc-ide/dust2
19+
BugReports: https://github.com/mrc-ide/dust2/issues
20+
Suggests:
21+
testthat (>= 3.0.0)

LICENSE

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
YEAR: 2024
2+
COPYRIGHT HOLDER: Imperial College of Science, Technology and Medicine

Makefile

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
PACKAGE := $(shell grep '^Package:' DESCRIPTION | sed -E 's/^Package:[[:space:]]+//')
2+
RSCRIPT = Rscript --no-init-file
3+
4+
all:
5+
${RSCRIPT} -e 'pkgbuild::compile_dll()'
6+
7+
test:
8+
${RSCRIPT} -e 'devtools::test()'
9+
10+
roxygen:
11+
@mkdir -p man
12+
${RSCRIPT} -e "devtools::document()"
13+
14+
install:
15+
R CMD INSTALL .
16+
17+
build:
18+
R CMD build .
19+
20+
README.md: README.Rmd
21+
Rscript -e 'devtools::load_all(); knitr::knit("README.Rmd")'
22+
sed -i.bak 's/[[:space:]]*$$//' README.md
23+
rm -f $@.bak
24+
25+
check:
26+
_R_CHECK_CRAN_INCOMING_=FALSE make check_all
27+
28+
check_all:
29+
${RSCRIPT} -e "rcmdcheck::rcmdcheck(args = c('--as-cran', '--no-manual'))"
30+
31+
clean:
32+
rm -f src/*.o src/*.so src/*.gcda src/*.gcno src/*.gcov
33+
34+
.PHONY: clean all test document install

NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Generated by roxygen2: do not edit by hand

R/util.R

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
`%||%` <- function(x, y) { # nolint
2+
if (is.null(x)) y else x
3+
}

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# dust2
2+
3+
<!-- badges: start -->
4+
[![Project Status: Concept – Minimal or no implementation has been done yet, or the repository is only intended to be a limited example, demo, or proof-of-concept.](https://www.repostatus.org/badges/latest/concept.svg)](https://www.repostatus.org/#concept)
5+
[![R-CMD-check](https://github.com/mrc-ide/dust2/actions/workflows/R-CMD-check.yaml/badge.svg?branch=main)](https://github.com/mrc-ide/dust2/actions/workflows/R-CMD-check.yaml)
6+
[![codecov.io](https://codecov.io/github/mrc-ide/dust2/coverage.svg?branch=main)](https://codecov.io/github/mrc-ide/dust2?branch=main)
7+
<!-- badges: end -->
8+
9+
## Installation
10+
11+
To install `dust2`:
12+
13+
```r
14+
remotes::install_github("mrc-ide/dust2", upgrade = FALSE)
15+
```
16+
17+
## License
18+
19+
MIT © Imperial College of Science, Technology and Medicine

tests/testthat.R

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file is part of the standard setup for testthat.
2+
# It is recommended that you do not modify it.
3+
#
4+
# Where should you do additional test configuration?
5+
# Learn more about the roles of various files in:
6+
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
7+
# * https://testthat.r-lib.org/articles/special-files.html
8+
9+
library(testthat)
10+
library(dust2)
11+
12+
test_check("dust2")

tests/testthat/test-util.R

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
test_that("null-or-value works", {
2+
expect_equal(1 %||% NULL, 1)
3+
expect_equal(1 %||% 2, 1)
4+
expect_equal(NULL %||% NULL, NULL)
5+
expect_equal(NULL %||% 2, 2)
6+
})

0 commit comments

Comments
 (0)