Skip to content

Commit

Permalink
Merge pull request #339 from ropensci/fixes-branch
Browse files Browse the repository at this point in the history
make main the default in the code, fix docs links
  • Loading branch information
cboettig authored Dec 9, 2023
2 parents b04bbed + b9be79e commit 92f542d
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 115 deletions.
47 changes: 13 additions & 34 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# 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
#
# NOTE: This workflow is overkill for most R packages and
# check-standard.yaml is likely a better choice.
# usethis::use_github_action("check-standard") will install it.
on:
push:
branches: [main, master]
Expand All @@ -22,49 +18,32 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}

- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
# Use 3.6 to trigger usage of RTools35
- {os: windows-latest, r: '3.6'}

# Use older ubuntu to maximise backward compatibility
- {os: ubuntu-18.04, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-18.04, r: 'release'}
- {os: ubuntu-18.04, r: 'oldrel-1'}
- {os: ubuntu-18.04, r: 'oldrel-2'}
- {os: ubuntu-18.04, r: 'oldrel-3'}
- {os: ubuntu-18.04, r: 'oldrel-4'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
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

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

- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
extra-packages: any::rcmdcheck
needs: check

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
- uses: r-lib/actions/check-r-package@v2
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
upload-snapshots: true
11 changes: 5 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ jobs:
runs-on: macOS-latest
if: "!contains(github.event.head_commit.message, 'cm-skip')"
steps:
- uses: actions/checkout@v1
- uses: r-lib/actions/setup-r@v1
- name: Install remotes
run: Rscript -e 'install.packages("remotes")'
- name: Install codemetar
run: Rscript -e 'remotes::install_local(dependencies = c("Imports", "Depends"))'
- uses: actions/checkout@v3
- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: local::.
- name: Render codemeta
run: Rscript -e 'codemetar::write_codemeta()'
- name: Commit results
Expand Down
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
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ Code

All code for this package is found in `R/`, (except compiled source
code, if used, which is in `/src`). All functions should be thoroughly
documented with `roxygen2` notation; see Documentation. Code should
conform to our [Style guide](https://github.com/ropensci/onboarding/blob/master/packaging_guide.md)
documented with `roxygen2` notation; see Documentation.

Testing
-------
Expand Down
2 changes: 1 addition & 1 deletion R/guess_github_metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ github_path <- function(root, path, cm) {
github$repo
)

branch <- getOption("codemeta_branch", "master")
branch <- getOption("codemeta_branch", "main")

paste(base, "blob", branch, path, sep = "/")
}
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ knitr::opts_chunk$set(

[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/)
[![R build status](https://github.com/ropensci/codemetar/workflows/R-CMD-check/badge.svg)](https://github.com/ropensci/codemetar/actions)
[![Coverage Status](https://img.shields.io/codecov/c/github/ropensci/codemetar/master.svg)](https://codecov.io/github/ropensci/codemetar?branch=master)
[![Coverage Status](https://img.shields.io/codecov/c/github/ropensci/codemetar/main.svg)](https://codecov.io/github/ropensci/codemetar?branch=main)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/codemetar)](https://cran.r-project.org/package=codemetar)
[![](https://badges.ropensci.org/130_status.svg)](https://github.com/ropensci/software-review/issues/130)
[![DOI](https://zenodo.org/badge/86626030.svg)](https://zenodo.org/badge/latestdoi/86626030)
Expand Down
120 changes: 60 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ developed.](http://www.repostatus.org/badges/latest/active.svg)](https://www.rep
[![R build
status](https://github.com/ropensci/codemetar/workflows/R-CMD-check/badge.svg)](https://github.com/ropensci/codemetar/actions)
[![Coverage
Status](https://img.shields.io/codecov/c/github/ropensci/codemetar/master.svg)](https://codecov.io/github/ropensci/codemetar?branch=master)
Status](https://img.shields.io/codecov/c/github/ropensci/codemetar/main.svg)](https://codecov.io/github/ropensci/codemetar?branch=main)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/codemetar)](https://cran.r-project.org/package=codemetar)
[![](https://badges.ropensci.org/130_status.svg)](https://github.com/ropensci/software-review/issues/130)
[![DOI](https://zenodo.org/badge/86626030.svg)](https://zenodo.org/badge/latestdoi/86626030)
Expand All @@ -31,17 +31,16 @@ json-ld more generally**.

It has three main goals:

- Quickly **generate a valid codemeta.json file from any valid R
package**. To do so, we automatically extract as much metadata as
possible using the DESCRIPTION file, as well as extracting metadata
from other common best-practices such as the presence of Travis and
other badges in README, etc.
- Facilitate the addition of further metadata fields into a
codemeta.json file, as well as general manipulation of codemeta
files.
- Support the ability to crosswalk between terms used in other
metadata standards, as identified by the Codemeta Project Community,
see <https://codemeta.github.io/crosswalk/>
- Quickly **generate a valid codemeta.json file from any valid R
package**. To do so, we automatically extract as much metadata as
possible using the DESCRIPTION file, as well as extracting metadata
from other common best-practices such as the presence of Travis and
other badges in README, etc.
- Facilitate the addition of further metadata fields into a
codemeta.json file, as well as general manipulation of codemeta files.
- Support the ability to crosswalk between terms used in other metadata
standards, as identified by the Codemeta Project Community, see
<https://codemeta.github.io/crosswalk/>

## Why create a codemeta.json for your package?

Expand Down Expand Up @@ -82,13 +81,13 @@ codemetar::write_codemeta()
```

… Getting CRAN metadata from RStudio CRAN mirror
Got CRAN metadata!
Got CRAN metadata!
… Asking README URL from GitHub API
Got README URL!
Got README URL!
… Asking README URL from GitHub API
Got README URL!
Got README URL!
… Getting repo topics from GitHub API
Got repo topics!
Got repo topics!

``` r
library("magrittr")
Expand All @@ -103,6 +102,7 @@ library("magrittr")
</summary>

``` json

{
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@type": "SoftwareSourceCode",
Expand All @@ -113,13 +113,13 @@ library("magrittr")
"codeRepository": "https://github.com/ropensci/codemetar",
"issueTracker": "https://github.com/ropensci/codemetar/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.3.3",
"version": "0.3.5",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.1.0 (2021-05-18)",
"runtimePlatform": "R version 4.2.0 (2022-04-22)",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand Down Expand Up @@ -584,8 +584,8 @@ library("magrittr")
"keywords": ["metadata", "codemeta", "ropensci", "citation", "credit", "linked-data", "json-ld", "r", "rstats", "r-package", "peer-reviewed"],
"fileSize": "NAKB",
"releaseNotes": "https://github.com/ropensci/codemetar/blob/master/NEWS.md",
"readme": "https://github.com/ropensci/codemetar/blob/master/README.md",
"contIntegration": ["https://github.com/ropensci/codemetar/actions", "https://codecov.io/github/ropensci/codemetar?branch=master"],
"readme": "https://github.com/ropensci/codemetar/blob/main/README.md",
"contIntegration": ["https://github.com/ropensci/codemetar/actions", "https://codecov.io/github/ropensci/codemetar?branch=main"],
"developmentStatus": "https://www.repostatus.org/",
"review": {
"@type": "Review",
Expand All @@ -609,40 +609,39 @@ up to date with `DESCRIPTION`? `codemetar` itself no longer supports
automatic sync, but there are quite a few methods available out there.
Choose one that fits well into your workflow!

- You could rely on `devtools::release()` since it will ask you
whether you updated codemeta.json when such a file exists.
- You could rely on `devtools::release()` since it will ask you whether
you updated codemeta.json when such a file exists.

- You could use a git pre-commit hook that prevents a commit from
being done if DESCRIPTION is newer than codemeta.json.
- You could use a git pre-commit hook that prevents a commit from being
done if DESCRIPTION is newer than codemeta.json.

- You can use the [precommit
package](https://github.com/lorenzwalthert/precommit) in which
there’s a “codemeta-description-updated” hook.
- You can use the [precommit
package](https://github.com/lorenzwalthert/precommit) in which
there’s a “codemeta-description-updated” hook.

- If that’s your only pre-commit hook (i.e. you don’t have one
created by e.g. `usethis::use_readme_rmd()`), then you can
create it using
- If that’s your only pre-commit hook (i.e. you don’t have one created
by e.g. `usethis::use_readme_rmd()`), then you can create it using

``` r
script = readLines(system.file("templates", "description-codemetajson-pre-commit.sh", package = "codemetar"))
usethis::use_git_hook("pre-commit",
script = script)
```

- You could use GitHub actions. Refer to GitHub actions docs
<https://github.com/features/actions>, and to the example workflow
provided in this package (type
`system.file("templates", "codemeta-github-actions.yml", package = "codemetar")`).
You can use the `cm-skip` keyword in your commit message if you
don’t want this to run on a specific commit. The example workflow
provided is setup to only run when a push is made to the master
branch. This setup is designed for if you’re using a [git
flow](https://nvie.com/posts/a-successful-git-branching-model/#the-main-branches)
setup where the master branch is only committed and pushed to via
pull requests. After each PR merge (and the completion of this
GitHub action), your master branch will always be up to date and so
long as you don’t make manual changes to the codemeta.json file, you
won’t have merge conflicts.
- You could use GitHub actions. Refer to GitHub actions docs
<https://github.com/features/actions>, and to the example workflow
provided in this package (type
`system.file("templates", "codemeta-github-actions.yml", package = "codemetar")`).
You can use the `cm-skip` keyword in your commit message if you don’t
want this to run on a specific commit. The example workflow provided
is setup to only run when a push is made to the master branch. This
setup is designed for if you’re using a [git
flow](https://nvie.com/posts/a-successful-git-branching-model/#the-main-branches)
setup where the master branch is only committed and pushed to via pull
requests. After each PR merge (and the completion of this GitHub
action), your master branch will always be up to date and so long as
you don’t make manual changes to the codemeta.json file, you won’t
have merge conflicts.

Alternatively, you can have GitHub actions route run `codemetar` on each
commit. If you do this you should try to remember to run `git pull`
Expand All @@ -657,6 +656,7 @@ to rewind you local changes on top of the current upstream `HEAD`.
</summary>

``` yaml

on:
push:
branches: master
Expand Down Expand Up @@ -698,11 +698,11 @@ To ensure you have metadata in the usual places, you can run

### Usual terms in DESCRIPTION

- Fill `BugReports` and `URL`.
- Fill `BugReports` and `URL`.

- Using the `Authors@R` notation allows a much richer specification of
author roles, correct parsing of given vs family names, and email
addresses.
- Using the `Authors@R` notation allows a much richer specification of
author roles, correct parsing of given vs family names, and email
addresses.

In the current implementation, developers may specify an ORCID url for
an author in the optional `comment` field of `Authors@R`, e.g.
Expand Down Expand Up @@ -789,20 +789,20 @@ For optimal results you need a good internet connection.

The package queries

- `utils::available.packages()` for CRAN and Bioconductor packages;
- `utils::available.packages()` for CRAN and Bioconductor packages;

- GitHub API via the [`gh` package](https://github.com/r-lib/gh), if
it finds a GitHub repo URL in DESCRIPTION or as git remote. GitHub
API is queried to find the [preferred
README](https://developer.github.com/v3/repos/contents/#get-the-readme),
and the [repo
topics](https://developer.github.com/v3/repos/#list-all-topics-for-a-repository).
If you use codemetar for many packages having a
[GITHUB_PAT](https://github.com/r-lib/gh#environment-variables) is
better;
- GitHub API via the [`gh` package](https://github.com/r-lib/gh), if it
finds a GitHub repo URL in DESCRIPTION or as git remote. GitHub API is
queried to find the [preferred
README](https://developer.github.com/v3/repos/contents/#get-the-readme),
and the [repo
topics](https://developer.github.com/v3/repos/#list-all-topics-for-a-repository).
If you use codemetar for many packages having a
[GITHUB_PAT](https://github.com/r-lib/gh#environment-variables) is
better;

- [R-hub sysreqs API](https://docs.r-hub.io/#sysreqs) to parse
SystemRequirements.
- [R-hub sysreqs API](https://docs.r-hub.io/#sysreqs) to parse
SystemRequirements.

If your machine is offline, a more minimal codemeta.json will be
created. If your internet connection is poor or there are firewalls, the
Expand Down
Loading

0 comments on commit 92f542d

Please sign in to comment.