diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index d03c07b..0000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @insightsengineering/idr diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md deleted file mode 100644 index 45d257b..0000000 --- a/.github/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,133 +0,0 @@ - -# Contributor Covenant Code of Conduct - -## Our Pledge - -We as members, contributors, and leaders pledge to make participation in our -community a harassment-free experience for everyone, regardless of age, body -size, visible or invisible disability, ethnicity, sex characteristics, gender -identity and expression, level of experience, education, socio-economic status, -nationality, personal appearance, race, caste, color, religion, or sexual -identity and orientation. - -We pledge to act and interact in ways that contribute to an open, welcoming, -diverse, inclusive, and healthy community. - -## Our Standards - -Examples of behavior that contributes to a positive environment for our -community include: - -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, - and learning from the experience -* Focusing on what is best not just for us as individuals, but for the overall - community - -Examples of unacceptable behavior include: - -* The use of sexualized language or imagery, and sexual attention or advances of - any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email address, - without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Enforcement Responsibilities - -Community leaders are responsible for clarifying and enforcing our standards of -acceptable behavior and will take appropriate and fair corrective action in -response to any behavior that they deem inappropriate, threatening, offensive, -or harmful. - -Community leaders have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions that are -not aligned to this Code of Conduct, and will communicate reasons for moderation -decisions when appropriate. - -## Scope - -This Code of Conduct applies within all community spaces, and also applies when -an individual is officially representing the community in public spaces. -Examples of representing our community include using an official e-mail address, -posting via an official social media account, or acting as an appointed -representative at an online or offline event. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported to the community leaders responsible for enforcement at -[INSERT CONTACT METHOD]. -All complaints will be reviewed and investigated promptly and fairly. - -All community leaders are obligated to respect the privacy and security of the -reporter of any incident. - -## Enforcement Guidelines - -Community leaders will follow these Community Impact Guidelines in determining -the consequences for any action they deem in violation of this Code of Conduct: - -### 1. Correction - -**Community Impact**: Use of inappropriate language or other behavior deemed -unprofessional or unwelcome in the community. - -**Consequence**: A private, written warning from community leaders, providing -clarity around the nature of the violation and an explanation of why the -behavior was inappropriate. A public apology may be requested. - -### 2. Warning - -**Community Impact**: A violation through a single incident or series of -actions. - -**Consequence**: A warning with consequences for continued behavior. No -interaction with the people involved, including unsolicited interaction with -those enforcing the Code of Conduct, for a specified period of time. This -includes avoiding interactions in community spaces as well as external channels -like social media. Violating these terms may lead to a temporary or permanent -ban. - -### 3. Temporary Ban - -**Community Impact**: A serious violation of community standards, including -sustained inappropriate behavior. - -**Consequence**: A temporary ban from any sort of interaction or public -communication with the community for a specified period of time. No public or -private interaction with the people involved, including unsolicited interaction -with those enforcing the Code of Conduct, is allowed during this period. -Violating these terms may lead to a permanent ban. - -### 4. Permanent Ban - -**Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an -individual, or aggression toward or disparagement of classes of individuals. - -**Consequence**: A permanent ban from any sort of public interaction within the -community. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], -version 2.1, available at -[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. - -Community Impact Guidelines were inspired by -[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. - -For answers to common questions about this code of conduct, see the FAQ at -[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at -[https://www.contributor-covenant.org/translations][translations]. - -[homepage]: https://www.contributor-covenant.org -[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html -[Mozilla CoC]: https://github.com/mozilla/diversity -[FAQ]: https://www.contributor-covenant.org/faq -[translations]: https://www.contributor-covenant.org/translations diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index d3230b8..0000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,136 +0,0 @@ -# Contribution Guidelines - -πŸ™ Thank you for taking the time to contribute! - -Your input is deeply valued, whether an issue, a pull request, or even feedback, regardless of size, content or scope. - -## Table of contents - -[πŸ‘Ά Getting started](#getting-started) - -[πŸ“” Code of Conduct](#code-of-conduct) - -[πŸ—ƒ License](#license) - -[πŸ“œ Issues](#issues) - -[🚩 Pull requests](#pull-requests) - -[πŸ’» Coding guidelines](#coding-guidelines) - -[πŸ† Recognition model](#recognition-model) - -[❓ Questions](#questions) - -## Getting started - -Please refer the project [documentation][docs] for a brief introduction. Please also see other [articles][articles] within the project documentation for additional information. - -## Code of Conduct - -A [Code of Conduct](CODE_OF_CONDUCT.md) governs this project. Participants and contributors are expected to follow the rules outlined therein. - -## License - -All your contributions will be covered by this project's [license][license]. - -## Issues - -We use GitHub to track issues, feature requests, and bugs. Before submitting a new issue, please check if the issue has already been reported. If the issue already exists, please upvote the existing issue πŸ‘. - -For new feature requests, please elaborate on the context and the benefit the feature will have for users, developers, or other relevant personas. - -## Pull requests - -### Github Flow - -This repository uses the [Github Flow](https://docs.github.com/en/get-started/quickstart/github-flow) model for collaboration. To submit a pull request: - -1. Create a branch - - Please see the [branch naming convention](#branch-naming-convention) below. If you don't have write access to this repository, please fork it. - -2. Make changes - - Make sure your code - * passes all checks imposed by GitHub Actions - * is well documented - * is well tested with unit tests sufficiently covering the changes introduced - -3. Create a pull request (PR) - - In the pull request description, please link the relevant issue (if any), provide a detailed description of the change, and include any assumptions. - -4. Address review comments, if any - -5. Post approval - - Merge your PR if you have write access. Otherwise, the reviewer will merge the PR on your behalf. - -6. Pat yourself on the back - - Congratulations! πŸŽ‰ - You are now an official contributor to this project! We are grateful for your contribution. - -### Branch naming convention - -Suppose your changes are related to a current issue in the current project; please name your branch as follows: `_`. Please use underscore (`_`) as a delimiter for word separation. For example, `420_fix_ui_bug` would be a suitable branch name if your change is resolving and UI-related bug reported in issue number `420` in the current project. - -If your change affects multiple repositories, please name your branches as follows: `__`. For example, `69_awesomeproject_fix_spelling_error` would reference issue `69` reported in project `awesomeproject` and aims to resolve one or more spelling errors in multiple (likely related) repositories. - -### `monorepo` and `staged.dependencies` - -Sometimes you might need to change upstream dependent package(s) to be able to submit a meaningful change. We are using [`staged.dependencies`](https://github.com/openpharma/staged.dependencies) functionality to simulate a `monorepo` behavior. The dependency configuration is already specified in this project's `staged_dependencies.yaml` file. You need to name the feature branches appropriately. _This is the only exception from the branch naming convention described above_. - -Please refer to the [staged.dependencies package documentation](https://openpharma.github.io/staged.dependencies/) for more details. - -## Coding guidelines - -This repository follows some unified processes and standards adopted by its maintainers to ensure software development is carried out consistently within teams and cohesively across other repositories. - -### Style guide - -This repository follows the standard [`tidyverse` style guide](https://style.tidyverse.org/) and uses [`lintr`](https://github.com/r-lib/lintr) for lint checks. Customized lint configurations are available in this repository's `.lintr` file. - -### Dependency management - -Lightweight is the right weight. This repository follows [tinyverse](https://www.tinyverse.org/) recommedations of limiting dependencies to minimum. - -### Dependency version management - -If the code is not compatible with all (!) historical versions of a given dependenct package, it is required to specify minimal version in the `DESCRIPTION` file. In particular: if the development version requires (imports) the development version of another package - it is required to put `abc (>= 1.2.3.9000)`. - -### Recommended development environment & tools - -#### R & package versions - -We continuously test our packages against the newest R version along with the most recent dependencies from CRAN and BioConductor. We recommend that your working environment is also set up in the same way. You can find the details about the R version and packages used in the `R CMD check` GitHub Action execution log - there is a step that prints out the R `sessionInfo()`. - -If you discover bugs on older R versions or with an older set of dependencies, please create the relevant bug reports. - -#### `pre-commit` - -We highly recommend that you use the [`pre-commit`](https://pre-commit.com/) tool combined with [`R hooks for pre-commit`](https://github.com/lorenzwalthert/precommit) to execute some of the checks before committing and pushing your changes. - -Pre-commit hooks are already available in this repository's `.pre-commit-config.yaml` file. - -## Recognition model - -As mentioned previously, all contributions are deeply valued and appreciated. While all contribution data is available as part of the [repository insights][insights], to recognize a _significant_ contribution and hence add the contributor to the package authors list, the following rules are enforced: - -* Minimum 5% of lines of code authored* (determined by `git blame` query) OR -* Being at the top 5 contributors in terms of number of commits OR lines added OR lines removed* - -*Excluding auto-generated code, including but not limited to `roxygen` comments or `renv.lock` files. - -The package maintainer also reserves the right to adjust the criteria to recognize contributions. - -## Questions - -If you have further questions regarding the contribution guidelines, please contact the package/repository maintainer. - - -[docs]: https://insightsengineering.github.io/r.pkg.template/index.html -[articles]: https://insightsengineering.github.io/r.pkg.template/main/articles/index.html -[license]: https://insightsengineering.github.io/r.pkg.template/main/LICENSE-text.html -[insights]: https://github.com/insightsengineering/r.pkg.template/pulse diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml deleted file mode 100644 index cf47384..0000000 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -name: 🐞 Bug Report -description: File a bug report -title: "[Bug]: " -labels: ["bug"] -body: - - type: markdown - attributes: - value: | - Thanks for taking the time to fill out this bug report! - - type: textarea - id: what-happened - attributes: - label: What happened? - description: Also tell us, what did you expect to happen? - placeholder: Tell us what you see! - value: "A bug happened!" - validations: - required: true - - type: dropdown - id: r-version - attributes: - label: Which version(s) of R were you using? - multiple: true - options: - - "3.6.x" - - "4.1.x" - - "4.2.x" - - "Other" - - type: textarea - id: logs - attributes: - label: Relevant log output - description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. - render: R - - type: checkboxes - id: code-of-conduct - attributes: - label: Code of Conduct - description: By submitting this issue, you agree to follow our [Code of Conduct](https://insightsengineering.github.io/r.pkg.template/CODE_OF_CONDUCT.html) - options: - - label: I agree to follow this project's Code of Conduct. - required: true - - type: checkboxes - id: contributor-guidelines - attributes: - label: Contribution Guidelines - description: By submitting this issue, you agree to follow our [Contribution Guidelines](https://insightsengineering.github.io/r.pkg.template/CONTRIBUTING.html) - options: - - label: I agree to follow this project's Contribution Guidelines. - required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index d17075b..0000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -blank_issues_enabled: true - -contact_links: - - name: We are hiring! - url: https://careers.gene.com/ - about: Genentech and Roche are hiring! - - name: Pharmaverse - url: https://pharmaverse.org/ - about: Related projects @ Pharmaverse.org diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml deleted file mode 100644 index 5efe065..0000000 --- a/.github/ISSUE_TEMPLATE/feature.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -name: ✨ Feature Request -description: Request or propose a new feature -title: "[Feature Request]: <title>" -labels: ["enhancement"] -body: - - type: textarea - attributes: - label: Feature description - validations: - required: true - - type: checkboxes - id: code-of-conduct - attributes: - label: Code of Conduct - description: By submitting this issue, you agree to follow our [Code of Conduct](https://insightsengineering.github.io/r.pkg.template/CODE_OF_CONDUCT.html) - options: - - label: I agree to follow this project's Code of Conduct. - required: true - - type: checkboxes - id: contributor-guidelines - attributes: - label: Contribution Guidelines - description: By submitting this issue, you agree to follow our [Contribution Guidelines](https://insightsengineering.github.io/r.pkg.template/CONTRIBUTING.html) - options: - - label: I agree to follow this project's Contribution Guidelines. - required: true diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml deleted file mode 100644 index b3e46c1..0000000 --- a/.github/ISSUE_TEMPLATE/question.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -name: ❓ Question -description: Question about usage or documentation -title: "[Question]: <title>" -labels: ["question"] -body: - - type: textarea - attributes: - label: What is your question? - validations: - required: true - - type: checkboxes - id: code-of-conduct - attributes: - label: Code of Conduct - description: By submitting this issue, you agree to follow our [Code of Conduct](https://insightsengineering.github.io/r.pkg.template/CODE_OF_CONDUCT.html) - options: - - label: I agree to follow this project's Code of Conduct. - required: true - - type: checkboxes - id: contributor-guidelines - attributes: - label: Contribution Guidelines - description: By submitting this issue, you agree to follow our [Contribution Guidelines](https://insightsengineering.github.io/r.pkg.template/CONTRIBUTING.html) - options: - - label: I agree to follow this project's Contribution Guidelines. - required: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 81c84dc..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,3 +0,0 @@ -# Pull Request - -<!-- Please describe your pull request here --> diff --git a/.github/workflows/audit.yaml b/.github/workflows/audit.yaml deleted file mode 100644 index 9c16774..0000000 --- a/.github/workflows/audit.yaml +++ /dev/null @@ -1,79 +0,0 @@ -name: Audit Dependencies πŸ•΅οΈβ€β™€οΈ - -on: - push: - branches: - - main - pull_request: - types: - - opened - - synchronize - - reopened - - ready_for_review - branches: - - main - workflow_dispatch: - workflow_call: - -jobs: - audit: - runs-on: ubuntu-latest - container: - image: ghcr.io/insightsengineering/rstudio_4.2.2_bioc_3.16:latest - name: oysteR scan πŸ¦ͺ - if: > - !contains(github.event.commits[0].message, '[skip audit]') - && github.event.pull_request.draft == false - steps: - - name: Checkout repo πŸ›Ž - uses: actions/checkout@v3 - - - name: Run oysteR scan on dependencies πŸ” - run: | - tryCatch( - expr = { - dependencies_scan = oysteR::audit_description( - dir = ".", - fields = c("Depends", "Imports", "Suggests"), - verbose = TRUE - ) - print(as.data.frame( - dependencies_scan[c( - "package", - "version", - "vulnerabilities", - "no_of_vulnerabilities" - )] - )) - }, - error = function(e) { - message('🚨 Caught an error!') - print(e) - } - ) - shell: Rscript {0} - - - name: Run oysteR scan on renv.lock πŸ”’ - run: | - tryCatch( - expr = { - if (file.exists("renv.lock")) { - renv_lock_scan = oysteR::audit_renv_lock(dir = ".", verbose = TRUE) - print(as.data.frame( - renv_lock_scan[c( - "package", - "version", - "vulnerabilities", - "no_of_vulnerabilities" - )] - )) - } else { - print("No renv.lock file, not scanning.") - } - }, - error = function(e) { - message('🚨 Caught an error!') - print(e) - } - ) - shell: Rscript {0} diff --git a/.github/workflows/bioccheck.yaml b/.github/workflows/bioccheck.yaml deleted file mode 100644 index a579752..0000000 --- a/.github/workflows/bioccheck.yaml +++ /dev/null @@ -1,108 +0,0 @@ ---- -name: BiocCheck ☣️ - -on: - push: - tags: - - "v*" - branches: - - main - pull_request: - types: - - opened - - synchronize - - reopened - - ready_for_review - branches: - - main - workflow_dispatch: - workflow_call: - secrets: - REPO_GITHUB_TOKEN: - description: | - Github token with read access to repositories, required for staged.dependencies installation - required: false - inputs: - enable-bioccheck: - description: Enable BiocCheck - required: false - type: boolean - default: false - install-system-dependencies: - description: Check for and install system dependencies - required: false - default: false - type: boolean - enable-staged-dependencies-check: - description: Enable staged dependencies YAML check - required: false - default: true - type: boolean - allow-failure: - description: BiocCheck errors will not fail, but will give a warning. - required: false - type: boolean - default: false - -concurrency: - group: bioccheck-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - bioccheck: - strategy: - fail-fast: false - matrix: - config: - - image: ghcr.io/insightsengineering/rstudio_4.2.2_bioc_3.16 - tag: latest - name: ${{ matrix.config.image }}, version ${{ matrix.config.tag }} - runs-on: ubuntu-latest - if: > - !contains(github.event.commits[0].message, '[skip bioccheck]') - && contains(inputs.enable-bioccheck, 'true') - && github.event.pull_request.draft == false - container: - image: ${{ matrix.config.image }}:${{ matrix.config.tag }} - - steps: - - name: Get branch names 🌿 - id: branch-name - uses: tj-actions/branch-names@v6 - - - name: Checkout repo (PR) πŸ›Ž - uses: actions/checkout@v3 - if: github.event_name == 'pull_request' - with: - ref: ${{ steps.branch-name.outputs.head_ref_branch }} - path: ${{ github.event.repository.name }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - - name: Checkout repo πŸ›Ž - uses: actions/checkout@v3 - if: github.event_name != 'pull_request' - with: - ref: ${{ steps.branch-name.outputs.head_ref_branch }} - path: ${{ github.event.repository.name }} - - - name: Restore SD cache πŸ’° - uses: actions/cache@v3 - with: - key: sd-${{ runner.os }}-${{ github.event.repository.name }} - path: ~/.staged.dependencies - - - name: Run Staged dependencies 🎦 - uses: insightsengineering/staged-dependencies-action@v1 - env: - GITHUB_PAT: ${{ secrets.REPO_GITHUB_TOKEN }} - with: - path: ${{ github.event.repository.name }} - enable-check: ${{ inputs.enable-staged-dependencies-check }} - run-system-dependencies: ${{ inputs.install-system-dependencies }} - - - name: Run BiocCheck ☣️ - uses: insightsengineering/bioc-check-action@v1 - with: - path: ${{ github.event.repository.name }} - no-check-version-num: true - allow-failure: ${{ inputs.allow-failure }} diff --git a/.github/workflows/build-check-install.yaml b/.github/workflows/build-check-install.yaml deleted file mode 100644 index 3e087b8..0000000 --- a/.github/workflows/build-check-install.yaml +++ /dev/null @@ -1,377 +0,0 @@ ---- -name: R CMD Check 🧬 - -on: - push: - tags: - - "v*" - branches: - - main - pull_request: - types: - - opened - - synchronize - - reopened - - ready_for_review - branches: - - main - workflow_dispatch: - workflow_call: - secrets: - REPO_GITHUB_TOKEN: - description: | - Github token with read access to repositories, required for staged.dependencies installation - required: false - inputs: - install-system-dependencies: - description: Check for and install system dependencies - required: false - default: false - type: boolean - enable-staged-dependencies-check: - description: Enable staged dependencies YAML check - required: false - default: true - type: boolean - R_CHECK_FORCE_SUGGESTS: - description: If true, give an error if suggested packages are not available - required: false - default: true - type: boolean - skip-r-cmd-check: - description: Skip the R CMD check step in this workflow - required: false - default: false - type: boolean - skip-r-cmd-install: - description: Skip the R CMD INSTALL step in this workflow - required: false - default: false - type: boolean - enforce-note-blocklist: - description: Whether to check for specific NOTEs via regexes that should cause the pipeline to fail - required: false - default: false - type: boolean - note-blocklist: - description: | - List of regular expressions appearing in NOTEs that should cause the pipeline to fail. - Example usage: - note-blocklist: | - checking package dependencies ... NOTE( )+Depends: includes the non-default packages - checking R code for possible problems ... NOTE( )+.*: no visible global function definition for - checking for unstated dependencies in vignettes ... NOTE( )+\'.*\' import not declared from - checking dependencies in R code ... NOTE( )+Namespace in Imports field not imported from - checking installed package size ... NOTE( )+installed size is - required: false - default: "" - type: string - additional-r-cmd-check-params: - description: Additional flags or parameters to add to R CMD check - required: false - default: "" - type: string - disable-unit-test-reports: - description: Do not produce unit test reports - required: false - default: false - type: boolean - additional-env-vars: - description: | - Extra environment variables, as a 'key=value' pair, with each pair on a new line. - Example usage: - additional-env-vars: | - ABC=123 - XYZ=456 - required: false - default: "" - type: string - -concurrency: - group: r-cmd-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - build-install-check: - strategy: - fail-fast: false - matrix: - config: - - image: ghcr.io/insightsengineering/rstudio_4.2.2_bioc_3.16 - tag: latest - name: ${{ matrix.config.image }}, version ${{ matrix.config.tag }} - runs-on: ubuntu-latest - if: > - !contains(github.event.commits[0].message, '[skip r-cmd]') - && github.event.pull_request.draft == false - container: - image: ${{ matrix.config.image }}:${{ matrix.config.tag }} - - steps: - - name: Get branch names 🌿 - id: branch-name - uses: tj-actions/branch-names@v6 - - - name: Checkout repo (PR) πŸ›Ž - uses: actions/checkout@v3 - if: github.event_name == 'pull_request' - with: - ref: ${{ steps.branch-name.outputs.head_ref_branch }} - path: ${{ github.event.repository.name }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - - name: Checkout repo πŸ›Ž - uses: actions/checkout@v3 - if: github.event_name != 'pull_request' - with: - ref: ${{ steps.branch-name.outputs.head_ref_branch }} - path: ${{ github.event.repository.name }} - - - name: Restore SD cache πŸ’° - uses: actions/cache@v3 - with: - key: sd-${{ runner.os }}-${{ github.event.repository.name }} - path: ~/.staged.dependencies - - - name: Run Staged dependencies 🎦 - uses: insightsengineering/staged-dependencies-action@v1 - env: - GITHUB_PAT: ${{ secrets.REPO_GITHUB_TOKEN }} - with: - path: ${{ github.event.repository.name }} - enable-check: ${{ inputs.enable-staged-dependencies-check }} - run-system-dependencies: ${{ inputs.install-system-dependencies }} - - - name: Show session info and installed packages β„Ή - run: | - sessionInfo() - as.data.frame(installed.packages()[, c("LibPath", "Version")]) - if (grepl("--as-cran", "${{ inputs.additional-r-cmd-check-params }}", fixed = TRUE)) { - x <- desc::desc_del("Remotes") - } - if ("${{ inputs.disable-unit-test-reports }}" != "true") { - x <- desc::desc_set_dep("xml2", "Suggests") - } - shell: Rscript {0} - working-directory: ${{ github.event.repository.name }} - - - name: Replace testthat.R for test reporting 🎚 - if: inputs.disable-unit-test-reports != 'true' - run: | - if [ -f "tests/testthat.R" ]; then { - # Overwrite testthat.R for JUnit XML reporting - cat > tests/testthat.R <<EOF - pkg_name <- "${{ github.event.repository.name }}" - if (requireNamespace("testthat", quietly = TRUE)) { - library(testthat) - reporter <- MultiReporter\$new(list( - CheckReporter\$new(), - JunitReporter\$new(file = "junit-result.xml") - )) - test_check(pkg_name, reporter = reporter) - } - EOF - } - cat tests/testthat.R - fi - shell: bash - working-directory: ${{ github.event.repository.name }} - - - name: Build R package πŸ— - run: | - if [ "${{ inputs.additional-env-vars }}" != "" ] - then { - echo -e "${{ inputs.additional-env-vars }}" > /tmp/dotenv.env - export $(tr '\n' ' ' < /tmp/dotenv.env) - } - fi - R CMD build ${{ github.event.repository.name }} - echo "PKGBUILD=$(echo ${{ github.event.repository.name }}_*.tar.gz)" >> $GITHUB_ENV - shell: bash - - - name: Set TESTING_DEPTH βš™ - env: - COMMIT_NEWEST_MESSAGE: ${{ github.event.head_commit.message }} - COMMIT_OLDEST_MESSAGE: ${{ github.event.commits[0].message }} - run: | - # set TESTING_DEPTH for PR - if [[ ! -z "${GITHUB_HEAD_REF}" ]]; then - TESTING_DEPTH=3 - echo "TESTING_DEPTH=3" >> $GITHUB_ENV - COMMIT_NEWEST_MESSAGE=$(git log --format=%B -n 1 ${{ github.event.after }}) - fi - if [[ $COMMIT_NEWEST_MESSAGE == *"[skip tests]"* ]]; then - echo "NO_TESTS=1" >> $GITHUB_ENV - fi - # default TESTING_DEPTH - if [[ -z "${TESTING_DEPTH}" ]]; then - echo "TESTING_DEPTH=1" >> $GITHUB_ENV - fi - shell: bash - working-directory: ${{ github.event.repository.name }} - - - name: Run R CMD check 🏁 - run: | - if [ "${{ inputs.skip-r-cmd-check }}" == "true" ] - then { - echo "Skipping R CMD check as 'skip-r-cmd-check' was set to 'true'" - exit 0 - } - fi - if [ "${{ inputs.R_CHECK_FORCE_SUGGESTS }}" == "" ] - then { - _R_CHECK_FORCE_SUGGESTS_="FALSE" - } - fi - ADDITIONAL_PARAMS=${{ inputs.additional-r-cmd-check-params }} - if [[ ! -z "${{ env.NO_TESTS }}" ]] - then { - ADDITIONAL_PARAMS="${ADDITIONAL_PARAMS} --no-tests" - } - fi - if [ "${{ inputs.additional-env-vars }}" != "" ] - then { - echo -e "${{ inputs.additional-env-vars }}" > /tmp/dotenv.env - export $(tr '\n' ' ' < /tmp/dotenv.env) - } - fi - Rscript - <<EOF - if ("${{ inputs.disable-unit-test-reports }}" != "true") { - if (!require("xml2")) { - install.packages("xml2", repos = "https://cloud.r-project.org", quiet = TRUE) - } - } - EOF - R CMD check ${ADDITIONAL_PARAMS} ${{ env.PKGBUILD }} - shell: bash - continue-on-error: true - env: - _R_CHECK_TESTS_NLINES_: 0 - _R_CHECK_VIGNETTES_NLINES_: 0 - _R_CHECK_FORCE_SUGGESTS_: ${{ inputs.R_CHECK_FORCE_SUGGESTS }} - - - name: Check whether JUnit XML report exists 🚦 - id: check-junit-xml - uses: andstor/file-existence-action@v2 - with: - files: "${{ github.event.repository.name }}.Rcheck/tests/testthat/junit-result.xml" - - - name: Publish Unit Test Summary πŸ“‘ - uses: EnricoMi/publish-unit-test-result-action@v2 - id: test-results - if: steps.check-junit-xml.outputs.files_exists == 'true' && github.event_name == 'pull_request' - with: - check_name: Unit Tests Summary - junit_files: "${{ github.event.repository.name }}.Rcheck/tests/testthat/junit-result.xml" - - - name: Catch warnings in R CMD check output πŸ—³ - id: catch-errors - run: | - check_log <- "${{ github.event.repository.name }}.Rcheck/00check.log" - if (file.exists(check_log)) { - x <- tail(readLines(check_log), 1) - if (grepl("ERROR", x)) { - writeLines(readLines(check_log)) - stop("❌ R CMD check has errors") - } - if (grepl("WARNING", x)) { - writeLines(readLines(check_log)) - stop("⚠ R CMD check has warnings") - } - if ("${{ inputs.enforce-note-blocklist }}" == "true") { - print("Checking notes...") - regexes <- "${{ inputs.note-blocklist }}" - regexes <- unlist(strsplit(regexes, split = "\n")) - lines <- paste(readLines(check_log), collapse = " ") - notes_result <- vapply( - regexes, - function(r){ - if (grepl(r, lines)) { - print(r) - return(TRUE) - } - return(FALSE) - }, - logical(1) - ) - if (any(notes_result)) { - stop("NOTEs on the blocklist were found (see above).") - } - } - } - shell: Rscript {0} - - - name: Install R package 🚧 - run: | - if [ "${{ inputs.skip-r-cmd-install }}" == "true" ] - then { - echo "Skipping R CMD INSTALL as 'skip-r-cmd-install' was set to 'true'" - exit 0 - } - fi - if [ "${{ inputs.additional-env-vars }}" != "" ] - then { - echo -e "${{ inputs.additional-env-vars }}" > /tmp/dotenv.env - export $(tr '\n' ' ' < /tmp/dotenv.env) - } - fi - R CMD INSTALL ${{ env.PKGBUILD }} - shell: bash - - - name: Rebuild R package πŸ— - if: inputs.disable-unit-test-reports != 'true' - run: | - # Undo changes to DESCRIPTION and tests/testthat.R - git checkout DESCRIPTION - if [ -f "tests/testthat.R" ]; then - git checkout tests/testthat.R - fi - if [ "${{ inputs.additional-env-vars }}" != "" ] - then { - echo -e "${{ inputs.additional-env-vars }}" > /tmp/dotenv.env - export $(tr '\n' ' ' < /tmp/dotenv.env) - } - fi - R CMD build . - echo "PKGBUILD=$(echo ${{ github.event.repository.name }}_*.tar.gz)" >> $GITHUB_ENV - shell: bash - working-directory: ${{ github.event.repository.name }} - - - name: Upload package build ‴ - if: startsWith(github.ref, 'refs/tags/v') - uses: actions/upload-artifact@v3 - with: - path: ${{ github.event.repository.name }}/${{ env.PKGBUILD }} - name: ${{ env.PKGBUILD }} - - upload-release-assets: - name: Upload build tar.gz - needs: build-install-check - runs-on: ubuntu-latest - if: > - startsWith(github.ref, 'refs/tags/v') - && (!contains(github.event.commits[0].message, '[skip r-cmd]')) - && github.event.pull_request.draft == false - steps: - - name: Checkout repo πŸ›Ž - uses: actions/checkout@v3 - - - name: Set release version and package build filename πŸ“ - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV - - - name: Get package build filename πŸ“¦ - run: echo "PKGBUILD=${{ github.event.repository.name }}_${{ env.RELEASE_VERSION }}.tar.gz" >> $GITHUB_ENV - - - name: Download artifact ⏬ - uses: actions/download-artifact@v3 - with: - name: ${{ env.PKGBUILD }} - - - name: Upload binaries to release πŸ”Ό - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{ env.PKGBUILD }} - asset_name: ${{ env.PKGBUILD }} - tag: ${{ github.ref }} - overwrite: true diff --git a/.github/workflows/check.yaml.shared b/.github/workflows/check.yaml similarity index 100% rename from .github/workflows/check.yaml.shared rename to .github/workflows/check.yaml diff --git a/.github/workflows/docs.yaml.shared b/.github/workflows/docs.yaml similarity index 100% rename from .github/workflows/docs.yaml.shared rename to .github/workflows/docs.yaml diff --git a/.github/workflows/gitleaks.yaml b/.github/workflows/gitleaks.yaml deleted file mode 100644 index 0937657..0000000 --- a/.github/workflows/gitleaks.yaml +++ /dev/null @@ -1,91 +0,0 @@ ---- -name: gitleaks πŸ’§ - -on: - push: - branches: - - main - pull_request: - types: - - opened - - synchronize - - reopened - - ready_for_review - branches: - - main - workflow_dispatch: - workflow_call: - inputs: - additional_args: - description: Additional arguments to pass to 'gitleaks detect' - required: false - type: string - default: "" - -concurrency: - group: gitleaks-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - gitleaks: - name: gitleaks πŸ’§ - runs-on: ubuntu-latest - if: > - !contains(github.event.commits[0].message, '[skip gitleaks]') - && github.event.pull_request.draft == false - steps: - - name: Checkout repo πŸ›Ž - uses: actions/checkout@v3 - - - name: Download and install gitleaks πŸ’§ - run: | - cd /tmp - sudo wget -q \ - "https://github.com/zricethezav/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" \ - -O gitleaks.tar.gz || \ - (echo "Error downloading gitleaks ${GITLEAKS_VERSION} tarball" && exit 1) - sudo tar -xvzf gitleaks.tar.gz || \ - (echo "Error unarchiving gitleaks ${GITLEAKS_VERSION} tarball" && exit 1) - sudo mv gitleaks /usr/bin/. || \ - (echo "Error moving gitleaks for /usr/bin" && exit 1) - shell: bash - env: - GITLEAKS_VERSION: "8.3.0" - - - name: Run gitleaks β˜” - run: gitleaks -v detect --no-git ${{ inputs.additional_args }} --source . - shell: bash - - pii-check: - name: PII Check πŸ’³ - runs-on: ubuntu-latest - if: > - !contains(github.event.commits[0].message, '[skip pii-check]') - && github.event.pull_request.draft == false - steps: - - name: Checkout repo πŸ›Ž - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Run Presidio β˜” - uses: insightsengineering/presidio-action@v1 - with: - configuration-data: | - threshold: 0.95 - ignore: | - .git - **/*.svg - **/*.png - **/*.rds - **/*.rda - **/*.jpg - **/*.gif - .gitlab-ci.yml - .Rbuildignore - _pkgdown.yml - inst/WORDLIST - **/*.RData - **/*.xlsx - output: "github" - only-changed-files: true diff --git a/.github/workflows/grammar.yaml b/.github/workflows/grammar.yaml deleted file mode 100644 index 8423941..0000000 --- a/.github/workflows/grammar.yaml +++ /dev/null @@ -1,119 +0,0 @@ ---- -name: Grammar πŸ““ - -on: - push: - branches: - - main - pull_request: - types: - - opened - - synchronize - - reopened - - ready_for_review - branches: - - main - workflow_dispatch: - workflow_call: - -concurrency: - group: grammar-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - grammar: - name: Check πŸ“ - runs-on: ubuntu-latest - if: > - !contains(github.event.commits[0].message, '[skip grammar]') - && github.event.pull_request.draft == false - - steps: - - name: Checkout Code πŸ›Ž - uses: actions/checkout@v3 - - - name: Restore npm cache πŸ’° - uses: actions/cache@v3 - with: - key: npm-${{ runner.os }}-${{ github.job }} - restore-keys: | - npm-${{ runner.os }}- - path: node_modules - - - name: Setup NodeJS ☊ - uses: actions/setup-node@v3 - id: npm-cache - with: - node-version: 18 - - - name: Install write-good and deps ⏬ - if: steps.npm-cache.outputs.cache-hit != 'true' - run: npm install write-good fs - shell: bash - - - name: Get changed files πŸ—ž - id: changed-files - uses: tj-actions/changed-files@v35 - with: - separator: "," - files: | - **.R - **.Rmd - **.Rnw - **.Rmarkdown - **.qmd - **.md - - - name: Run write-good πŸƒβ€β™€οΈ - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const writeGood = require('write-good'); - const path = require('path'); - const fs = require('fs'); - const changedFiles = "${{ steps.changed-files.outputs.all_changed_files }}"; - if (!changedFiles || changedFiles.length === 0) { - process.exit(0); - } - let files = changedFiles.split(","); - let allSuggestions = []; - files.forEach((file) => { - if (fs.lstatSync(file).isFile() && - !path.dirname(file).startsWith("node_modules")) { - const contents = fs.readFileSync(file, 'utf8'); - const suggestions = writeGood(contents); - const annotations = writeGood.annotate(contents, suggestions, true); - if (annotations.length) { - for (var i=0; i < annotations.length; i++) { - let ann = annotations[i]; - ann['message'] = ann['reason']; - ann['start_column'] = ann['col']; - ann['end_column'] = ann['col']; - ann['start_line'] = ann['line']; - ann['end_line'] = ann['line']; - ann['annotation_level'] = 'notice'; - ann['path'] = file; - delete ann['reason']; - delete ann['col']; - delete ann['line']; - allSuggestions.push(ann); - } - } - } - }); - fs.writeFileSync('./annotations.json', JSON.stringify(allSuggestions, null, 2) , 'utf-8'); - - - name: Check whether annotations exist πŸ’­ - id: check-annotations - uses: andstor/file-existence-action@v2 - with: - files: "annotations.json" - - - name: Annotate files for grammar suggestions ✍️ - if: steps.check-annotations.outputs.files_exists == 'true' - uses: kibalabs/github-action-create-annotations@v0.2.0 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - json-file-path: ./annotations.json - fail-on-error: false diff --git a/.github/workflows/licenses.yaml b/.github/workflows/licenses.yaml deleted file mode 100644 index 0436053..0000000 --- a/.github/workflows/licenses.yaml +++ /dev/null @@ -1,36 +0,0 @@ -name: License report πŸ—ƒ - -on: - push: - branches: - - main - pull_request: - types: - - opened - - synchronize - - reopened - - ready_for_review - branches: - - main - workflow_dispatch: - workflow_call: - -concurrency: - group: licenses-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - licenses: - runs-on: ubuntu-latest - name: Check 🚩 - if: > - !contains(github.event.commits[0].message, '[skip licenses]') - && github.event.pull_request.draft == false - steps: - - name: Checkout repo πŸ›Ž - uses: actions/checkout@v3 - - - name: Generate license report πŸ“œ - uses: insightsengineering/r-license-report@v1 - with: - regex: "^AGPL.*" diff --git a/.github/workflows/links.yaml b/.github/workflows/links.yaml deleted file mode 100644 index 4f38e09..0000000 --- a/.github/workflows/links.yaml +++ /dev/null @@ -1,55 +0,0 @@ ---- -name: Check URLs 🌐 - -on: - push: - branches: - - main - pull_request: - types: - - opened - - synchronize - - reopened - - ready_for_review - branches: - - main - workflow_dispatch: - workflow_call: - inputs: - additional_args: - description: Additional arguments to pass to lychee - required: false - type: string - default: "" - -concurrency: - group: links-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - links: - name: Validate Links πŸ”Ž - runs-on: ubuntu-latest - if: > - !contains(github.event.commits[0].message, '[skip links]') - && github.event.pull_request.draft == false - steps: - - name: Checkout repo πŸ›Ž - uses: actions/checkout@v3 - - - name: Check URLs in docs πŸ”¬ - uses: lycheeverse/lychee-action@v1.5.1 - with: - args: >- - --exclude-private - --exclude "https://github.com.*.git|https://insightsengineering.github.io.*|lewagon.*|knightdave.*|.*users.noreply.github.com|lycheeverse.*" - --verbose - --no-progress - ${{ inputs.additional_args }} - **/*.md - **/*.html - **/*.Rmd - **/*.yaml - **/*.yml - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml deleted file mode 100644 index 41e6ff4..0000000 --- a/.github/workflows/linter.yaml +++ /dev/null @@ -1,74 +0,0 @@ ---- -name: SuperLinter πŸ¦Έβ€β™€οΈ - -on: - push: - branches: - - main - pull_request: - types: - - opened - - synchronize - - reopened - - ready_for_review - branches: - - main - workflow_dispatch: - workflow_call: - -concurrency: - group: lint-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - lint: - name: SuperLinter πŸ¦Έβ€β™‚οΈ - runs-on: ubuntu-latest - if: > - !contains(github.event.commits[0].message, '[skip linter]') - && github.event.pull_request.draft == false - steps: - - name: Checkout repo πŸ›Ž - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Override SuperLinter configs πŸ’Ύ - run: | - # Override markdownlint default config - [ ! -e .markdownlint.yaml ] && cat > .markdownlint.yaml <<EOF - ############### - # Rules by id # - ############### - MD004: false # Unordered list style - MD007: - indent: 2 # Unordered list indentation - MD013: - line_length: 800 # Line length - MD026: - punctuation: ".,;:!γ€‚οΌŒοΌ›:" # List of not allowed - MD029: false # Ordered list item prefix - MD033: false # Allow inline HTML - MD036: false # Emphasis used instead of a heading - ################# - # Rules by tags # - ################# - blank_lines: true # Error on blank lines - EOF - shell: bash - - - name: Lint Code Base 🧢 - uses: github/super-linter/slim@v4 - env: - LINTER_RULES_PATH: / - DEFAULT_BRANCH: main - FILTER_REGEX_EXCLUDE: NEWS.md|design/.*|testthat/_snaps/.* - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - VALIDATE_ALL_CODEBASE: false - VALIDATE_BASH: true - VALIDATE_DOCKERFILE: true - VALIDATE_MARKDOWN: true - MARKDOWN_CONFIG_FILE: .markdownlint.yaml - VALIDATE_R: true - VALIDATE_YAML: true - LINTR_ERROR_ON_LINT: true diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml deleted file mode 100644 index 3029c69..0000000 --- a/.github/workflows/pkgdown.yaml +++ /dev/null @@ -1,245 +0,0 @@ ---- -name: Pkgdown Docs πŸ“š - -on: - push: - tags: - - "v*" - branches: - - main - pull_request: - types: - - opened - - synchronize - - reopened - - ready_for_review - branches: - - main - paths: - - inst/templates/** - - _pkgdown.yaml - - DESCRIPTION - - "**.md" - - "**.Rmd" - - man/** - - LICENSE.* - - NAMESPACE - workflow_dispatch: - workflow_call: - secrets: - REPO_GITHUB_TOKEN: - description: | - Github token with read access to repositories, required for staged.dependencies installation - required: false - inputs: - install-system-dependencies: - description: Check for and install system dependencies - required: false - default: false - type: boolean - fail-pkgdown-on-warnings: - description: Fail the pkgdown workflow if warnings are generated while generating docs - required: false - default: false - type: boolean - enable-staged-dependencies-check: - description: Enable staged dependencies YAML check - required: false - default: false - type: boolean - additional-env-vars: - description: | - Extra environment variables, as a 'key=value' pair, with each pair on a new line. - Example usage: - additional-env-vars: | - ABC=123 - XYZ=456 - required: false - default: "" - type: string - refs-order: - description: | - The order in which refs should appear in the drop-down list. Versions not in the vector - will appear below refs listed here. - If docs have never been generated for the ref, the ref will not appear in the - drop-down. Similarly, if docs have been generated for the ref, but the ref is not - listed in the vector, it will not appear in the drop-down. - required: false - default: c("devel", "pre-release", "main", "latest-tag") - type: string - default-landing-page: - description: - The default branch or tag on gh-pages that corresponds to the landing page. - For instance, if your root index page on gh-pages is built using the 'main' - branch, then the root page of the website will correspond to this page. - If 'latest-tag' is selected, then the latest version will become the default. - required: false - default: main - type: string - -concurrency: - group: docs-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - docs: - name: Generate 🐣 - runs-on: ubuntu-latest - if: > - !contains(github.event.commits[0].message, '[skip docs]') - && github.event.pull_request.draft == false - container: - image: ghcr.io/insightsengineering/rstudio_4.2.2_bioc_3.16:latest - steps: - - name: Get branch names 🌿 - id: branch-name - uses: tj-actions/branch-names@v6 - - - name: Checkout repo (PR) πŸ›Ž - uses: actions/checkout@v3 - if: github.event_name == 'pull_request' - with: - ref: ${{ steps.branch-name.outputs.head_ref_branch }} - path: ${{ github.event.repository.name }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - - name: Checkout repo πŸ›Ž - uses: actions/checkout@v3 - if: github.event_name != 'pull_request' - with: - ref: ${{ steps.branch-name.outputs.head_ref_branch }} - path: ${{ github.event.repository.name }} - - - name: Restore SD cache πŸ’° - uses: actions/cache@v3 - with: - key: sd-${{ runner.os }}-${{ github.event.repository.name }} - path: ~/.staged.dependencies - - - name: Run Staged dependencies 🎦 - uses: insightsengineering/staged-dependencies-action@v1 - env: - GITHUB_PAT: ${{ secrets.REPO_GITHUB_TOKEN }} - with: - path: ${{ github.event.repository.name }} - enable-check: ${{ inputs.enable-staged-dependencies-check }} - run-system-dependencies: ${{ inputs.install-system-dependencies }} - - - name: Install R package 🚧 - run: | - if (file.exists("renv.lock")) renv::restore() - install.packages(".", repos=NULL, type="source") - shell: Rscript {0} - working-directory: ${{ github.event.repository.name }} - - - name: Build docs πŸ— - if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/v') - run: | - repo="${{ github.event.repository.name }}" - if [ "${{ inputs.additional-env-vars }}" != "" ] - then { - echo -e "${{ inputs.additional-env-vars }}" > /tmp/dotenv.env - export $(tr '\n' ' ' < /tmp/dotenv.env) - } - fi - Rscript - <<EOF 2>&1 | tee pkgdown_${repo}.log - if (file.exists("renv.lock")) renv::restore() - pkgdown::build_site(devel = TRUE) - EOF - if [ "${{ inputs.fail-pkgdown-on-warnings }}" == "true" ]; then { - grep "Warning message" pkgdown_${repo}.log > pkgdown_warnings_${repo}.log - if [[ $(wc -l <pkgdown_warnings_${repo}.log) -gt 0 ]]; then { - echo "----------------------------------------" - echo "⚠ One or more warnings were generated during the pkgdown build." - echo "Please πŸ™ fix the warnings shown above πŸ‘†" - exit 1 - } - fi - } - fi - shell: bash - working-directory: ${{ github.event.repository.name }} - - - name: Create documentation artifact πŸ“‚ - if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/v') - run: | - pushd ${{ github.event.repository.name }}/docs/ - zip -r9 $OLDPWD/pkgdown.zip * - popd - shell: bash - - - name: Upload docs for review ⬆ - if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/v') - uses: actions/upload-artifact@v3 - with: - name: pkgdown.zip - path: pkgdown.zip - - - name: Publish docs πŸ“’ - if: github.event_name == 'push' - run: | - git config --local user.email "actions@github.com" - git config --local user.name "GitHub Actions" - BRANCH_OR_TAG="${GITHUB_REF##*/}" - if [ "${{ inputs.additional-env-vars }}" != "" ] - then { - echo -e "${{ inputs.additional-env-vars }}" > /tmp/dotenv.env - export $(tr '\n' ' ' < /tmp/dotenv.env) - } - fi - Rscript - <<EOF - if (file.exists("renv.lock")) renv::restore() - pkgdown::deploy_to_branch( - new_process = FALSE, - subdir = "${BRANCH_OR_TAG}", - clean = TRUE - ) - EOF - shell: bash - working-directory: ${{ github.event.repository.name }} - - multi-version-docs: - name: Multi-version docs πŸ“‘ - needs: docs - runs-on: ubuntu-latest - if: > - github.event_name == 'push' - && !contains(github.event.commits[0].message, '[skip docs]') - steps: - - name: Checkout repo πŸ›Ž - uses: actions/checkout@v3 - with: - path: ${{ github.event.repository.name }} - ref: "gh-pages" - - - name: Create and publish docs ↗️ - uses: insightsengineering/r-pkgdown-multiversion@v2 - with: - path: ${{ github.event.repository.name }} - default-landing-page: ${{ inputs.default-landing-page }} - refs-order: ${{ inputs.refs-order }} - - upload-release-assets: - name: Upload documentation assets πŸ”Ό - needs: docs - runs-on: ubuntu-latest - if: > - startsWith(github.ref, 'refs/tags/v') - && !contains(github.event.commits[0].message, '[skip docs]') - steps: - - name: Checkout repo πŸ›Ž - uses: actions/checkout@v3 - - - name: Download artifact ⏬ - uses: actions/download-artifact@v3 - with: - name: pkgdown.zip - - - name: Upload binaries to release ‴ - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: pkgdown.zip - asset_name: pkgdown.zip - tag: ${{ github.ref }} - overwrite: true diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8919e33..096dcaa 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,37 +1,36 @@ --- -name: Release πŸš€ +name: Release 🎈 on: push: tags: - "v*" - workflow_call: workflow_dispatch: -concurrency: - group: release-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - jobs: + build: + name: Build package 🎁 + needs: release + uses: insightsengineering/r.pkg.template/.github/workflows/build-check-install.yaml@main + secrets: + REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} + with: + skip-r-cmd-check: true + skip-r-cmd-install: true + docs: + name: Pkgdown Docs πŸ“š + needs: release + uses: insightsengineering/r.pkg.template/.github/workflows/pkgdown.yaml@main + secrets: + REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} + validation: + name: R Package Validation report πŸ“ƒ + needs: release + uses: insightsengineering/r.pkg.template/.github/workflows/validation.yaml@main + secrets: + REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} release: - name: Release πŸš€ - runs-on: ubuntu-latest - if: "! contains(github.event.commits[0].message, '[skip release]')" + name: Create release πŸŽ‰ + uses: insightsengineering/r.pkg.template/.github/workflows/release.yaml@main permissions: contents: write - steps: - - name: Checkout repo πŸ›Ž - uses: actions/checkout@v3 - - - name: Generate Changelog πŸ“œ - run: | - RELEASE_VERSION=$(awk -F: '/Version:/{gsub(/[ ]+/,"") ; print $2}' DESCRIPTION) - REPOSITORY_NAME="${{ github.event.repository.name }}" - (awk "/^#+.*${REPOSITORY_NAME//./\.}.*${RELEASE_VERSION//./\.}$/{flag=1;next}/^#+.*${REPOSITORY_NAME//./\.}.*/{flag=0}flag" NEWS.md | grep -v "^$" || echo "* ${RELEASE_VERSION}") > RELEASE_BODY.txt - - - name: Create release 🌟 - uses: softprops/action-gh-release@v1 - with: - body_path: RELEASE_BODY.txt - token: ${{ secrets.GITHUB_TOKEN }} - generate_release_notes: true diff --git a/.github/workflows/release.yaml.shared b/.github/workflows/release.yaml.shared deleted file mode 100644 index 096dcaa..0000000 --- a/.github/workflows/release.yaml.shared +++ /dev/null @@ -1,36 +0,0 @@ ---- -name: Release 🎈 - -on: - push: - tags: - - "v*" - workflow_dispatch: - -jobs: - build: - name: Build package 🎁 - needs: release - uses: insightsengineering/r.pkg.template/.github/workflows/build-check-install.yaml@main - secrets: - REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} - with: - skip-r-cmd-check: true - skip-r-cmd-install: true - docs: - name: Pkgdown Docs πŸ“š - needs: release - uses: insightsengineering/r.pkg.template/.github/workflows/pkgdown.yaml@main - secrets: - REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} - validation: - name: R Package Validation report πŸ“ƒ - needs: release - uses: insightsengineering/r.pkg.template/.github/workflows/validation.yaml@main - secrets: - REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} - release: - name: Create release πŸŽ‰ - uses: insightsengineering/r.pkg.template/.github/workflows/release.yaml@main - permissions: - contents: write diff --git a/.github/workflows/roxygen.yaml b/.github/workflows/roxygen.yaml deleted file mode 100644 index 0d0dcbe..0000000 --- a/.github/workflows/roxygen.yaml +++ /dev/null @@ -1,147 +0,0 @@ ---- -name: Roxygen πŸ…Ύ - -on: - push: - branches: - - main - pull_request: - types: - - opened - - synchronize - - reopened - - ready_for_review - branches: - - main - workflow_dispatch: - workflow_call: - inputs: - install-system-dependencies: - description: Check for and install system dependencies - required: false - default: false - type: boolean - enable-staged-dependencies-check: - description: Enable staged dependencies YAML check - required: false - default: false - type: boolean - auto-update: - description: If man pages are not up-to-date, they will be automatically updated and committed back to the branch. - required: false - default: false - type: boolean - secrets: - REPO_GITHUB_TOKEN: - description: | - Github token with read access to repositories, required for staged.dependencies installation - required: false - -concurrency: - group: roxygen-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - roxygen: - name: Manual pages check 🏁 - runs-on: ubuntu-latest - if: > - !contains(github.event.commits[0].message, '[skip roxygen]') - && github.event.pull_request.draft == false - container: - image: ghcr.io/insightsengineering/rstudio_4.2.2_bioc_3.16:latest - - steps: - - name: Get branch names 🌿 - id: branch-name - uses: tj-actions/branch-names@v6 - - - name: Checkout repo (PR) πŸ›Ž - uses: actions/checkout@v3 - if: github.event_name == 'pull_request' - with: - ref: ${{ steps.branch-name.outputs.head_ref_branch }} - path: ${{ github.event.repository.name }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - - name: Checkout repo πŸ›Ž - uses: actions/checkout@v3 - if: github.event_name != 'pull_request' - with: - ref: ${{ steps.branch-name.outputs.head_ref_branch }} - path: ${{ github.event.repository.name }} - - - name: Restore SD cache πŸ’° - uses: actions/cache@v3 - with: - key: sd-${{ runner.os }}-${{ github.event.repository.name }} - path: ~/.staged.dependencies - - - name: Run Staged dependencies 🎦 - uses: insightsengineering/staged-dependencies-action@v1 - env: - GITHUB_PAT: ${{ secrets.REPO_GITHUB_TOKEN }} - with: - path: ${{ github.event.repository.name }} - enable-check: ${{ inputs.enable-staged-dependencies-check }} - run-system-dependencies: ${{ inputs.install-system-dependencies }} - - - name: Generate man pages πŸ“„ - run: | - logfile <- "roxygen_${{ github.event.repository.name }}.log" - con <- file(logfile) - sink(con, append = TRUE, split = TRUE) - sink(con, append = TRUE, type = "message") - roxygen2::roxygenize('.', roclets = c('rd', 'collate', 'namespace')) - sink() - sink(type = "message") - logs <- readLines(logfile) - error_marker <- grep("Error:", logs) - warnings_marker <- grep("Warning message", logs) - if (length(warnings_marker) > 0) { - cat("⚠ One or more warnings were generated during the roxygen build:\n") - cat(logs[warnings_marker[[1]]:length(logs)], sep = "\n") - stop("Please πŸ™ fix the warnings shown below this message πŸ‘‡") - } - if (length(error_marker) > 0) { - cat("☠ One or more errors were generated during the roxygen build:\n") - cat(logs[error_marker[[1]]:length(logs)], sep = "\n") - stop("Please πŸ™ fix the errors shown below this message πŸ‘‡") - } - shell: Rscript {0} - working-directory: ${{ github.event.repository.name }} - - - name: Roxygen check πŸ…Ύ - run: | - if [[ -n `git status -s | grep -E "man|DESCRIPTION"` ]] - then { - ROXYGEN_VERSION="$(Rscript -e 'packageVersion("roxygen2")' | awk '{print $NF}')" - echo "πŸ™ˆ Manuals are not up-to-date with roxygen comments!" - echo "πŸ”€ The following differences were noted:" - git diff man/* DESCRIPTION - if [ "${{ inputs.auto-update }}" == "true" ] - then { - echo "Regenerating man pages via auto-update" - git config --global user.name "github-actions" - git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add man/* DESCRIPTION - git commit -m "[skip actions] Roxygen Man Pages Auto Update" - git pull origin ${GITHUB_HEAD_REF} - git push -v origin ${GITHUB_HEAD_REF} - } - else { - echo -e "\nπŸ’» Please rerun the following command on your workstation and push your changes" - echo "--------------------------------------------------------------------" - echo "roxygen2::roxygenize('.', roclets = c('rd', 'collate', 'namespace'))" - echo "--------------------------------------------------------------------" - echo "β„Ή roxygen2 version that was used in this workflow: $ROXYGEN_VERSION" - echo "πŸ™ Please ensure that the 'RoxygenNote' field in the DESCRIPTION file matches this version" - exit 1 - } - fi - } else { - echo "πŸ’š Manuals are up-to-date with roxygen comments" - } - fi - shell: bash - working-directory: ${{ github.event.repository.name }} diff --git a/.github/workflows/spelling.yaml b/.github/workflows/spelling.yaml deleted file mode 100644 index 10c52a4..0000000 --- a/.github/workflows/spelling.yaml +++ /dev/null @@ -1,40 +0,0 @@ ---- -name: Spelling πŸ†Ž - -on: - push: - branches: - - main - pull_request: - types: - - opened - - synchronize - - reopened - - ready_for_review - branches: - - main - workflow_dispatch: - workflow_call: - -concurrency: - group: spelling-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - spelling: - name: Check spelling πŸ”  - runs-on: ubuntu-latest - if: > - !contains(github.event.commits[0].message, '[skip spelling]') - && github.event.pull_request.draft == false - container: - image: ghcr.io/insightsengineering/rstudio_4.2.2_bioc_3.16:latest - - steps: - - name: Checkout Code πŸ›Ž - uses: actions/checkout@v3 - - - name: Run Spellcheck πŸ‘Ÿ - uses: insightsengineering/r-spellcheck-action@v2 - with: - exclude: inst/extdata/* diff --git a/.github/workflows/style.yaml b/.github/workflows/style.yaml deleted file mode 100644 index f4d504d..0000000 --- a/.github/workflows/style.yaml +++ /dev/null @@ -1,141 +0,0 @@ ---- -name: Style 🎽 - -on: - push: - branches: - - main - pull_request: - types: - - opened - - synchronize - - reopened - - ready_for_review - branches: - - main - workflow_dispatch: - workflow_call: - inputs: - auto-update: - description: If R code style is not up-to-date, styling will automatically be applied and restyled files will be automatically committed o the branch. - required: false - default: false - type: boolean - -concurrency: - group: style-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - style: - name: Check code style πŸ”  - runs-on: ubuntu-latest - if: > - !contains(github.event.commits[0].message, '[skip style]') - && github.event.pull_request.draft == false - container: - image: ghcr.io/insightsengineering/rstudio_4.2.2_bioc_3.16:latest - - steps: - - name: Checkout Code πŸ›Ž - uses: actions/checkout@v3 - with: - path: ${{ github.event.repository.name }} - fetch-depth: 0 - - - name: Get branch names 🌿 - if: inputs.auto-update - id: branch-name - uses: tj-actions/branch-names@v6 - - - name: Install styler πŸ‘š - run: | - install.packages("styler", repos = "https://cloud.r-project.org") - shell: Rscript {0} - - - name: Get changed files πŸ—ž - id: changed-files - uses: tj-actions/changed-files@v33 - with: - path: ${{ github.event.repository.name }} - separator: "," - files: | - **.R - **.Rmd - **.Rnw - **.Rmarkdown - **.qmd - - - name: Run styler πŸ‘Ÿ - run: | - changed_files <- unlist(strsplit( - "${{ steps.changed-files.outputs.all_changed_files }}", - split="," - )) - is_r_file <- function(x) { - ext <- tools::file_ext(x) - ext %in% c("R", "Rmd", "Rnw", "Rmarkdown", "qmd") - } - changed_r_files <- Filter(is_r_file, changed_files) - dry <- if(isTRUE(as.logical("${{ inputs.auto-update }}"))) "off" else "on" - detect <- styler::style_file(changed_r_files, dry = dry) - if (TRUE %in% detect$changed) { - problems <- subset(detect$file, detect$changed == T) - dput(problems, file = "/tmp/style-problems.R") - writeLines( - problems, - con = "/tmp/style-problems.txt", - sep = " " - ) - } - shell: Rscript {0} - working-directory: ${{ github.event.repository.name }} - - - name: Check file existence - id: check_files - uses: andstor/file-existence-action@v2 - with: - files: "/tmp/style-problems.R, /tmp/style-problems.txt" - - - name: Get problematic files - id: problem-files - if: steps.check_files.outputs.files_exists == 'true' - run: | - perl -p -i -e 's/\R//g;' /tmp/style-problems.R - echo "unstyled-files=$(cat /tmp/style-problems.txt)" >> $GITHUB_OUTPUT - shell: bash - - - name: Autocommit styled files - if: > - inputs.auto-update - && steps.check_files.outputs.files_exists == 'true' - run: | - git config --global user.name 'github-actions' - git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' - git add ${{ steps.problem-files.outputs.unstyled-files }} - git commit -m '[skip actions] Restyle files' - git pull origin ${{ steps.branch-name.outputs.head_ref_branch }} - git push -v origin HEAD:${{ steps.branch-name.outputs.head_ref_branch }} - shell: bash - working-directory: ${{ github.event.repository.name }} - - - name: Styler check summary πŸ…Ύ - if: > - inputs.auto-update != true - && steps.check_files.outputs.files_exists == 'true' - run: | - cat(paste( - "☠ One or more files had styling errors.", - "Please see the log above for remediations,", - "or simply run the following commands", - "for an immediate fix:\n" - )) - cat("────────────────────────────────────────\n") - cat(paste0( - "styler::style_file(", - readLines("/tmp/style-problems.R", warn=FALSE), - ")\n" - )) - cat("────────────────────────────────────────\n") - quit(status = 1) - shell: Rscript {0} diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml deleted file mode 100644 index 0425dfb..0000000 --- a/.github/workflows/test-coverage.yaml +++ /dev/null @@ -1,241 +0,0 @@ ---- -name: Coverage πŸ“” - -on: - push: - branches: - - main - pull_request: - types: - - opened - - synchronize - - reopened - - ready_for_review - branches: - - main - workflow_dispatch: - workflow_call: - inputs: - install-system-dependencies: - description: Check for and install system dependencies - required: false - default: false - type: boolean - enable-staged-dependencies-check: - description: Enable staged dependencies YAML check - required: false - default: false - type: boolean - publish-coverage-report: - description: Publish the coverage report as a pull request comment - required: false - default: true - type: boolean - allow-failure: - description: Allow workflow failure if errors from covtracer are generated - required: false - type: boolean - default: false - enable-covtracer: - description: Enable the covtracer job - required: false - type: boolean - default: false - additional-env-vars: - description: | - Extra environment variables, as a 'key=value' pair, with each pair on a new line. - Example usage: - additional-env-vars: | - ABC=123 - XYZ=456 - required: false - default: "" - type: string - secrets: - REPO_GITHUB_TOKEN: - description: | - Github token with read access to repositories, required - for staged.dependencies installation - required: false - -concurrency: - group: coverage-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - coverage: - name: Coverage πŸ“” - runs-on: ubuntu-latest - if: > - !contains(github.event.commits[0].message, '[skip coverage]') - && github.event.pull_request.draft == false - container: - image: ghcr.io/insightsengineering/rstudio_4.2.2_bioc_3.16:latest - steps: - - name: Get branch names 🌿 - id: branch-name - uses: tj-actions/branch-names@v6 - - - name: Checkout repo (PR) πŸ›Ž - uses: actions/checkout@v3 - if: github.event_name == 'pull_request' - with: - ref: ${{ steps.branch-name.outputs.head_ref_branch }} - path: ${{ github.event.repository.name }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - - name: Checkout repo πŸ›Ž - uses: actions/checkout@v3 - if: github.event_name != 'pull_request' - with: - ref: ${{ steps.branch-name.outputs.head_ref_branch }} - path: ${{ github.event.repository.name }} - - - name: Restore SD cache πŸ’° - uses: actions/cache@v3 - with: - key: sd-${{ runner.os }}-${{ github.event.repository.name }} - path: ~/.staged.dependencies - - - name: Run Staged dependencies 🎦 - uses: insightsengineering/staged-dependencies-action@v1 - env: - GITHUB_PAT: ${{ secrets.REPO_GITHUB_TOKEN }} - with: - path: ${{ github.event.repository.name }} - enable-check: ${{ inputs.enable-staged-dependencies-check }} - run-system-dependencies: ${{ inputs.install-system-dependencies }} - - - name: Install R package 🚧 - run: | - if (file.exists("renv.lock")) renv::restore() - install.packages(".", repos=NULL, type="source") - shell: Rscript {0} - working-directory: ${{ github.event.repository.name }} - - - name: Install covr πŸŽͺ - run: | - if (file.exists("renv.lock")) { - renv::restore() - if (!require("covr")) renv::install("covr") - } - if (!require("covr")) install.packages("covr") - shell: Rscript {0} - - - name: Run coverage πŸ‘Ÿ - run: | - setwd("${{ github.event.repository.name }}") - if (file.exists("renv.lock")) { - renv::restore() - } - # Load extra env vars - extra_env_vars <- "${{ inputs.additional-env-vars }}" - if (extra_env_vars != "") { - writeLines(extra_env_vars, "/tmp/dotenv.env") - if (!require("dotenv")) install.packages("dotenv", repos = "https://cloud.r-project.org") - dotenv::load_dot_env("/tmp/dotenv.env") - } - tryCatch( - expr = { - x <- covr::package_coverage( - clean = FALSE, - quiet = FALSE - ) - print(x) - covr::report( - x, - file = "coverage-report.html", - browse = FALSE - ) - covr::to_cobertura(x, filename = "coverage.xml") - p <- covr::percent_coverage(x) - cat(p, file = "coverage.txt", sep = "") - }, - error = function(e) { - message("Errors generated during coverage analysis:") - print(e) - error_file <- list.files(path = "/tmp", pattern="*.fail$", recursive = T, full.names = T)[1] - if (length(error_file) && file.exists(error_file)) { - cat("__________FULL OUTPUT__________") - writeLines(readLines(error_file)) - } - }, - warning = function(w) { - message("Warnings generated during coverage analysis:") - print(w) - } - ) - shell: Rscript {0} - - - name: Check whether coverage reports exists πŸ’­ - id: check_coverage_reports - uses: andstor/file-existence-action@v2 - with: - files: >- - ${{ github.event.repository.name }}/coverage.xml, - ${{ github.event.repository.name }}/coverage.txt, - ${{ github.event.repository.name }}/coverage-report.html - - - name: Post coverage report πŸ—ž - if: steps.check_coverage_reports.outputs.files_exists == 'true' - uses: insightsengineering/coverage-action@v2 - with: - path: ${{ github.event.repository.name }}/coverage.xml - threshold: 80 - fail: false - publish: ${{ inputs.publish-coverage-report }} - diff: true - continue-on-error: true - - - name: Upload report πŸ”Ό - if: steps.check_coverage_reports.outputs.files_exists == 'true' - uses: actions/upload-artifact@v3 - with: - name: coverage-report - path: | - ${{ github.event.repository.name }}/coverage-report.html - ${{ github.event.repository.name }}/lib/ - continue-on-error: true - - covtracer: - name: Covtracer πŸ„ - runs-on: ubuntu-latest - if: > - !contains(github.event.commits[0].message, '[skip coverage]') - && github.event.pull_request.draft == false - && contains(inputs.enable-covtracer, 'true') - container: - image: ghcr.io/insightsengineering/rstudio_4.2.2_bioc_3.16:latest - steps: - - name: Get branch names 🌿 - id: branch-name - uses: tj-actions/branch-names@v6 - - - name: Checkout repo πŸ›Ž - uses: actions/checkout@v3 - with: - ref: ${{ steps.branch-name.outputs.head_ref_branch }} - path: ${{ github.event.repository.name }} - - - name: Restore SD cache πŸ’° - uses: actions/cache@v3 - with: - key: sd-${{ runner.os }}-${{ github.event.repository.name }} - path: ~/.staged.dependencies - - - name: Run Staged dependencies 🎦 - uses: insightsengineering/staged-dependencies-action@v1 - env: - GITHUB_PAT: ${{ secrets.REPO_GITHUB_TOKEN }} - with: - path: ${{ github.event.repository.name }} - enable-check: ${{ inputs.enable-staged-dependencies-check }} - run-system-dependencies: ${{ inputs.install-system-dependencies }} - - - name: Run Covtracer πŸ„ - uses: insightsengineering/covtracer-action@v1 - env: - GITHUB_PAT: ${{ secrets.REPO_GITHUB_TOKEN }} - with: - path: ${{ github.event.repository.name }} - allow-failure: ${{ inputs.allow-failure }} diff --git a/.github/workflows/validation.yaml b/.github/workflows/validation.yaml deleted file mode 100644 index 5ada2c7..0000000 --- a/.github/workflows/validation.yaml +++ /dev/null @@ -1,102 +0,0 @@ ---- -name: R Package Validation report πŸ“ƒ - -on: - push: - tags: - - "v*" - branches: - - main - pull_request: - types: - - opened - - synchronize - - reopened - - ready_for_review - branches: - - main - workflow_dispatch: - workflow_call: - inputs: - install-system-dependencies: - description: Check for and install system dependencies - required: false - default: false - type: boolean - enable-staged-dependencies-check: - description: Enable staged dependencies YAML check - required: false - default: true - type: boolean - secrets: - REPO_GITHUB_TOKEN: - description: | - Github token with read access to repositories, required for staged.dependencies installation - required: false - -concurrency: - group: validation-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - validation: - name: Create report πŸ“ƒ - runs-on: ubuntu-latest - if: > - !contains(github.event.commits[0].message, '[skip validation]') - && github.event.pull_request.draft == false - container: - image: ghcr.io/insightsengineering/rstudio_4.2.2_bioc_3.16:latest - env: - GITHUB_PAT: ${{ secrets.REPO_GITHUB_TOKEN }} - permissions: - contents: write - packages: write - deployments: write - steps: - - name: Checkout repo πŸ›Ž - uses: actions/checkout@v3 - - - name: Restore SD cache πŸ’° - uses: actions/cache@v3 - with: - key: sd-${{ runner.os }}-${{ github.event.repository.name }} - path: ~/.staged.dependencies - - - name: Run Staged dependencies 🎦 - uses: insightsengineering/staged-dependencies-action@v1 - with: - enable-check: ${{ inputs.enable-staged-dependencies-check }} - run-system-dependencies: ${{ inputs.install-system-dependencies }} - - - name: Build report πŸ— - uses: insightsengineering/thevalidatoR@v1 - with: - report_output_prefix: validation_report - - - name: Upload report for review ⬆ - if: github.ref != 'refs/heads/main' - uses: actions/upload-artifact@v3 - with: - name: validation_report.pdf - path: validation_report.pdf - - upload-release-assets: - name: Upload report to release πŸ”Ό - needs: validation - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/v') - steps: - - name: Download artifact ⏬ - uses: actions/download-artifact@v3 - with: - name: validation_report.pdf - - - name: Upload report to release πŸ”Ό - uses: svenstaro/upload-release-action@v2 - with: - file: ./validation_report.pdf - asset_name: validation-report.pdf - repo_token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ github.ref }} - overwrite: true diff --git a/.github/workflows/version-bump.yaml b/.github/workflows/version-bump.yaml deleted file mode 100644 index e1b84ce..0000000 --- a/.github/workflows/version-bump.yaml +++ /dev/null @@ -1,69 +0,0 @@ ---- -name: Version bump ⬆ - -on: - push: - branches: - - main - workflow_dispatch: - workflow_call: - secrets: - REPO_GITHUB_TOKEN: - description: Github token with write access to the repo - required: false - -concurrency: - group: vbump-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - vbump: - name: Bump version ‴ - runs-on: ubuntu-latest - if: | - !( contains(github.event.commits[0].message, '[skip vbump]') || - contains(github.event.head_commit.message, '[skip vbump]') - ) - container: - image: docker.io/rocker/tidyverse:4.2.1 - - steps: - - name: Checkout repo πŸ›Ž - uses: actions/checkout@v3 - with: - token: ${{ secrets.REPO_GITHUB_TOKEN }} - - - name: Bump version in DESCRIPTION πŸ“œ - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} - run: desc::desc_bump_version("dev", normalize = TRUE) - shell: Rscript {0} - - - name: Update Date field πŸ“… - run: if (desc::desc_has_fields("Date")) desc::desc_set("Date", Sys.Date()) - shell: Rscript {0} - - - name: Bump version in NEWS.md πŸ“° - run: | - git config --global --add safe.directory $(pwd) - DESC_VERSION=$(R --slave -e 'cat(paste(desc::desc_get_version()))') - NEWS_VERSION=$(awk '/^#+ /{print $3; exit}' NEWS.md) - sed -i "s/$NEWS_VERSION/$DESC_VERSION/" NEWS.md - NEWS_VERSION=$(awk '/^#+ /{print $3; exit}' NEWS.md) - echo "Updated NEWS.md version: $NEWS_VERSION" - if (test $DESC_VERSION != $NEWS_VERSION ); then - echo "πŸ™ˆ Updated NEWS.md and DESCRIPTION have different versions!" - echo "Please ensure that the versions in the NEWS.md and DESCRIPTION are the same πŸ™" - exit 1 - fi - echo "NEW_PKG_VERSION=${DESC_VERSION}" >> $GITHUB_ENV - shell: bash - - - name: Commit and push changes πŸ“Œ - if: ${{ env.NEW_PKG_VERSION }} - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: "[skip actions] Bump version to ${{ env.NEW_PKG_VERSION }}" - file_pattern: NEWS.md DESCRIPTION - commit_user_name: insights-engineering-bot - commit_user_email: >- - 68416928+insights-engineering-bot@users.noreply.github.com diff --git a/.github/workflows/version.yaml b/.github/workflows/version.yaml deleted file mode 100644 index 2e1db65..0000000 --- a/.github/workflows/version.yaml +++ /dev/null @@ -1,47 +0,0 @@ ---- -name: Version check 🏁 - -on: - push: - branches: - - main - pull_request: - types: - - opened - - synchronize - - reopened - - ready_for_review - branches: - - main - workflow_dispatch: - workflow_call: - -concurrency: - group: version-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - version: - name: Version check 🏁 - runs-on: ubuntu-latest - if: > - !contains(github.event.commits[0].message, '[skip version]') - && github.event.pull_request.draft == false - steps: - - name: Checkout repo πŸ›Ž - uses: actions/checkout@v3 - - - name: NEWS.md and DESCRIPTION Version check 🏁 - run: | - DESC_VERSION=$(awk -F: '/Version:/{gsub(/[ ]+/,"") ; print $2}' DESCRIPTION) - NEWS_VERSION=$(awk '/^#+ /{print $3; exit}' NEWS.md) - echo "NEWS.md version: $NEWS_VERSION" - echo "DESCRIPTION version: $DESC_VERSION" - if (test $DESC_VERSION = $NEWS_VERSION ); then - echo "NEWS.md and DESCRIPTION have the same version" - else - echo "πŸ™ˆ NEWS.md and DESCRIPTION have different versions!" - echo "πŸ™ Please fix this." - exit 1 - fi - shell: bash diff --git a/DESCRIPTION b/DESCRIPTION index 9fc1a7c..afe48ef 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,14 +1,14 @@ Type: Package -Package: r.pkg.template +Package: savvyr Title: R Package Template -Version: 0.1.0.9089 +Version: 0.1.0 Date: 2022-12-22 Authors@R: - person("insightsengineering", , , "insightsengineering@example.com", role = c("aut", "cre")) + person("openpharma", , , "openpharma@example.com", role = c("aut", "cre")) Description: R package template with GitHub Actions workflows included. License: Apache License 2.0 | file LICENSE -URL: https://github.com/insightsengineering/r.pkg.template/ -BugReports: https://github.com/insightsengineering/r.pkg.template/issues +URL: https://github.com/openpharma/savvyr/ +BugReports: https://github.com/openpharma/savvyr/issues Depends: R (>= 3.6) Imports: diff --git a/NEWS.md b/NEWS.md index 2a9eddf..dff5f11 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# r.pkg.template 0.1.0.9089 +# savvyr 0.1.0 ### New features diff --git a/README.md b/README.md index 0a8a1f8..a13405d 100644 --- a/README.md +++ b/README.md @@ -1,188 +1,3 @@ -# r.pkg.template +# savvyr -![GitHub forks](https://img.shields.io/github/forks/insightsengineering/r.pkg.template?style=social) -![GitHub Repo stars](https://img.shields.io/github/stars/insightsengineering/r.pkg.template?style=social) - -![GitHub commit activity](https://img.shields.io/github/commit-activity/m/insightsengineering/r.pkg.template) -![GitHub contributors](https://img.shields.io/github/contributors/insightsengineering/r.pkg.template) -![GitHub last commit](https://img.shields.io/github/last-commit/insightsengineering/r.pkg.template) -![GitHub pull requests](https://img.shields.io/github/issues-pr/insightsengineering/r.pkg.template) -![GitHub repo size](https://img.shields.io/github/repo-size/insightsengineering/r.pkg.template) -![GitHub language count](https://img.shields.io/github/languages/count/insightsengineering/r.pkg.template) -[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) -[![Downloads](https://img.shields.io/github/downloads/insightsengineering/r.pkg.template/latest/total)](https://tooomm.github.io/github-release-stats/?username=insightsengineering\&repository=r.pkg.template) -[![Current Version](https://img.shields.io/github/r-package/v/insightsengineering/r.pkg.template/main?color=purple\&label=package%20version)](https://github.com/insightsengineering/r.pkg.template/tree/main) -[![Open Issues](https://img.shields.io/github/issues-raw/insightsengineering/r.pkg.template?color=red\&label=open%20issues)](https://github.com/insightsengineering/r.pkg.template/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) - -[![Audit Dependencies](https://github.com/insightsengineering/r.pkg.template/actions/workflows/audit.yaml/badge.svg)](https://github.com/insightsengineering/r.pkg.template/actions/workflows/audit.yaml) -[![BiocCheck](https://github.com/insightsengineering/r.pkg.template/actions/workflows/bioccheck.yaml/badge.svg)](https://github.com/insightsengineering/r.pkg.template/actions/workflows/bioccheck.yaml) -[![Check URLs](https://github.com/insightsengineering/r.pkg.template/actions/workflows/links.yaml/badge.svg)](https://github.com/insightsengineering/r.pkg.template/actions/workflows/links.yaml) -[![Coverage](https://github.com/insightsengineering/r.pkg.template/actions/workflows/test-coverage.yaml/badge.svg)](https://github.com/insightsengineering/r.pkg.template/actions/workflows/test-coverage.yaml) -[![License report](https://github.com/insightsengineering/r.pkg.template/actions/workflows/licenses.yaml/badge.svg)](https://github.com/insightsengineering/r.pkg.template/actions/workflows/licenses.yaml) -[![Pkgdown Docs](https://github.com/insightsengineering/r.pkg.template/actions/workflows/pkgdown.yaml/badge.svg)](https://github.com/insightsengineering/r.pkg.template/actions/workflows/pkgdown.yaml) -[![R CMD Check](https://github.com/insightsengineering/r.pkg.template/actions/workflows/build-check-install.yaml/badge.svg)](https://github.com/insightsengineering/r.pkg.template/actions/workflows/build-check-install.yaml) -[![R Package Validation report](https://github.com/insightsengineering/r.pkg.template/actions/workflows/validation.yaml/badge.svg)](https://github.com/insightsengineering/r.pkg.template/actions/workflows/validation.yaml) -[![Release](https://github.com/insightsengineering/r.pkg.template/actions/workflows/release.yaml/badge.svg)](https://github.com/insightsengineering/r.pkg.template/actions/workflows/release.yaml) -[![Roxygen](https://github.com/insightsengineering/r.pkg.template/actions/workflows/roxygen.yaml/badge.svg)](https://github.com/insightsengineering/r.pkg.template/actions/workflows/roxygen.yaml) -[![Spelling](https://github.com/insightsengineering/r.pkg.template/actions/workflows/spelling.yaml/badge.svg)](https://github.com/insightsengineering/r.pkg.template/actions/workflows/spelling.yaml) -[![Style](https://github.com/insightsengineering/r.pkg.template/actions/workflows/style.yaml/badge.svg)](https://github.com/insightsengineering/r.pkg.template/actions/workflows/style.yaml) -[![SuperLinter](https://github.com/insightsengineering/r.pkg.template/actions/workflows/linter.yaml/badge.svg)](https://github.com/insightsengineering/r.pkg.template/actions/workflows/linter.yaml) -[![Version bump](https://github.com/insightsengineering/r.pkg.template/actions/workflows/version-bump.yaml/badge.svg)](https://github.com/insightsengineering/r.pkg.template/actions/workflows/version-bump.yaml) -[![Version check](https://github.com/insightsengineering/r.pkg.template/actions/workflows/version.yaml/badge.svg)](https://github.com/insightsengineering/r.pkg.template/actions/workflows/version.yaml) -[![gitleaks](https://github.com/insightsengineering/r.pkg.template/actions/workflows/gitleaks.yaml/badge.svg)](https://github.com/insightsengineering/r.pkg.template/actions/workflows/gitleaks.yaml) - -<!-- links --> - -[pre-commit]: https://pre-commit.com - -[pre-commit installation]: https://pre-commit.com/#installation - -[git hooks]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks - -An R package template with built-in GitHub Actions-based CI/CD workflows. - -## Usage - -### Initialization - -You could initialize this repository in one of two ways: - -#### Clone this template - -* Clone this repository: - - ```bash - git clone https://github.com/insightsengineering/r.pkg.template.git - cd r.pkg.template - ``` - -* Run the initializer script: - - ```bash - ./init.sh - ``` - -#### Use GitHub's template importer - -* Click [here](https://github.com/insightsengineering/r.pkg.template/generate) to generate a copy of this template directly within GitHub. - -* Clone the repository from your account/organization. - -* Run the initializer script: - - ```bash - ./init.sh - ``` - -### CI/CD Configurations - -All CI/CD jobs are defined in the [.github/workflows](./.github/workflows) directory in the form of GitHub Action workflows. These can be modified per your requirements, but are designed and implemented to follow best practices and to ensure the highest quality standards for your package. - -All workflows originating from this repository can be repurposed by other R package GitHub repositories. - -πŸ‘‰ For more information including detailed description and screenshots of workflows, please refer to the [Workflows documentation](./workflows.md). - -### Pre-commit - -This repository contains an example [pre-commit] configuration. - -[pre-commit] is a tool that uses [Git hooks] to identify and resolve simple issues before submission for code review. -[Git hooks] run on every commit to automatically point out and solve issues such as missing semicolons, trailing whitespaces, -code formatting and spell checks. - -### Setting up pre-commit for R project - -* Install the `pre-commit` framework. Use the official [installation guide][pre-commit installation]. - -* Install R package `precommit` - - ```sh - R -e 'install.packages("precommit")' - ``` - -* Run the `use_precommit()` function to generate an example pre-commit configuration called `.pre-commit-config.yaml`: - - ```sh - [ ! -f ".pre-commit-config.yaml" ] && R -e 'precommit::use_precommit()' - ``` - -* Install the git hooks script: - - ```sh - pre-commit install - ``` - -* From this moment on, all scripts from `.pre-commit-config.yaml` will run before every `git commit` command. If you want to run them manually without committing you can use command `pre-commit run --all-files`. For more information, please refer to the official [pre-commit] documentation. - -> NOTE: Frequently run `pre-commit autoupdate` to update all hooks in the `.pre-commit-config.yaml` configuration file. - -### Example output from pre-commit - -```sh -$ git add . -$ git commit -m "Add pre-commit configuration" -[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks. -[INFO] Once installed this environment will be reused. -[INFO] This may take a few minutes... -style-files..............................................................Passed -roxygenize...........................................(no files to check)Skipped -use-tidy-description.....................................................Passed -spell-check..............................................................Failed -- hook id: spell-check -- exit code: 1 -- files were modified by this hook - -The following spelling errors were found: - WORD FOUND IN -commiting README.md:77 -indentify README.md:49 -informatoin README.md:77 -All spelling errors found were copied to inst/WORDLIST assuming they were not spelling errors and will be ignored in the future. Please review the above list and for each word that is an actual typo: - - fix it in the source code. - - remove it again manually from inst/WORDLIST to make sure it's not - ignored in the future. - Then, try committing again. -Error: Spell check failed -Execution halted - -lintr....................................................................Passed -readme-rmd-rendered......................................................Passed -parsable-R...............................................................Passed -no-browser-statement.....................................................Passed -deps-in-desc.............................................................Passed -prettier.................................................................Failed -- hook id: prettier -- files were modified by this hook - -.pre-commit-config.yaml -README.md - -Check for added large files..............................................Passed -Fix End of Files.........................................................Passed -Trim Trailing Whitespace.................................................Failed -- hook id: trailing-whitespace -- exit code: 1 -- files were modified by this hook - -Fixing .pre-commit-config.yaml -Fixing README.md - -Check Yaml...............................................................Passed -Don't commit to branch...................................................Passed -Mixed line ending........................................................Passed -Don't commit common R artifacts......................(no files to check)Skipped -``` - -## Stargazers and Forkers - -### Stargazers over time - -[![Stargazers over time](https://starchart.cc/insightsengineering/r.pkg.template.svg)](https://starchart.cc/insightsengineering/r.pkg.template) - -### Stargazers - -[![Stargazers repo roster for @insightsengineering/r.pkg.template](https://reporoster.com/stars/insightsengineering/r.pkg.template)](https://github.com/insightsengineering/r.pkg.template/stargazers) - -### Forkers - -[![Forkers repo roster for @insightsengineering/r.pkg.template](https://reporoster.com/forks/insightsengineering/r.pkg.template)](https://github.com/insightsengineering/r.pkg.template/network/members) +Short description of the package diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 98ab70f..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,25 +0,0 @@ -# Security Policy - -## Reporting Security Issues - -If you believe you have found a security vulnerability in any of the repositories in this organization, please report it to us through coordinated disclosure. - -**Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.** - -Instead, please send an email to vulnerability.management[@]roche.com. - -Please include as much of the information listed below as you can to help us better understand and resolve the issue: - -* The type of issue (e.g., buffer overflow, SQL injection, or cross-site scripting) -* Full paths of source file(s) related to the manifestation of the issue -* The location of the affected source code (tag/branch/commit or direct URL) -* Any special configuration required to reproduce the issue -* Step-by-step instructions to reproduce the issue -* Proof-of-concept or exploit code (if possible) -* Impact of the issue, including how an attacker might exploit the issue - -This information will help us triage your report more quickly. - -## Data Security Standards (DSS) - -Please make sure that while reporting issues in the form a bug, feature, or pull request, *all* sensitive information such as [PII](https://www.dhs.gov/privacy-training/what-personally-identifiable-information), [PHI](https://www.hhs.gov/hipaa/for-professionals/security/laws-regulations/index.html), and [PCI](https://www.pcisecuritystandards.org/pci_security/standards_overview) is completely removed from any text and attachments, including pictures and videos. diff --git a/_pkgdown.yml b/_pkgdown.yml index f009f0a..2b1a2dc 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,4 +1,4 @@ -url: https://insightsengineering.github.io/r.pkg.template +url: https://openpharma.github.io/savvyr template: bootstrap: 5 @@ -17,4 +17,4 @@ template: navbar: right: - icon: fa-github - href: https://github.com/insightsengineering/r.pkg.template + href: https://github.com/openpharma/savvyr diff --git a/images/audit.png b/images/audit.png deleted file mode 100755 index 07550cb..0000000 Binary files a/images/audit.png and /dev/null differ diff --git a/images/bioccheck.png b/images/bioccheck.png deleted file mode 100755 index 580e383..0000000 Binary files a/images/bioccheck.png and /dev/null differ diff --git a/images/gitleaks.png b/images/gitleaks.png deleted file mode 100755 index d8757fc..0000000 Binary files a/images/gitleaks.png and /dev/null differ diff --git a/images/grammar1.png b/images/grammar1.png deleted file mode 100755 index 1084e91..0000000 Binary files a/images/grammar1.png and /dev/null differ diff --git a/images/grammar2.png b/images/grammar2.png deleted file mode 100755 index f794c78..0000000 Binary files a/images/grammar2.png and /dev/null differ diff --git a/images/license-report.png b/images/license-report.png deleted file mode 100755 index 15d8dd8..0000000 Binary files a/images/license-report.png and /dev/null differ diff --git a/images/links.png b/images/links.png deleted file mode 100755 index 755219d..0000000 Binary files a/images/links.png and /dev/null differ diff --git a/images/pkgdown.png b/images/pkgdown.png deleted file mode 100755 index a8b44e3..0000000 Binary files a/images/pkgdown.png and /dev/null differ diff --git a/images/presidio.png b/images/presidio.png deleted file mode 100755 index 5151aff..0000000 Binary files a/images/presidio.png and /dev/null differ diff --git a/images/r-cmd-check.png b/images/r-cmd-check.png deleted file mode 100755 index 6ee09fd..0000000 Binary files a/images/r-cmd-check.png and /dev/null differ diff --git a/images/release.png b/images/release.png deleted file mode 100755 index 97065c0..0000000 Binary files a/images/release.png and /dev/null differ diff --git a/images/roxygen.png b/images/roxygen.png deleted file mode 100755 index b7a111b..0000000 Binary files a/images/roxygen.png and /dev/null differ diff --git a/images/spellcheck.png b/images/spellcheck.png deleted file mode 100755 index 391156f..0000000 Binary files a/images/spellcheck.png and /dev/null differ diff --git a/images/styler.png b/images/styler.png deleted file mode 100755 index e58838d..0000000 Binary files a/images/styler.png and /dev/null differ diff --git a/images/superlinter.png b/images/superlinter.png deleted file mode 100755 index 9811f3c..0000000 Binary files a/images/superlinter.png and /dev/null differ diff --git a/images/validation1.png b/images/validation1.png deleted file mode 100755 index 4ed8f51..0000000 Binary files a/images/validation1.png and /dev/null differ diff --git a/images/validation2.png b/images/validation2.png deleted file mode 100755 index 3f89afc..0000000 Binary files a/images/validation2.png and /dev/null differ diff --git a/images/version-bump.png b/images/version-bump.png deleted file mode 100755 index 1c3384e..0000000 Binary files a/images/version-bump.png and /dev/null differ diff --git a/images/version.png b/images/version.png deleted file mode 100755 index b1dc7ec..0000000 Binary files a/images/version.png and /dev/null differ diff --git a/init.sh b/init.sh deleted file mode 100755 index 3250d3e..0000000 --- a/init.sh +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/env bash - -######################################## -# Repository initializer -# -# This is a self-destructing, one-time script -# that initializes your repository template -# to match your requirements. -######################################## - -set -euo pipefail - -# Green echo -function gecho () { - local green='\033[0;32m' - local no_color='\033[0m' - # shellcheck disable=SC2145 - echo -e "${green}$@${no_color}" -} - -# Orange echo -function oecho () { - local orange='\033[0;33m' - local no_color='\033[0m' - # shellcheck disable=SC2145 - echo -e "${orange}$@${no_color}" -} - -gecho "Hello! Thank you for using r.pkg.template! Let us initialize your package." - -echo -n "Please enter your GitHub username or organization name: " -read -r owner - -echo -n "Enter your package's name here (eg. awesomeR): " -read -r pkg - -echo -n "Retain the template's git history? Enter either 'yes' or 'no' (defaults to 'no'): " -read -r retain_git_history -retain_git_history=${retain_git_history:-"no"} - -echo -n "Use shared workflows or use the original workflows? Enter 'yes' to use shared workflows (recommended) and 'no' to use the original workflows (defaults to 'yes'): " -read -r use_shared_workflows -use_shared_workflows=${use_shared_workflows:-"yes"} - -gecho "Initializing your package. Standby..." - -oecho "You've chosen '$retain_git_history' for retaining the template's git history" -if [ "$retain_git_history" == "no" ] -then { - oecho "Removing template git history" - rm -rf .git -} else { - oecho "Template's git history retained" -} -fi - -oecho "Replacing template references within files" -grep -rl --exclude=init.sh --exclude=*.shared \ - --exclude-dir=.git "r.pkg.template" . | \ - xargs perl -p -i -e "s/r.pkg.template/${pkg}/g" -perl -p -i -e "s/insightsengineering/${owner}/g" DESCRIPTION -perl -p -i -e "s/insightsengineering/${owner}/g" .github/ISSUE_TEMPLATE/*.yml -perl -p -i -e "s/insightsengineering/${owner}/g" _pkgdown.yml -perl -p -i -e "s/insightsengineering/${owner}/g" staged_dependencies.yaml -grep -rl --exclude=init.sh --exclude=*.shared \ - --exclude-dir=.git "REPO_GITHUB_TOKEN" . | \ - xargs perl -p -i -e 's/REPO_GITHUB_TOKEN/GITHUB_TOKEN/g' -grep -rl --exclude=init.sh --exclude=*.shared \ - --exclude-dir=.git \ - "68416928+insights-engineering-bot@users.noreply.github.com" .github/workflows/ | \ - xargs perl -p -i -e 's/68416928\+insights-engineering-bot/41898282\+github-actions\[bot\]/g' -grep -rl --exclude=init.sh --exclude=*.shared \ - --exclude-dir=.git "insights-engineering-bot" .github/workflows/ | \ - xargs perl -p -i -e 's/insights-engineering-bot/github-actions/g' - -oecho "Updating file names and removing unnecessary files" -mv r.pkg.template.Rproj "${pkg}.Rproj" -rm -rf \ - .github/CODEOWNERS \ - .github/ISSUE_TEMPLATE \ - .github/CONTRIBUTING.md \ - .github/PULL_REQUEST_TEMPLATE.md \ - .github/CODE_OF_CONDUCT.md \ - SECURITY.md \ - images \ - workflows.md -oecho "You've chosen '$use_shared_workflows' for using the shared workflows" -if [ "$use_shared_workflows" == "yes" ]; -then { - oecho "Removing the original workflows and using the shared workflows" - rm -rf .github/workflows/*.yaml - for shared in check docs release - do { - mv .github/workflows/$shared.yaml.shared .github/workflows/$shared.yaml - } - done -} else { - oecho "Retaining the original workflows and removing the shared workflows" - rm -rf .github/workflows/*.yaml.shared -} -fi - -oecho "Resetting the package version" -reset_version="0.1.0" -perl -p -i -e "s@^Version: .*@Version: ${reset_version}@" DESCRIPTION -perl -p -i -e "s@^\# ${pkg} .*@\# ${pkg} ${reset_version}@" NEWS.md - -oecho "Overwriting the README.md file" -echo -e "# ${pkg}\n\nShort description of the package" > README.md - -gecho "Package successfully initialized!" -oecho "Please update the remainder of the package as you would do typically while developing an R package." - -oecho "This utility will self-destruct in 3 seconds..." -sleep 3 -rm -f "$0" - -gecho "Enjoy!" diff --git a/inst/plumber/hello/plumber.R b/inst/plumber/hello/plumber.R index d9c5d12..08b69b7 100644 --- a/inst/plumber/hello/plumber.R +++ b/inst/plumber/hello/plumber.R @@ -1,4 +1,4 @@ #* Personal greeting as a Plumber API #* @param name Your name (character string; e.g. "john doe"). #* @get /echo -r.pkg.template::hello +savvyr::hello diff --git a/r.pkg.template.Rproj b/savvyr.Rproj similarity index 100% rename from r.pkg.template.Rproj rename to savvyr.Rproj diff --git a/staged_dependencies.yaml b/staged_dependencies.yaml deleted file mode 100644 index d5231a6..0000000 --- a/staged_dependencies.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# Information about this file: https://github.com/openpharma/staged.dependencies -current_repo: - repo: insightsengineering/r.pkg.template - host: https://github.com -upstream_repos: -downstream_repos: diff --git a/tests/testthat.R b/tests/testthat.R index 156cef7..c2b5b41 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -1,3 +1,3 @@ -pkg_name <- "r.pkg.template" +pkg_name <- "savvyr" library(pkg_name, character.only = TRUE) testthat::test_check(pkg_name) diff --git a/tests/testthat/shiny-app/app.R b/tests/testthat/shiny-app/app.R index 45d4f91..672912d 100644 --- a/tests/testthat/shiny-app/app.R +++ b/tests/testthat/shiny-app/app.R @@ -1 +1 @@ -r.pkg.template::shiny_app() +savvyr::shiny_app() diff --git a/tests/testthat/test-api.R b/tests/testthat/test-api.R index 7bb9772..06f7f41 100644 --- a/tests/testthat/test-api.R +++ b/tests/testthat/test-api.R @@ -5,7 +5,7 @@ test_that("API greets the person", { # Start the API future::plan(future::multisession) future::future( - r.pkg.template::plumber_api(host = host, port = port) + savvyr::plumber_api(host = host, port = port) ) Sys.sleep(3) diff --git a/vignettes/hello.Rmd b/vignettes/hello.Rmd index 7dfba93..07f8afa 100644 --- a/vignettes/hello.Rmd +++ b/vignettes/hello.Rmd @@ -7,6 +7,6 @@ date: "`r Sys.Date()`" Hello World! ```{r} -library(r.pkg.template) -hello("r.pkg.template!") +library(savvyr) +hello("savvyr!") ``` diff --git a/workflows.md b/workflows.md deleted file mode 100644 index 40a5ae0..0000000 --- a/workflows.md +++ /dev/null @@ -1,146 +0,0 @@ -# What these workflows do? - -## [`audit.yaml`](./.github/workflows/audit.yaml) - -This workflow scans dependencies of your package for vulnerabilities using -[oysteR](https://cran.r-project.org/web/packages/oysteR/index.html). -Dependencies can be retrieved either from `DESCRIPTION` file or from `renv.lock` file. - -<img src="images/audit.png" width="60%"> - -## [`bioccheck.yaml`](./.github/workflows/bioccheck.yaml) - -This workflow implements Bioconductor-specific R package checks with -[BiocCheck](https://bioconductor.org/packages/release/bioc/html/BiocCheck.html). - -<img src="images/bioccheck.png" width="40%"> - -## [`build-check-install.yaml`](./.github/workflows/build-check-install.yaml) - -This workflow includes the following activities: - -1. Build an R package. -2. Run `R CMD check`. -3. Publish unit test summary. -4. Catch any notes, warnings etc. in the `R CMD check` output. -5. Install the package. - -<img src="images/r-cmd-check.png" width="50%"> - -## [`gitleaks.yaml`](./.github/workflows/gitleaks.yaml) - -This workflow runs [`gitleaks`](https://github.com/zricethezav/gitleaks) on the repo to discover -any secrets that might have been hardcoded. - -<img src="images/gitleaks.png" width="50%"> - -Additionally, it runs [`presidio-cli`](https://github.com/insightsengineering/presidio-cli) to find -any personally identifiable information (PII) within the `git` repo. - -<img src="images/presidio.png" width="50%"> - -## [`grammar.yaml`](./.github/workflows/grammar.yaml) - -This workflow uses [`write-good`](https://github.com/btford/write-good) to check changed files -with names matching a pattern for English sentences that could be corrected. -Then, it adds annotations to the pull request so that problematic grammar can be reviewed. - -<img src="images/grammar1.png" width="50%"> -<img src="images/grammar2.png" width="50%"> - -## [`licenses.yaml`](./.github/workflows/licenses.yaml) - -This workflow generates a license report of R package's dependencies for -continuous compliance. - -<img src="images/license-report.png" width="50%"> - -## [`links.yaml`](./.github/workflows/links.yaml) - -This workflow checks whether URLs embedded in code and documentation are valid. This workflow uses -[`lychee`](https://github.com/lycheeverse/lychee) to detect broken links. Occasionally, this check -will detect false positives of strings that look like URLs. To remedy, please add this false -positive to the `.lycheeignore` file. - -<img src="images/links.png" width="50%"> - -## [`linter.yaml`](./.github/workflows/linter.yaml) - -This workflow lints the codebase using [`super-linter`](https://github.com/github/super-linter). - -<img src="images/superlinter.png" width="80%"> - -## [`pkgdown.yaml`](./.github/workflows/pkgdown.yaml) - -Documentation for the R package is generated via this workflow. This workflow uses the -[`pkgdown`](https://pkgdown.r-lib.org/) framework to generate documentation in HTML, -and the HTML pages are then deployed to the `gh-pages` branch. - -Moreover, an additional `Versions` dropdown is generated via the GitHub Action, so that -the end user can view multiple versions of the documentation for the package. - -<img src="images/pkgdown.png" width="30%"> - -## [`release.yaml`](./.github/workflows/release.yaml) - -This workflow creates a GitHub release from a `git` tag and generates changelog based -on `NEWS.md` file. - -<img src="images/release.png" width="60%"> - -## [`roxygen.yaml`](./.github/workflows/roxygen.yaml) - -This workflow uses [`roxygen`](https://roxygen2.r-lib.org/) to generate `.Rd` files in -`man/` directory. It also checks if manuals are up-to-date with roxygen comments in the code. - -<img src="images/roxygen.png" width="80%"> - -## [`spelling.yaml`](./.github/workflows/spelling.yaml) - -Spellchecks are performed by this workflow, and the -[`spelling`](https://docs.ropensci.org/spelling/) R package is used to detect spelling mistakes. -In the `inst/WORDLIST` file, you can add words and/or acronyms that you want the -spell check to ignore. - -<img src="images/spellcheck.png" width="80%"> - -## [`style.yaml`](./.github/workflows/style.yaml) - -Code style is enforced via the [`styler`](https://styler.r-lib.org/) R package. The workflow -can be configured to commit files that had styling problems automatically, after -remediating the problems. - -<img src="images/styler.png" width="90%"> - -## [`test-coverage.yaml`](./.github/workflows/test-coverage.yaml) - -This workflow examines the test coverage of given R package with [`covr`](https://covr.r-lib.org/). -Following that, coverage report is added to the PR. Additional feature is the ability -to compare code coverage between branches, so the PR can be declined if the coverage -would decrease following the merge. - -The second part of the workflow runs utilizes `covtracer` to: - -* prepare traceability matrix -* identify untested behavior -* verify directly tested functions - -## [`validation.yaml`](./.github/workflows/validation.yaml) - -This workflow generates and publishes validation report. - -<img src="images/validation1.png" width="40%"> -<img src="images/validation2.png" width="60%"> - -## [`version-bump.yaml`](./.github/workflows/version-bump.yaml) - -This workflow increases R package version in `NEWS.md` and `DESCRIPTION` files and -commits this change to the repository. - -<img src="images/version-bump.png" width="60%"> - -## [`version.yaml`](./.github/workflows/version.yaml) - -This workflow checks if `NEWS.md` and `DESCRPTION` files have the same R package version. - -<img src="images/version.png" width="60%">