Skip to content

Commit

Permalink
run as fast as you can to stay in the same place
Browse files Browse the repository at this point in the history
  • Loading branch information
kingaa committed Nov 6, 2024
1 parent 0f8f134 commit fa34164
Show file tree
Hide file tree
Showing 11 changed files with 218 additions and 86 deletions.
10 changes: 6 additions & 4 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
examples
repo
revdep
scripts
tools
examples
wiki
www
yaml
tests/Makefile
tests/(.+?)\.png$
tests/(.+?)\.pdf$
Expand Down Expand Up @@ -34,13 +39,10 @@ TODO\.md$
\.tests
Makefile
rules.mk
yaml
scripts
lib
libs
library
check
www
^(.+?)\.pdf
^(.+?)\.tar\.gz
^(.+?)\.tgz
Expand Down
84 changes: 62 additions & 22 deletions .github/workflows/binary-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,43 @@ on:
tags:
- '**'
workflow_dispatch:
branches:
- '*'

name: binary-build

env:
release_name: ${{ vars.repo_name }}_${{ github.ref_name }}

jobs:
binary-build:
source_build:
runs-on: ubuntu-latest
name: Build source tarball
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
r-version: latest

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::pkgbuild
- name: Build source tarball
run: |
R CMD build --force --no-manual --resave-data --compact-vignettes=both --md5 .
mkdir -p ${{ github.workspace }}/artifacts
cp ${{ env.release_name }}.tar.gz ${{ github.workspace }}/artifacts
- uses: actions/upload-artifact@v4
with:
name: source_tarball
path: ${{ github.workspace }}/artifacts/${{ env.release_name }}.tar.gz

binary_build:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})
Expand All @@ -20,37 +50,47 @@ jobs:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
- {os: macOS-latest, r: 'release', ext: "tgz"}
- {os: windows-latest, r: 'release', ext: "zip"}

steps:
- uses: actions/checkout@v3.1.0
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: rcmdcheck

extra-packages: |
any::pkgbuild
- name: Build binary
run: pkgbuild::build(binary=TRUE,manual=TRUE)
shell: Rscript {0}
- name: Copying tarball

- name: Copy tarball
run: |
mkdir -p ${{ github.workspace }}/artifacts
cp ../tao_* ${{ github.workspace }}/artifacts
- uses: actions/upload-artifact@v3.1.1
cp ../${{ env.release_name }}.${{ matrix.config.ext }} ${{ github.workspace }}/artifacts
- uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.config.os }}-${{ matrix.config.r }}
path: ${{ github.workspace }}/artifacts
name: ${{ matrix.config.os }}-${{ matrix.config.r }}
path: ${{ github.workspace }}/artifacts/${{ env.release_name }}.${{ matrix.config.ext }}

# Workflow derived from https://github.com/marketplace/actions/create-release
create_release:
needs: [ source_build, binary_build ]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: artifacts
- uses: ncipollo/release-action@v1
with:
draft: true
artifacts: "artifacts/*/*"
57 changes: 24 additions & 33 deletions .github/workflows/r-cmd-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,24 @@ on:
push:
branches:
- '*'
paths:
- DESCRIPTION
- NAMESPACE
- R/**
- src/**
- tests/**
- man/**
- data/**
pull_request:
branches: [master]
paths:
- DESCRIPTION
- NAMESPACE
- R/**
- src/**
- tests/**
- man/**
- data/**
workflow_dispatch:
branches:
- '*'

name: R-CMD-check

Expand All @@ -22,56 +35,34 @@ jobs:
fail-fast: false
matrix:
config:
- {os: ubuntu-22.04, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-20.04, r: '4.0.0'}
- {os: macOS-11, r: 'release'}
- {os: macOS-12, r: 'release'}
- {os: ubuntu-20.04, r: '4.1.0'}
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
_R_CHECK_DEPENDS_ONLY_: false
_R_CHECK_ALL_NON_ISO_C_: true
_R_CHECK_CODE_ASSIGN_TO_GLOBALENV_: true
_R_CHECK_CODE_ATTACH_: true
_R_CHECK_CODE_DATA_INTO_GLOBALENV_: true
_R_CHECK_CODE_USAGE_VIA_NAMESPACES_: true
_R_CHECK_DEPRECATED_DEFUNCT_: true
_R_CHECK_EXECUTABLES_EXCLUSIONS_: false
_R_CHECK_INSTALL_DEPENDS_: true
_R_CHECK_NO_RECOMMENDED_: true
_R_CHECK_OVERWRITE_REGISTERED_S3_METHODS_: true
_R_CHECK_REPLACING_IMPORTS_: true
_R_CHECK_S3_METHODS_NOT_REGISTERED_: true
_R_CHECK_SCREEN_DEVICE_: stop
_R_CHECK_SRC_MINUS_W_IMPLICIT_: true
_R_CHECK_SRC_MINUS_W_UNUSED_: true
_R_CHECK_SUGGESTS_ONLY_: true
_R_CHECK_TOPLEVEL_FILES_: true
_R_CHECK_VC_DIRS_: true
_R_CHECK_WALL_FORTRAN_: true
_R_CHECK_USE_CODETOOLS_: true
_R_CHECK_CODETOOLS_PROFILE_: "suppressLocalUnused=FALSE,suppressPartialMatchArgs=FALSE,suppressParamUnused=TRUE,suppressUndefined=FALSE"

steps:
- uses: actions/checkout@v3.1.0
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true
extra-repositories: |
https://kingaa.github.io/
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck

- uses: r-lib/actions/check-r-package@v2

- uses: actions/upload-artifact@v3.1.1
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.config.os }}-${{ matrix.config.r }}-results
path: check
path: check/${{ vars.repo_name }}.Rcheck/00check.log
22 changes: 18 additions & 4 deletions .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
workflow_dispatch:
push:
branches: [master]
paths:
- DESCRIPTION
- NAMESPACE
- R/**
- src/**
- tests/**
- man/**
- data/**
pull_request:
branches: [master]
workflow_dispatch:
branches:
- '*'
paths:
- DESCRIPTION
- NAMESPACE
- R/**
- src/**
- tests/**
- man/**
- data/**

name: test-coverage

Expand All @@ -18,7 +32,7 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3.1.0
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
Expand Down
9 changes: 4 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
*.so
*.gcda
*.gcno
tests/*.pdf
scripts
*.pdf
lib
library
check
repo
wiki
www
*.pdf
inst/doc/figure
inst/doc/cache
tmp
covr.html
covr.rds
.DS_Store
68 changes: 68 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
----------------

# Instructions for building, checking, and installing

## Makefile usage

A `Makefile` is provided. Most of the rules are defined in the `rules.mk` file.
The following key variables are defined in the `Makefile`.

- `REPODIR`: the name of the directory in which a local copy of the Git repo used for publishing source and documentation is located.
- `INCLUDES`: names of header files that will be copied to `inst/includes`
- `HEADERS`: names of header files that must be rebuilt whenever source code changes.

The key targets are:

- `roxy`: runs `devtools::document()` to build the help pages (in `man/`), the package `NAMESPACE`, and the collation order in `DESCRIPTION`.
- `dist`: builds the package source tarball.
- `install`: installs the package locally for testing.
- `tests`: runs `make` in the `tests/` directory, causing tests to be updated as needed.
- `clean`: cleans the directory of files created during builds and tests.
- `fresh`: resets the directory for a fresh rebuild.

- `htmlhelp`: builds the package manual in HTML and PDF formats.
This command also causes `doxygen` to be run, which produces HTML documentation of the C/C++ source code.
These documentation files are installed into the `REPODIR/manuals` directory.
- `www`: installs the package and runs `make` in the `www` directory.
This causes vignettes to be updated, among other things.
- `NEWS`: builds the plain-text package NEWS file.
- `instdocs`: runs `make` in the `inst/docs` directory.

- `check`: runs `devtools::check()`.
- `qcheck`: like `check`, but tests in `tests/` are not run.
- `qqcheck`: like `qcheck`, but checks for code-documentation mismatch and examples are not run.
- `xcheck`: runs `devtools::check(cran=TRUE)`, i.e., the additional checks for CRAN suitability are also run.
- `ycheck`: runs `xcheck` but tests and examples that are ordinarily not run (because expensive) are run.
- `vcheck`: runs `check` and then tests for memory leaks using `valgrind`.
One must examine the output (printed to the console and also stored in a file, the name of which ends in `-Ex.Rout`.
- `revdeps`: causes checks of reverse-dependent packages to run.
The outputs are stored under the `revdep` directory.
- `rchk`: runs Kalibera's `rchk` utility.
This uses `docker` to download and run a Docker container.
The stdout for this is stored in `rchk.out`.

- `session`: installs the package locally and then runs an **R** session for interactive testing.
This session is controlled by the `RSESSION` environment variable.
By default, this runs an `emacs -f R` session.
- `rsession`: like `session`, but a naked **R** session is started: `RSESSION=R`.
- `debug`: like `rsession`, but the **R** session is started under a debugger.
By default, the `gdb` debugger is used: `RSESSION=R -d gdb`.

- `publish`: causes source and binary tarballs to be installed in the REPODIR respository.
- `covr`: runs `covr::package_coverage()` to evaluate unit-test coverage.
Results are stored in `covr.rds`.
- `vcovr`: like `covr`, but results are displayed in a browser.

----------------

## Github Actions

Several Github Actions are defined in `.github/workflows`:

- `r-cmd-check`: runs checks on various platforms.
- `test-coverage`: runs `covr::codecov` to upload unit-test coverage information to [codecov.io](https://codecov.io).
- `binary-build`: causes binary tarballs to be built for OS X and Windows platforms.

These must be updated manually from time to time as the Actions on which they depend change.

----------------
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ License: GPL-3
Encoding: UTF-8
Suggests: tinytest
Roxygen: list(roclets = c("collate", "namespace", "rd", "roxytest::tinytest_roclet"))
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
REPODIR = ../www
INCLUDES=
HEADERS=
REPODIR = repo
INCLUDES =
HEADERS =
SESSION_PKGS = datasets,utils,grDevices,graphics,stats,methods,tidyverse,$(PKG)

include rules.mk

1 change: 1 addition & 0 deletions man/tao-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fa34164

Please sign in to comment.