diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 16be22f7..9dba3fa2 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,115 +1,100 @@ +name: R-CMD-check + on: push: - branches: - - main - - master - - pre-release + branches: [main, master, pre-release] pull_request: - branches: - - main - - master - - pre-release - -name: R-CMD-check + branches: [main, master, pre-release] jobs: - R-CMD-check: + build: runs-on: ${{ matrix.config.os }} - - name: ${{ matrix.config.os }} (${{ matrix.config.r }}) - strategy: fail-fast: false matrix: config: - {os: windows-latest, r: 'release'} - - {os: ubuntu-latest, r: 'release'} - # - {os: macOS-latest, r: 'release'} - # - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - # - {os: ubuntu-latest, r: 'oldrel-1'} - - env: - RSPM: ${{ matrix.config.rspm }} - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - R_REMOTES_NO_ERRORS_FROM_WARNINGS: false - NOT_CRAN: true - + - {os: ubuntu-latest, r: 'release'} + - {os: macOS-latest, r: 'release'} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-r@v2 + - name: Setup R + uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} - - uses: r-lib/actions/setup-pandoc@v2 - - - name: Query dependencies + # Install JAGS and system dependencies on Linux + - name: Install System Dependencies (Linux) + if: runner.os == 'Linux' run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - shell: Rscript {0} - - - name: Cache R packages - if: runner.os != 'Windows' - uses: actions/cache@v1 - with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-r-${{ matrix.config.r }}-3-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-3- - - - name: Set path for RTools 4.0 - if: runner.os == 'Windows' - run: echo "C:/rtools40/usr/bin;C:/rtools40/mingw64/bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - - - name: Install most Windows system dependencies + sudo apt-get update + sudo apt-get install -y \ + libssl-dev \ + libcurl4-openssl-dev \ + libxml2-dev \ + libfontconfig1-dev \ + libharfbuzz-dev \ + libfribidi-dev \ + libfreetype6-dev \ + libpng-dev \ + libtiff5-dev \ + libjpeg-dev \ + libcairo2-dev \ + jags + + # Install JAGS on Windows + - name: Install JAGS (Windows) if: runner.os == 'Windows' + shell: cmd run: | - pacman -Syu mingw-w64-x86_64-make --noconfirm - g++ --version - Get-Command g++ | Select-Object -ExpandProperty Definition - mingw32-make --version - Get-Command mingw32-make | Select-Object -ExpandProperty Definition - (New-Object System.Net.WebClient).DownloadFile('https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Windows/JAGS-4.3.1.exe', 'C:\JAGS-4.3.1.exe') - shell: powershell + curl -o jags-installer.exe -L https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Windows/JAGS-4.3.1.exe/download + jags-installer.exe /S + del jags-installer.exe - - name: Install JAGS on Windows + # Set JAGS environment variables on Windows + - name: Set JAGS environment variables (Windows) if: runner.os == 'Windows' - run: C:\JAGS-4.3.1.exe /S shell: cmd - - - name: Install Linux system dependencies - if: runner.os == 'Linux' - env: - RHUB_PLATFORM: linux-x86_64-ubuntu-gcc run: | - sudo apt-get install -y libglpk-dev - Rscript -e "remotes::install_github('r-hub/sysreqs')" - sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))") - sudo -s eval "$sysreqs" - sudo -s apt-get install jags - sudo -s apt-get install libv8-dev - sudo -s apt-get install libnode-dev - sudo -s apt-get install libcurl4-openssl-dev + echo JAGS_ROOT=C:\Program Files\JAGS\JAGS-4.3.1>> %GITHUB_ENV% + echo JAGS_MAJOR_VERSION=4>> %GITHUB_ENV% + echo PATH=C:\Program Files\JAGS\JAGS-4.3.1\bin;%PATH%>> %GITHUB_ENV% - - name: Install Mac system dependencies + # Install JAGS on macOS + - name: Install JAGS (macOS) if: runner.os == 'macOS' run: | - rm '/usr/local/bin/gfortran' - brew install automake jags - - - name: Install dependencies - if: runner.os != 'macOS' + brew update + brew install jags + + # Find and Set JAGS Paths + - name: Set Environment Variables (macOS) + if: runner.os == 'macOS' run: | - remotes::install_deps(dependencies = TRUE, type = ifelse(tolower(Sys.info()["sysname"]) == "linux", "source", "binary")) - remotes::install_cran("rcmdcheck") - shell: Rscript {0} + JAGS_BIN=$(brew --prefix jags)/bin + echo "JAGS_ROOT=$(brew --prefix jags)" >> $GITHUB_ENV + echo "PATH=$JAGS_BIN:$PATH" >> $GITHUB_ENV + echo "PKG_CONFIG_PATH=$(brew --prefix jags)/lib/pkgconfig" >> $GITHUB_ENV - - name: Install dependencies (macOS) + # Create Symlink for jags-terminal (if necessary) + - name: Create Symlink for jags-terminal (macOS) if: runner.os == 'macOS' run: | - remotes::install_deps(dependencies = TRUE, type = ifelse(tolower(Sys.info()["sysname"]) == "linux", "source", "binary")) - install.packages("rjags", type = "source") - remotes::install_cran("rcmdcheck") + sudo mkdir -p $(brew --prefix)/libexec + sudo ln -s $(brew --prefix jags)/bin/jags $(brew --prefix)/libexec/jags-terminal + + # Set up renv + - name: Setup renv + uses: r-lib/actions/setup-renv@v2 + + # Install the package + - name: Install devtools and the RoBMA Package + run: | + install.packages('devtools') + install.packages('rcmdcheck') + install.packages(c('BayesFactor', 'runjags', 'rjags', 'rstan', 'scales', 'vdiffr', 'testthat', 'covr', 'pandoc')) + devtools::install() shell: Rscript {0} - name: Check @@ -117,6 +102,7 @@ jobs: env: _R_CHECK_CRAN_INCOMING_REMOTE_: false run: | + options(crayon.enabled = TRUE) rcmdcheck::rcmdcheck( args = c("--no-manual", "--as-cran", "--ignore-vignettes"), build_args = c("--no-build-vignettes"), @@ -131,16 +117,18 @@ jobs: JAGS_ROOT: "/c/progra~1/JAGS/JAGS-4.3.1" JAGS_MAJOR_VERSION: 4 run: | + options(crayon.enabled = TRUE) rcmdcheck::rcmdcheck( args = c("--no-manual", "--as-cran", "--ignore-vignettes"), build_args = c("--no-build-vignettes"), error_on = "warning", check_dir = "check") - shell: Rscript {0}" + shell: Rscript {0} + - name: Upload check results if: failure() uses: actions/upload-artifact@main with: name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check \ No newline at end of file + path: check diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index b325007c..92ef73f0 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -1,87 +1,67 @@ +name: pkgdown + on: push: branches: - main - master tags: - -'*' - -name: pkgdown + - '*' jobs: - pkgdown: + build: runs-on: ${{ matrix.config.os }} - - name: ${{ matrix.config.os }} (${{ matrix.config.r }}) - strategy: fail-fast: false matrix: config: - - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + - {os: windows-latest, r: 'release'} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-r@v2 + - name: Setup R + uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} - - uses: r-lib/actions/setup-pandoc@v2 - - - name: Install harfbuzz freetype2 fribidi Headers - if: runner.os == 'Linux' - run: sudo apt-get install libharfbuzz-dev libfribidi-dev - - - - name: Query dependencies + # Install JAGS on Windows + - name: Install JAGS (Windows) + if: runner.os == 'Windows' + shell: cmd run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} + curl -o jags-installer.exe -L https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Windows/JAGS-4.3.1.exe/download + jags-installer.exe /S + del jags-installer.exe - - name: Restore R package cache - uses: actions/cache@v2 - with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - - - name: Install system dependencies - if: runner.os == 'Linux' - run: | - while read -r cmd - do - eval sudo $cmd - done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') - - name: Install JAGS (windows-latest) + # Set JAGS environment variables on Windows + - name: Set JAGS environment variables (Windows) if: runner.os == 'Windows' - run: | - curl.exe -o wjags.exe --url https://deac-fra.dl.sourceforge.net/project/mcmc-jags/JAGS/4.x/Windows/JAGS-4.3.1.exe - wjags.exe /S - del wjags.exe shell: cmd + run: | + echo JAGS_ROOT=C:\Program Files\JAGS\JAGS-4.3.1>> %GITHUB_ENV% + echo JAGS_MAJOR_VERSION=4>> %GITHUB_ENV% + echo PATH=C:\Program Files\JAGS\JAGS-4.3.1\bin;%PATH%>> %GITHUB_ENV% + + # Set up renv + - name: Setup renv + uses: r-lib/actions/setup-renv@v2 - - name: Install JAGS (macOS-latest) - if: runner.os == 'macOS' - run : | - rm '/usr/local/bin/gfortran' - brew install automake jags - - name: Install dependencies + # Install Pandoc + - name: Setup Pandoc + uses: r-lib/actions/setup-pandoc@v2 + + # Install the package and its dependencies + - name: Install devtools and the RoBMA Package run: | - remotes::install_deps(dependencies = TRUE) - install.packages("pkgdown") + install.packages('devtools') + install.packages('pkgdown') + install.packages(c('BayesFactor', 'runjags', 'rjags', 'rstan', 'scales', 'vdiffr', 'testthat', 'covr', 'pandoc')) + devtools::install() shell: Rscript {0} - - name: Install package - run: R CMD INSTALL . - - name: Deploy package run: | git config --local user.email "actions@github.com" git config --local user.name "GitHub Actions" - Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' \ No newline at end of file + Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 96439566..a2a582e8 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -1,86 +1,58 @@ +name: test-coverage + on: push: - branches: - - main - - master - - pre-release + branches: [main, master, pre-release] pull_request: - branches: - - main - - master - - pre-release - -name: test-coverage + branches: [main, master, pre-release] jobs: - test-coverage: + build: runs-on: ${{ matrix.config.os }} - - name: ${{ matrix.config.os }} (${{ matrix.config.r }}) - strategy: fail-fast: false matrix: config: - {os: windows-latest, r: 'release'} - #- {os: ubuntu-latest, r: 'release'} - #- {os: macOS-latest, r: 'release'} - - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-r@v2 + - name: Setup R + uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} - - uses: r-lib/actions/setup-pandoc@v2 - - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} - - - name: Restore R package cache - uses: actions/cache@v2 - with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - - - name: Install system dependencies - if: runner.os == 'Linux' + # Install JAGS on Windows + - name: Install JAGS (Windows) + if: runner.os == 'Windows' + shell: cmd run: | - while read -r cmd - do - eval sudo $cmd - done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') + curl -o jags-installer.exe -L https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Windows/JAGS-4.3.1.exe/download + jags-installer.exe /S + del jags-installer.exe - - name: Install JAGS (windows-latest) + # Set JAGS environment variables on Windows + - name: Set JAGS environment variables (Windows) if: runner.os == 'Windows' - run: | - curl.exe -o wjags.exe --url https://deac-fra.dl.sourceforge.net/project/mcmc-jags/JAGS/4.x/Windows/JAGS-4.3.1.exe - wjags.exe /S - del wjags.exe shell: cmd + run: | + echo JAGS_ROOT=C:\Program Files\JAGS\JAGS-4.3.1>> %GITHUB_ENV% + echo JAGS_MAJOR_VERSION=4>> %GITHUB_ENV% + echo PATH=C:\Program Files\JAGS\JAGS-4.3.1\bin;%PATH%>> %GITHUB_ENV% - - name: Install JAGS (macOS-latest) - if: runner.os == 'macOS' - run : | - rm '/usr/local/bin/gfortran' - brew install automake jags + # Set up renv + - name: Setup renv + uses: r-lib/actions/setup-renv@v2 - - name: Install dependencies + # Install the package + - name: Install devtools and the RoBMA Package run: | - install.packages(c("remotes")) - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("covr") + install.packages(c('BayesFactor', 'runjags', 'rjags', 'rstan', 'scales', 'vdiffr', 'testthat', 'covr', 'pandoc')) + devtools::install() shell: Rscript {0} + # Run the coverage check - name: Test coverage run: covr::codecov() - shell: Rscript {0} \ No newline at end of file + shell: Rscript {0}