From 294bd9aee59bc68161d64c9092ce44e94a7902d1 Mon Sep 17 00:00:00 2001 From: Pullenss Date: Thu, 20 Aug 2026 15:06:08 +0200 Subject: [PATCH] updated .github files --- .github/CODE_OF_CONDUCT.md | 91 +++++++++++ .github/CONTRIBUTING.md | 141 ++++++++++++++++++ .github/CONTRIBUTORS.md | 5 + .github/ISSUE_TEMPLATE/bug_report.md | 43 ++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 +++ .github/ISSUE_TEMPLATE/question.md | 14 ++ .github/PULL_REQUEST_TEMPLATE/pull_request.md | 28 ++++ .github/TBR/Pkgdown.yml | 52 ------- .github/TBR/R-CMD-check.yml | 133 ----------------- .github/TBR/test-coverage.yml | 98 ------------ .github/workflows/{CI.yaml => ci.yaml} | 92 ++++++------ 11 files changed, 388 insertions(+), 329 deletions(-) create mode 100644 .github/CODE_OF_CONDUCT.md create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/CONTRIBUTORS.md create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/question.md create mode 100644 .github/PULL_REQUEST_TEMPLATE/pull_request.md delete mode 100644 .github/TBR/Pkgdown.yml delete mode 100644 .github/TBR/R-CMD-check.yml delete mode 100644 .github/TBR/test-coverage.yml rename .github/workflows/{CI.yaml => ci.yaml} (85%) diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..94a2560 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,91 @@ + +# Contributor Covenant 3.0 Code of Conduct + +## Our Pledge + +We pledge to make our community welcoming, safe, and equitable for all. + +We are committed to fostering an environment that respects and promotes the dignity, rights, and contributions of all individuals, regardless of characteristics including race, ethnicity, caste, color, age, physical characteristics, neurodiversity, disability, sex or gender, gender identity or expression, sexual orientation, language, philosophy or religion, national or social origin, socio-economic position, level of education, or other status. The same privileges of participation are extended to everyone who participates in good faith and in accordance with this Covenant. + +## Encouraged Behaviors + +While acknowledging differences in social norms, we all strive to meet our community's expectations for positive behavior. We also understand that our words and actions may be interpreted differently than we intend based on culture, background, or native language. + +With these considerations in mind, we agree to behave mindfully toward each other and act in ways that center our shared values, including: + +1. Respecting the **purpose of our community**, our activities, and our ways of gathering. +2. Engaging **kindly and honestly** with others. +3. Respecting **different viewpoints** and experiences. +4. **Taking responsibility** for our actions and contributions. +5. Gracefully giving and accepting **constructive feedback**. +6. Committing to **repairing harm** when it occurs. +7. Behaving in other ways that promote and sustain the **well-being of our community**. + + +## Restricted Behaviors + +We agree to restrict the following behaviors in our community. Instances, threats, and promotion of these behaviors are violations of this Code of Conduct. + +1. **Harassment.** Violating explicitly expressed boundaries or engaging in unnecessary personal attention after any clear request to stop. +2. **Character attacks.** Making insulting, demeaning, or pejorative comments directed at a community member or group of people. +3. **Stereotyping or discrimination.** Characterizing anyoneโ€™s personality or behavior on the basis of immutable identities or traits. +4. **Sexualization.** Behaving in a way that would generally be considered inappropriately intimate in the context or purpose of the community. +5. **Violating confidentiality**. Sharing or acting on someone's personal or private information without their permission. +6. **Endangerment.** Causing, encouraging, or threatening violence or other harm toward any person or group. +7. Behaving in other ways that **threaten the well-being** of our community. + +### Other Restrictions + +1. **Misleading identity.** Impersonating someone else for any reason, or pretending to be someone else to evade enforcement actions. +2. **Failing to credit sources.** Not properly crediting the sources of content you contribute. +3. **Promotional materials**. Sharing marketing or other commercial content in a way that is outside the norms of the community. +4. **Irresponsible communication.** Failing to responsibly present content which includes, links or describes any other restricted behaviors. + + +## Reporting an Issue + +Tensions can occur between community members even when they are trying their best to collaborate. Not every conflict represents a code of conduct violation, and this Code of Conduct reinforces encouraged behaviors and norms that can help avoid conflicts and minimize harm. + +When an incident does occur, it is important to report it promptly. To report a possible violation, **please reach out to the DARA team at RIVM via dara-team-list@rivm.nl.** + +Community Moderators take reports of violations seriously and will make every effort to respond in a timely manner. They will investigate all reports of code of conduct violations, reviewing messages, logs, and recordings, or interviewing witnesses and other participants. Community Moderators will keep investigation and enforcement actions as transparent as possible while prioritizing safety and confidentiality. In order to honor these values, enforcement actions are carried out in private with the involved parties, but communicating to the whole community may be part of a mutually agreed upon resolution. + + +## Addressing and Repairing Harm + +**** + +If an investigation by the Community Moderators finds that this Code of Conduct has been violated, the following enforcement ladder may be used to determine how best to repair harm, based on the incident's impact on the individuals involved and the community as a whole. Depending on the severity of a violation, lower rungs on the ladder may be skipped. + +1) Warning + 1) Event: A violation involving a single incident or series of incidents. + 2) Consequence: A private, written warning from the Community Moderators. + 3) Repair: Examples of repair include a private written apology, acknowledgement of responsibility, and seeking clarification on expectations. +2) Temporarily Limited Activities + 1) Event: A repeated incidence of a violation that previously resulted in a warning, or the first incidence of a more serious violation. + 2) Consequence: A private, written warning with a time-limited cooldown period designed to underscore the seriousness of the situation and give the community members involved time to process the incident. The cooldown period may be limited to particular communication channels or interactions with particular community members. + 3) Repair: Examples of repair may include making an apology, using the cooldown period to reflect on actions and impact, and being thoughtful about re-entering community spaces after the period is over. +3) Temporary Suspension + 1) Event: A pattern of repeated violation which the Community Moderators have tried to address with warnings, or a single serious violation. + 2) Consequence: A private written warning with conditions for return from suspension. In general, temporary suspensions give the person being suspended time to reflect upon their behavior and possible corrective actions. + 3) Repair: Examples of repair include respecting the spirit of the suspension, meeting the specified conditions for return, and being thoughtful about how to reintegrate with the community when the suspension is lifted. +4) Permanent Ban + 1) Event: A pattern of repeated code of conduct violations that other steps on the ladder have failed to resolve, or a violation so serious that the Community Moderators determine there is no way to keep the community safe with this person as a member. + 2) Consequence: Access to all community spaces, tools, and communication channels is removed. In general, permanent bans should be rarely used, should have strong reasoning behind them, and should only be resorted to if working through other remedies has failed to change the behavior. + 3) Repair: There is no possible repair in cases of this severity. + +This enforcement ladder is intended as a guideline. It does not limit the ability of Community Managers to use their discretion and judgment, in keeping with the best interests of our community. + + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public or other spaces. Examples of representing our community include using an official email address, posting via an official social media account, or acting as an appointed representative at an online or offline event. + + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 3.0, permanently available at [https://www.contributor-covenant.org/version/3/0/](https://www.contributor-covenant.org/version/3/0/). + +Contributor Covenant is stewarded by the Organization for Ethical Source and licensed under CC BY-SA 4.0. To view a copy of this license, visit [https://creativecommons.org/licenses/by-sa/4.0/](https://creativecommons.org/licenses/by-sa/4.0/) + +For answers to common questions about Contributor Covenant, see the FAQ at [https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq). Translations are provided at [https://www.contributor-covenant.org/translations](https://www.contributor-covenant.org/translations). Additional enforcement and community guideline resources can be found at [https://www.contributor-covenant.org/resources](https://www.contributor-covenant.org/resources). The enforcement ladder was inspired by the work of [Mozillaโ€™s code of conduct team](https://github.com/mozilla/inclusion). diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..56a843c --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,141 @@ +# Contributing to ROvis + +Hey! ๐Ÿ‘‹ Thank you for your interest in contributing to ROvis! We welcome all support and value your input. + +## About ROvis + +Before contributing, please remember that ROvis is designed specifically to implement **official Rijksoverheid (Dutch Government) design guidelines** for data visualization. The package's primary purpose is to ensure consistency in visualizations across Rijksoverheid organizations by providing tools for: + +- Applying Rijksoverheid color palettes +- Styling plots and tables according to Rijksoverheid standards +- Supporting the Rijksoverheid visual identity + +While the package was originally developed for RIVM (and was previously called DARAvis), it now serves the broader Rijksoverheid community. All contributions should align with this core mission and official Rijksoverheid design guidelines. + +## How to contribute + +### 1. Open an issue + +**Before submitting any code changes**, please open an issue on the [GitHub issue board](TODO) to: + +- Describe the bug you want to fix or the feature you want to add +- Explain why the change is needed +- Discuss your proposed approach +- Allow maintainers and other contributors to provide feedback + +This applies to both major features and small fixes. Opening an issue first helps us: + +- Avoid duplicate work +- Ensure the contribution aligns with Rijksoverheid design standards +- Discuss the best implementation approach +- Maintain focus on the package's core purpose + +### 2. Wait for discussion + +Give maintainers and other contributors time to respond to your issue. This discussion ensures that: + +- The proposed change fits within the package's scope +- The implementation approach is appropriate +- There are no conflicts with planned changes +- The change adheres to Rijksoverheid design guidelines + +### 3. Fork and create a branch + +Once your issue has been discussed and approved: + +1. Fork the repository +2. Create a feature branch from `main` +3. Name your branch descriptively (e.g., `fix-color-palette`, `add-new-theme`) + +### 4. Make your changes + +When coding: + +- **Follow our code style**: we stick to the [Tidyverse style guide](https://style.tidyverse.org) and we use [air](https://posit-dev.github.io/air) for code formatting +- **Follow existing patterns**: look at similar functions in the code base to maintain consistency +- **Keep it simple**: avoid over-engineering and only add what's necessary for the task at hand +- **Build on existing functions**: don't duplicate logic and use/extend existing functions where possible +- Write clear, self-documenting code +- Add `roxygen2` documentation for new functions +- Include examples in your documentation +- Write tests for new functionality +- Update existing tests if modifying behavior +- Run `devtools::check()` to ensure your changes don't break anything + +### 5. Test your changes + +- Run the test suite: `devtools::test()` +- For theme changes, verify visual regression tests pass (with `vdiffr`) +- Test your changes with real-world examples +- Ensure your code works with R versions as mentioned in DESCRIPTION + +### 6. Submit a pull request + +- Push your branch to your fork +- Create a pull request targeting the `main` branch +- Reference the issue number in your pull request +- Provide a clear description of what your changes do +- Include examples or screenshots if applicable + +## Code standards + +- **Single source of truth**: all color definitions live in `color()`. Build on existing functions rather than duplicating logic. +- **Maintain Rijksoverheid standards**: Verify your changes against the style guidelines. +- **Version carefully**: Use version parameters for breaking changes; never replace existing behavior +- **Document clearly**: Users across Rijksoverheid organizations may not be R experts. Provide clear examples. +- **Test visually**: Use `vdiffr` for theme changes to catch visual regressions + +## AI/LLM-Generated Contributions + +We welcome contributions assisted by AI tools (ChatGPT, Claude, GitHub Copilot, etc.), but please keep the following in mind: + +**You are responsible for your contributions.** Before submitting AI-generated code: + +- **Understand the code completely.** Don't submit code you don't fully comprehend. You should be able to explain every line and decision. +- **Test thoroughly.** AI-generated code may contain subtle bugs, incorrect assumptions, or non-standard patterns. Run all tests and verify the code works as intended. +- **Review for package consistency.** AI tools may not be aware of our specific architecture patterns, dependency chains, or design philosophy. Ensure the code follows our standards. +- **Check for quality.** AI can generate verbose, over-engineered, or redundant code. Simplify and refine before submitting. + +**Why this matters:** Reviewing AI-generated pull requests takes significant maintainer time, especially when contributors haven't verified the code themselves. Submitting untested or poorly understood code creates unnecessary burden on maintainers who must identify issues, explain problems, and request fixes. + +We appreciate AI as a helpful tool, but the responsibility for code quality, correctness, and understanding remains with the contributor. + +## What we're looking for + +We particularly welcome contributions that: + +- Fix bugs in existing functionality +- Improve documentation and examples +- Add support for new Rijksoverheid design guideline features +- Add themes for additional plotting libraries +- Add themes for additional table libraries +- Enhance error messages and user feedback +- Improve test coverage +- Extend functionality to serve other Rijksoverheid organizations + +## What to avoid + +Please avoid contributions that: + +- Deviate from official Rijksoverheid design guidelines +- Add features unrelated to Rijksoverheid visualization standards +- Introduce breaking changes without discussion +- Duplicate existing functionality +- Add unnecessary dependencies + +## Questions? + +If you have questions about contributing: + +- Open a discussion issue on [GitHub](TODO) +- Email the DARA team: [dara-team-list@rivm.nl](mailto:dara-team-list@rivm.nl) +- Review existing code and documentation in the repository to understand patterns and conventions + +## License + +By contributing to ROvis, you agree that your contributions will be licensed under the [EUPL v.1.2](https://eupl.eu/1.2/en/) license. + +--- + +Thank you for helping us maintain and improve ROvis! + diff --git a/.github/CONTRIBUTORS.md b/.github/CONTRIBUTORS.md new file mode 100644 index 0000000..015a584 --- /dev/null +++ b/.github/CONTRIBUTORS.md @@ -0,0 +1,5 @@ +# Contributors + +Thanks to everyone who contributed to this project! + +See the GitHub contributors list for the full history. diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..9a7fd00 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,43 @@ +--- +name: "๐Ÿ› Bug Report" +about: "Report an issue and help to improve ROvis" +title: "[Bug] " +labels: bug +--- + +# **:bug: Bug Report** + +## :eyes: What's going on? + + +### :arrow_heading_down: Is this a regression? + + + +### :repeat: Steps to reproduce +Steps to reproduce the behaviour: + +1. +2. +3. +4. + +[Reprex](https://reprex.tidyverse.org/) (reproducible example): + +```r +``` + +### :thinking: What did you expect to happen? + + +### :camera_flash: Screenshots / output + + +### :computer: Your setup + +- Package version: +- R version: +- Operating system: + +## :speech_balloon: Anything else? + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..8bf082e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: "โœจ Feature Request" +about: "Got an idea? Tell us about it!" +title: "" +labels: enhancement +--- + +# **:sparkles: Feature Request** + +## :thought_balloon: What are you thinking of? + + +## :face_exhaling: What problem would this solve for you? + + +## :hammer_and_wrench: How could it work? + + +## :speech_balloon: Extra notes + diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 0000000..cb56a88 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,14 @@ +--- +name: "๐Ÿ’ฌ Question / Discussion" +about: "Ask anything or start a friendly discussion" +title: "" +labels: question +--- + +# **:speech_balloon: Question / Discussion** + +## :speaking_head: What would you like to discuss? + + +## :books: Additional context + diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request.md b/.github/PULL_REQUEST_TEMPLATE/pull_request.md new file mode 100644 index 0000000..ed62e5e --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request.md @@ -0,0 +1,28 @@ +--- +name: "๐Ÿš€ Pull Request" +about: "Use this template to make your PR easy to review" +--- + +#*Name of PR* + + + +## :blue_book: What is this PR about? + + +## :white_check_mark: Checklist + +- [ ] I have read contributing guidelines at `CONTRIBUTING.md` +- [ ] My code follows the style guidelines of this project += [ ] I have tested these changes and added tests (if applicable) +- [ ] I have added necessary documentation / comments +- [ ] I have linked relevant issues + +## :test_tube: How to test / verify + + +```r +``` + +## :information_source: Extra info + diff --git a/.github/TBR/Pkgdown.yml b/.github/TBR/Pkgdown.yml deleted file mode 100644 index e2273a9..0000000 --- a/.github/TBR/Pkgdown.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: pkgdown - -on: - push: - branches: [main, master] - release: - types: [published] - workflow_dispatch: - -# Required for deploying to GitHub Pages -permissions: - contents: write - pages: write - -jobs: - pkgdown: - runs-on: ubuntu-latest - container: - image: daratools/robase:latest - - env: - GITHUB_PAT: ${{ secrets.AT_ROvis || secrets.GITHUB_TOKEN }} - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - # rocker/tidyverse runs as root; mark the workspace as safe for git - - name: Fix git safe directory - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - - # No setup-r step needed โ€” R is already installed in your Docker image - - - name: Setup pandoc - uses: r-lib/actions/setup-pandoc@v2 - - - name: Setup R dependencies - uses: r-lib/actions/setup-r-dependencies@v2 - with: - extra-packages: any::pkgdown, local::. - needs: website - - - name: Build pkgdown site - run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) - shell: Rscript {0} - - - name: Deploy to GitHub Pages - uses: JamesIves/github-pages-deploy-action@v4 - with: - clean: false # keeps the badges/ folder written by the coverage job - branch: gh-pages - folder: docs diff --git a/.github/TBR/R-CMD-check.yml b/.github/TBR/R-CMD-check.yml deleted file mode 100644 index a37ccfa..0000000 --- a/.github/TBR/R-CMD-check.yml +++ /dev/null @@ -1,133 +0,0 @@ -name: R CMD CHECK - -on: - push: - branches: [main, master] - pull_request: - branches: [main, master] - -jobs: - R-CMD-check: - runs-on: ubuntu-latest - container: - image: daratools/robase:latest - - env: - GITHUB_PAT: ${{ secrets.AT_ROvis || secrets.GITHUB_TOKEN }} - R_KEEP_PKG_SOURCE: yes - - steps: - - name: Checkout repository - uses: actions/checkout@v5 - - # rocker/tidyverse runs as root; mark the workspace as safe for git - - name: Fix git safe directory - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - - # qpdf is required by R CMD CHECK for PDF size reduction checks - - name: Install system dependencies - run: | - apt-get update -qq - apt-get install -y --no-install-recommends qpdf libcurl4-openssl-dev libssl-dev libxml2-dev git - - # No setup-r step needed โ€” R is already installed in your Docker image - - name: Install R package helpers - run: | - install.packages(c("remotes", "rcmdcheck"), repos = "https://cloud.r-project.org") - shell: Rscript {0} - - - name: Install package dependencies with remotes - env: - GITHUB_PAT: ${{ secrets.AT_ROvis || secrets.GITHUB_TOKEN }} - run: | - remotes::install_github(repo = "rivm-syso/ROvis.utils") - shell: Rscript {0} - - - name: Run R CMD CHECK - run: | - rcmdcheck::rcmdcheck( - args = c("--no-manual", "--compact-vignettes=gs+qpdf"), - error_on = "error", - check_dir = "check" - ) - shell: Rscript {0} - - lint: - runs-on: ubuntu-latest - container: - image: daratools/robase:latest - - permissions: - contents: write - - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - - # Always run, even if R-CMD-check fails - if: always() - - steps: - - name: Checkout repository - uses: actions/checkout@v5 - - # rocker/tidyverse runs as root; mark the workspace as safe for git - - name: Fix git safe directory - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - - - name: Install lintr - run: | - install.packages("lintr", repos = "https://cloud.r-project.org") - shell: Rscript {0} - - - name: Run lintr - # continue-on-error keeps the job green (warn only, never fail) - continue-on-error: true - run: | - # Uses your .lintr config file at the repo root automatically - lints <- lintr::lint_package() - n <- length(lints) - cat("Lint issues found:", n, "\n") - if (n > 0) print(lints) - # Write count to a file for the badge step - writeLines(as.character(n), "lint_count.txt") - if (n > 0) stop(n, " lint issue(s) found.") - shell: Rscript {0} - - - name: Push lint badge to gh-pages - if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') - run: | - # Generate badge JSON into /tmp first to avoid untracked file conflict on branch switch - N=$(cat lint_count.txt 2>/dev/null || echo "0") - if [ "$N" -eq 0 ]; then - COLOR="brightgreen"; MESSAGE="passing" - elif [ "$N" -le 5 ]; then - COLOR="yellow"; MESSAGE="${N} issues" - elif [ "$N" -le 15 ]; then - COLOR="orange"; MESSAGE="${N} issues" - else - COLOR="red"; MESSAGE="${N} issues" - fi - - mkdir -p /tmp/badge-output - printf '{\n "schemaVersion": 1,\n "label": "lintr",\n "message": "%s",\n "color": "%s"\n}\n' \ - "$MESSAGE" "$COLOR" > /tmp/badge-output/lint.json - echo "Lint badge: ${MESSAGE} (${COLOR})" - - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - git fetch origin gh-pages 2>/dev/null || true - if git show-ref --quiet refs/remotes/origin/gh-pages; then - git checkout gh-pages - else - git checkout --orphan gh-pages - git rm -rf . --quiet - fi - - mkdir -p badges - cp /tmp/badge-output/lint.json badges/lint.json - git add badges/lint.json - git diff --cached --quiet || git commit -m "chore: update lint badge [skip ci]" - git push origin gh-pages - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/TBR/test-coverage.yml b/.github/TBR/test-coverage.yml deleted file mode 100644 index 6907b35..0000000 --- a/.github/TBR/test-coverage.yml +++ /dev/null @@ -1,98 +0,0 @@ -name: Test Coverage - -on: - push: - branches: [main, master] - pull_request: - branches: [main, master] - -jobs: - coverage: - runs-on: ubuntu-latest - container: - image: daratools/robase:latest - - permissions: - contents: write - - env: - GITHUB_PAT: ${{ secrets.AT_ROvis || secrets.GITHUB_TOKEN }} - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - # rocker/tidyverse runs as root; mark the workspace as safe for git - - name: Fix git safe directory - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - - # No setup-r step needed โ€” R is already installed in your Docker image - - - name: Setup R dependencies - uses: r-lib/actions/setup-r-dependencies@v2 - with: - extra-packages: any::covr, any::jsonlite - needs: coverage - - - name: Run tests and compute coverage - run: | - cov <- covr::package_coverage( - quiet = FALSE, - clean = FALSE, - install_path = file.path( - normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), - "package" - ) - ) - covr::to_cobertura(cov) - pct <- round(covr::percent_coverage(cov), 1) - - # Determine badge color - color <- dplyr::case_when( - pct >= 90 ~ "brightgreen", - pct >= 75 ~ "green", - pct >= 60 ~ "yellowgreen", - pct >= 50 ~ "yellow", - pct >= 40 ~ "orange", - TRUE ~ "red" - ) - - # Write badge JSON for shields.io endpoint badge - badge <- jsonlite::toJSON( - list( - schemaVersion = 1, - label = "coverage", - message = paste0(pct, "%"), - color = color - ), - auto_unbox = TRUE, - pretty = TRUE - ) - dir.create("/tmp/badge-output", showWarnings = FALSE, recursive = TRUE) - writeLines(badge, "/tmp/badge-output/coverage.json") - cat("Coverage:", pct, "%\n") - shell: Rscript {0} - - - name: Upload coverage badge JSON to GitHub Pages branch - if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - # Switch to (or create) the gh-pages branch - git fetch origin gh-pages 2>/dev/null || true - if git show-ref --quiet refs/remotes/origin/gh-pages; then - git checkout gh-pages - else - git checkout --orphan gh-pages - git rm -rf . --quiet - fi - - # Place the badge file and commit - mkdir -p badges - cp /tmp/badge-output/coverage.json badges/coverage.json - git add badges/coverage.json - git diff --cached --quiet || git commit -m "chore: update coverage badge [skip ci]" - git push origin gh-pages - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/CI.yaml b/.github/workflows/ci.yaml similarity index 85% rename from .github/workflows/CI.yaml rename to .github/workflows/ci.yaml index 6723ee1..2a52386 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/ci.yaml @@ -267,49 +267,49 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.AT_ROvis || secrets.GITHUB_TOKEN }} - pkgdown: - needs: test-coverage - # test-coverage only runs on push/pull_request (see its `if:`), so on a - # release/workflow_dispatch trigger it's skipped rather than successful - - # explicitly allow that here, otherwise the default needs-gating would - # skip this job too. - if: | - github.event_name != 'pull_request' && - !cancelled() && - (needs.test-coverage.result == 'success' || needs.test-coverage.result == 'skipped') - runs-on: ubuntu-latest - container: - image: daratools/robase:latest - permissions: - contents: write - pages: write - env: - GITHUB_PAT: ${{ secrets.AT_ROvis || secrets.GITHUB_TOKEN }} - steps: - - name: Checkout repository - uses: actions/checkout@v5 - - # rocker-based images run as root; mark the workspace as safe for git - - name: Fix git safe directory - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - - # No setup-r step needed โ€” R is already installed in your Docker image - - name: Setup pandoc - uses: r-lib/actions/setup-pandoc@v2 - - - name: Setup R dependencies - uses: r-lib/actions/setup-r-dependencies@v2 - with: - extra-packages: any::pkgdown, local::. - needs: website - - - name: Build pkgdown site - run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) - shell: Rscript {0} - - # - name: Deploy to GitHub Pages - # uses: JamesIves/github-pages-deploy-action@v4 - # with: - # clean: false # keeps the badges/ folder written by the coverage job - # branch: gh-pages - # folder: docs + # pkgdown: + # needs: test-coverage + # # test-coverage only runs on push/pull_request (see its `if:`), so on a + # # release/workflow_dispatch trigger it's skipped rather than successful - + # # explicitly allow that here, otherwise the default needs-gating would + # # skip this job too. + # if: | + # github.event_name != 'pull_request' && + # !cancelled() && + # (needs.test-coverage.result == 'success' || needs.test-coverage.result == 'skipped') + # runs-on: ubuntu-latest + # container: + # image: daratools/robase:latest + # permissions: + # contents: write + # pages: write + # env: + # GITHUB_PAT: ${{ secrets.AT_ROvis || secrets.GITHUB_TOKEN }} + # steps: + # - name: Checkout repository + # uses: actions/checkout@v5 + + # # rocker-based images run as root; mark the workspace as safe for git + # - name: Fix git safe directory + # run: git config --global --add safe.directory "$GITHUB_WORKSPACE" + + # # No setup-r step needed โ€” R is already installed in your Docker image + # - name: Setup pandoc + # uses: r-lib/actions/setup-pandoc@v2 + + # - name: Setup R dependencies + # uses: r-lib/actions/setup-r-dependencies@v2 + # with: + # extra-packages: any::pkgdown, local::. + # needs: website + + # - name: Build pkgdown site + # run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + # shell: Rscript {0} + + # - name: Deploy to GitHub Pages + # uses: JamesIves/github-pages-deploy-action@v4 + # with: + # clean: false # keeps the badges/ folder written by the coverage job + # branch: gh-pages + # folder: docs