Skip to content

Commit

Permalink
Fix pkgdown and update github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
andrie committed Jan 26, 2024
1 parent 8571e91 commit 110d677
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 39 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
Expand All @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
Expand All @@ -29,18 +29,21 @@ jobs:
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v1
- 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@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: rcmdcheck
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v1
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
35 changes: 24 additions & 11 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:
Expand All @@ -12,24 +14,35 @@ name: pkgdown
jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: pkgdown
extra-packages: any::pkgdown, local::.
needs: website

- name: Deploy package
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/[email protected]
with:
clean: false
branch: gh-pages
folder: docs
32 changes: 26 additions & 6 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
Expand All @@ -15,16 +15,36 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: covr
extra-packages: any::covr
needs: coverage

- name: Test coverage
run: covr::codecov()
run: |
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
shell: Rscript {0}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
2 changes: 1 addition & 1 deletion R/guess-asc-filename.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Guess the data filename given the sss filename.
#'
#' @param x filename
#' @keywords Internal
#' @keywords internal
#' @noRd
guess_asc_filename <- function(x){
ext <- get_sss_format(x)
Expand Down
6 changes: 3 additions & 3 deletions R/internal-xml.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extract_contents <- function(x, ns) {
# and creates a data frame with information about size, position, type, etc.
#
# @param node XML node
# @keywords Internal
# @keywords internal
getSSSrecord <- function(node){
p <- as.character(xml_child_attrs(node, "position"))
if (inherits(xml_child(node, "spread"), "xml_missing")){
Expand Down Expand Up @@ -135,7 +135,7 @@ splitMultiple <- function(df, n, sep="_"){
#' Each element is repeated n times. This is used to construct a vector of the new length after accounting for fields of type multiple
#'
#' @param n Numeric vector that indicates the number of times each row must be repeated
#' @keywords Internal
#' @keywords internal
repN <- function(n){
rep(seq_along(n), times=pmax(1, n))
}
Expand All @@ -147,7 +147,7 @@ repN <- function(n){
#' @param names character vector defining the string that separates field and subfield names
#' @param length Numeric vector that indicates the number of times each row must be repeated
#' @param sep Character vector defining the string that separates field and subfield names
#' @keywords Internal
#' @keywords internal
namesMultiple <- function(names, length, sep = "_"){
xl <- rep(names, times = pmax(1, length))
sm <- rep(length <= 1, times = pmax(1, length))
Expand Down
6 changes: 3 additions & 3 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ knitr::opts_chunk$set(
# sss <img src='man/figures/logo.png' align="right" height="139" />

<!-- badges: start -->
[![R build status](https://github.com/andrie/sss/workflows/R-CMD-check/badge.svg)](https://github.com/andrie/sss/actions)
[![R-CMD-check](https://github.com/andrie/sss/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/andrie/sss/actions/workflows/R-CMD-check.yaml)
[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/sss)](https://www.r-pkg.org/pkg/sss)
[![CRAN status](https://www.r-pkg.org/badges/version/sss)](https://CRAN.R-project.org/package=sss)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://www.tidyverse.org/lifecycle/#stable)
[![codecov](https://codecov.io/gh/andrie/sss/branch/main/graph/badge.svg)](https://app.codecov.io/gh/andrie/sss)
[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/sss)](https://www.r-pkg.org/pkg/sss)
[![Codecov test coverage](https://codecov.io/gh/andrie/sss/branch/main/graph/badge.svg)](https://app.codecov.io/gh/andrie/sss?branch=main)
<!-- badges: end -->

The `sss` package provides functions to import triple-s `XML` files into R. The package supports sss files in both `.asc` and `.csv` format.
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

<!-- badges: start -->

[![R build
status](https://github.com/andrie/sss/workflows/R-CMD-check/badge.svg)](https://github.com/andrie/sss/actions)
[![R-CMD-check](https://github.com/andrie/sss/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/andrie/sss/actions/workflows/R-CMD-check.yaml)
[![CRAN RStudio mirror
downloads](https://cranlogs.r-pkg.org/badges/sss)](https://www.r-pkg.org/pkg/sss)
[![CRAN
status](https://www.r-pkg.org/badges/version/sss)](https://CRAN.R-project.org/package=sss)
[![Lifecycle:
stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://www.tidyverse.org/lifecycle/#stable)
[![codecov](https://codecov.io/gh/andrie/sss/branch/main/graph/badge.svg)](https://app.codecov.io/gh/andrie/sss)
[![CRAN RStudio mirror
downloads](https://cranlogs.r-pkg.org/badges/sss)](https://www.r-pkg.org/pkg/sss)
[![Codecov test
coverage](https://codecov.io/gh/andrie/sss/branch/main/graph/badge.svg)](https://app.codecov.io/gh/andrie/sss?branch=main)
<!-- badges: end -->

The `sss` package provides functions to import triple-s `XML` files into
Expand Down
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ coverage:
default:
target: auto
threshold: 1%
informational: true
patch:
default:
target: auto
threshold: 1%
informational: true
2 changes: 1 addition & 1 deletion man/namesMultiple.Rd

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

2 changes: 1 addition & 1 deletion man/repN.Rd

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

0 comments on commit 110d677

Please sign in to comment.