easystats / workflows

GitHub Actions for {easystats} packages
https://indrajeetpatil.github.io/preventive-r-package-care
Creative Commons Zero v1.0 Universal
8 stars 1 forks source link

How do we depend on `{XML}`?! #7

Closed IndrajeetPatil closed 1 year ago

IndrajeetPatil commented 1 year ago

Currently, GHA are failing because of XML installation failures (https://github.com/r-lib/actions/issues/559). But I don't understand where this package is used.

pak::pkg_deps_explain("easystats", "XML")
#> ✔ Updated metadata database: 3.98 MB in 9 files.                          
#> ℹ R 4.2 aarch64-apple-darwin20 packages are missing from Bioconductor      
#> ✔ Updating metadata database ... done                                     
#> x XML  

Is there any soft or hard dependency that (recursively) depends on {XML}?

bwiernik commented 1 year ago

I think that's the new HTML 5 support in documentation

IndrajeetPatil commented 1 year ago

But all GHA fail due to this issue; i.e., all of them seems to need and install {XML}, not just the new HTML-5 GHA.

So I am wondering if there is any soft dependency we rely on that requires {XML}.

etiennebacher commented 1 year ago

Is it because of this line? Or did you add it because there were already some failures?

https://github.com/easystats/workflows/blob/86e36484d77c1406a24155aab53e4d8e09682abc/.github/workflows/R-CMD-check.yaml#L63-L66

(It was added in 65cfaf3)

IndrajeetPatil commented 1 year ago

Yeah, I added it when failures started to occur. That's the recommended solution in the original actions repo issue.

Lemme remove it and see if it makes any difference.

etiennebacher commented 1 year ago

Also, I think pak::pkg_deps_explain() does not take into account the "Suggests", but GHA installs them to run the tests. For example, datawizard has dplyr in "Suggests" but it doesn't show in the output:

> pak::pkg_deps_explain("datawizard", "dplyr")
x dplyr   
IndrajeetPatil commented 1 year ago

You can set dependencies = "all":

> pak::pkg_deps_explain("datawizard", "dplyr", dependencies = "all")
✔ Loading metadata database ... done
datawizard -> brms -> bayesplot -> dplyr                                   
datawizard -> brms -> shinystan -> bayesplot -> dplyr
datawizard -> dplyr
datawizard -> rstanarm -> bayesplot -> dplyr
datawizard -> rstanarm -> shinystan -> bayesplot -> dplyr
datawizard -> tidyr -> dplyr

But, even then, {XML} doesn't show up anywhere.

> pak::pkg_deps_explain("easystats", "XML", dependencies = "all")
x XML  
IndrajeetPatil commented 1 year ago

LMAO. We didn't need it after all. Things seem to be working now.

Closed in https://github.com/easystats/workflows/commit/c116bd1ce43e904edae71b23e32932a0be01a5cc

etiennebacher commented 1 year ago

Where do you see that it worked?

IndrajeetPatil commented 1 year ago

https://github.com/easystats/easystats/pull/303

IndrajeetPatil commented 1 year ago

I think only {parameters} needs it:

> pak::pkg_deps_explain("parameters", "XML", dependencies = "all")
✔ Updated metadata database: 4.82 MB in 12 files.                         
ℹ R 4.2 aarch64-apple-darwin20 packages are missing from Bioconductor      
✔ Updating metadata database ... done                                     
parameters -> EGAnet -> semPlot -> XML 

But including it in the shared workflow creates issues for other packages. Quite the conundrum.

strengejacke commented 1 year ago

Any ideas how to resolve this? Can we make an individual GHA workflow for parameters?

IndrajeetPatil commented 1 year ago

Replace this with the following:

# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help

on:
  push:
    branches: [main, master]
  pull_request:
    branches: [main, master]

name: R-CMD-check

jobs:
  R-CMD-check:
    runs-on: ${{ matrix.config.os }}

    name: ${{ matrix.config.os }} (${{ matrix.config.r }})

    strategy:
      fail-fast: false
      matrix:
        config:
          #- {os: macOS-latest,   r: 'devel'}
          - {os: macOS-latest,   r: 'release'}
          - {os: macOS-latest,   r: 'oldrel'}
          #- {os: macOS-latest,   r: 'oldrel-2'}
          #- {os: macOS-latest,   r: 'oldrel-3'}

          - {os: windows-latest, r: 'devel'}
          - {os: windows-latest, r: 'release'}
          - {os: windows-latest, r: 'oldrel'}
          #- {os: windows-latest, r: 'oldrel-2'}
          #- {os: windows-latest, r: 'oldrel-3'}

          - {os: ubuntu-latest,  r: 'devel', http-user-agent: 'release'}
          - {os: ubuntu-latest,  r: 'release'}
          - {os: ubuntu-latest,  r: 'oldrel'}
          - {os: ubuntu-latest,  r: 'oldrel-2'}
          - {os: ubuntu-latest,  r: 'oldrel-3'}

    env:
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
      R_KEEP_PKG_SOURCE: yes
      _R_CHECK_CRAN_INCOMING_: false
      _R_CHECK_FORCE_SUGGESTS_: false

    steps:
      - uses: actions/checkout@v2

      # Always try to use the latest pandoc version
      # https://github.com/jgm/pandoc/releases
      - uses: r-lib/actions/setup-pandoc@v2
        with:
          pandoc-version: '2.19.2'

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

      # TODO: Check which of the ignore conditions are still relevant given the
      # current suggested dependencies and the minimum supported R version.
      # Update if anything out of date or not needed anymore.
      - uses: r-lib/actions/setup-r-dependencies@v2
        with:
          extra-packages: |
            any::rcmdcheck
            any::XML
            metafor=?ignore-before-r=4.0.0
            emmeans=?ignore-before-r=4.1.0
            rmcorr=?ignore-before-r=4.1.0
            randomForest=?ignore-before-r=4.1.0
            MuMIn=?ignore-before-r=4.2.0
          needs: check

      # Don't error on "note" because if any of the suggested packages are not available
      # for a given R version, this generates a NOTE causing unnecessary build failure
      - uses: r-lib/actions/check-r-package@v2
        with:
          error-on: '"warning"'
          upload-snapshots: true

You will need to manually keep this file in sync with the version in workflows repo.

etiennebacher commented 1 year ago

Other possibility: pass the name of the package that is being tested as an input to the call of the common workflow. In the common workflow, make an if condition that installs XML only if the package tested is parameters. I think it should be feasible but I don't know how exactly.

Cf https://github.com/easystats/easystats/issues/234#issuecomment-1234230324

IndrajeetPatil commented 1 year ago

@etiennebacher Do you want to give it a try?

etiennebacher commented 1 year ago

Yes, maybe this weekend

strengejacke commented 1 year ago

I think only {parameters} needs it:

> pak::pkg_deps_explain("parameters", "XML", dependencies = "all")
✔ Updated metadata database: 4.82 MB in 12 files.                         
ℹ R 4.2 aarch64-apple-darwin20 packages are missing from Bioconductor      
✔ Updating metadata database ... done                                     
parameters -> EGAnet -> semPlot -> XML 

But including it in the shared workflow creates issues for other packages. Quite the conundrum.

Can we prevent XML from being installed?