Travis CI for R packages: no deploy key found

j3ypi

I try to set up a R Package with a pkgdown website, which I want to connect to Travis CI. I'm new to Travis and I don't have any clue why it still fails with the error massage

Deploying application
Error: No deploy key found, please setup with `travis::use_travis_deploy()`
Execution halted
Script failed with status 1
failed to deploy

Executing the call travis::use_travis_deploy() within RStudio returns

> travis::use_travis_deploy()
i Querying Github deploy keys from repo.
i Getting environment variables for `j3ypi/inductive` on Travis CI.
> Deploy keys for Travis CI (`.org`) already present. No action required.

indicating that everything is as it's supposed to be. When Travis CI sets the environment variables it even says

Setting environment variables from repository settings
$ export TRAVIS_DEPLOY_KEY=[secure]
$ export GITHUB_PAT=[secure]

For the .travis.yml file I oriented towards the one of the dplyr package. It looks like this

# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r

language: r
os: linux
dist: trusty
cache: packages
latex: false

jobs:
  include:
    before_cache: Rscript -e 'remotes::install_cran("pkgdown")'
    deploy:
      provider: script
      script: Rscript -e 'pkgdown::deploy_site_github()'
      skip_cleanup: true
      github-token: $GITHUB_PAT

env:
  global:
  - _R_CHECK_FORCE_SUGGESTS_=false
  - MAKEFLAGS="-j 2"
  - TRAVIS_CXXFLAGS="-Wall -Wextra -pedantic -Werror"
  - R_REMOTES_NO_ERRORS_FROM_WARNINGS=true
  - _R_CHECK_SYSTEM_CLOCK_=FALSE

Does anyone have an idea? Weirdly enough, the deploy key on Github says it's never been used. The GITHUB_PAT, R_TRAVIS and R_TRAVIS_ORG variables are specified within the .Renviron. The R CMD check passed locally without any errors or warnings.

j3ypi

I still have no idea why the code I used failed, since it works for so many packages from the tidyverse. But I got it running eventually.

Just use tic::use_tic() from the tic package, which will setup your .travis.yml file properly. The .travis.yml file will look similar to this:

# tic documentation: https://docs.ropensci.org/tic/dev/

# OS ---------------------------------------------------------------------------
os: linux
dist: bionic

# meta -------------------------------------------------------------------------
language: r
cache:
  - packages
  - ccache
latex: false

# multiple R versions ----------------------------------------------------------
matrix:
  include:
  - r: devel
  - r: oldrel
  - r: release
    env:
    - BUILD_PKGDOWN=true

# Stages -----------------------------------------------------------------------

before_install:
  - if [ "${TRAVIS_OS_NAME}" == "osx" ]; then brew install ccache; fi
  - if [ "${TRAVIS_OS_NAME}" == "osx" ]; then export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi
  - echo -e "options(Ncpus = 8, repos = structure(c(CRAN = 'https://cloud.r-project.org/')))" > $HOME/.Rprofile
  - mkdir -p $HOME/.R && echo -e 'CXX_STD = CXX14\n\nCC=ccache gcc -std=gnu99\nCXX=ccache g++\nCXX11=ccache g++ -std=gnu99\nCXX14=ccache g++ -std=gnu99\nC11=ccache g++\nC14=ccache g++\nFC=ccache gfortran\nF77=ccache gfortran' > $HOME/.R/Makevars
  - mkdir -p $HOME/.ccache && echo -e 'max_size = 5.0G\nsloppiness = include_file_ctime\nhash_dir=false' > $HOME/.ccache/ccache.conf
  - R -q -e 'if (!requireNamespace("remotes")) install.packages("remotes")'
  - R -q -e 'if (getRversion() < "3.2" && !requireNamespace("curl")) install.packages("curl")'
  - R -q -e 'remotes::install_github("ropensci/tic", upgrade = "always"); print(tic::dsl_load()); tic::prepare_all_stages()'
  - R -q -e 'tic::before_install()'
install:
  - R -q -e 'tic::install()'
before_script: R -q -e 'tic::before_script()'
script: R -q -e 'tic::script()'
after_success: R -q -e 'tic::after_success()'
after_failure: R -q -e 'tic::after_failure()'
before_deploy: R -q -e 'tic::before_deploy()'
deploy:
  provider: script
  script: R -q -e 'tic::deploy()'
  on:
    all_branches: true
after_deploy: R -q -e 'tic::after_deploy()'
after_script: R -q -e 'tic::after_script()'

# Custom user code -------------------------------------------------------------

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related