Skip to content

Commit

Permalink
use the tic package to setup CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ThierryO committed Nov 12, 2018
1 parent dee9e6a commit 963f6b1
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 19 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
^tic\.R$
^\.github$
^CODE_OF_CONDUCT\.md$
^codemeta\.json$
Expand Down
47 changes: 38 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,51 @@
# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r
# Default configuration for use with tic package
# Usually you shouldn't need to change the first part of the file

language: R
# DO NOT CHANGE THE CODE BELOW
before_install: R -q -e 'install.packages(c("remotes", "curl")); remotes::install_github("ropenscilabs/tic"); tic::prepare_all_stages(); tic::before_install()'
install: R -q -e 'tic::install()'
after_install: R -q -e 'tic::after_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:
branch: master
condition:
- $TRAVIS_PULL_REQUEST = false
- $TRAVIS_EVENT_TYPE != cron
- $TRAVIS_R_VERSION_STRING = release
after_deploy: R -q -e 'tic::after_deploy()'
after_script: R -q -e 'tic::after_script()'
# DO NOT CHANGE THE CODE ABOVE

# Custom parts:

# Header
language: r
r:
- oldrel
- release
- devel
sudo: false
dist: trusty
cache: packages
addons:
apt:
packages:
- libgit2-dev
latex: false

#env
env:
global:
- _R_CHECK_FORCE_SUGGESTS_=false
- MAKEFLAGS="-j 2"

r_packages:
- covr
- lintr
after_script:
- R CMD INSTALL $PKG_TARBALL
- Rscript -e 'lintr::lint_package()'
after_success:
- Rscript -e 'covr::codecov()'
#services
services:
33 changes: 23 additions & 10 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,35 @@ init:
Import-Module '..\appveyor-tool.ps1'
install:
ps: Bootstrap
- ps: Bootstrap
- cmd: R -q -e "writeLines('options(repos = \'https://cloud.r-project.org\')', '~/.Rprofile')"
- cmd: R -q -e "getOption('repos')"
- cmd: R -q -e "install.packages('remotes'); remotes::install_github('ropenscilabs/tic'); tic::prepare_all_stages()"

cache:
- C:\RLibrary
- C:\RLibrary

before_build: R -q -e "tic::before_install()"
build_script: R -q -e "tic::install()"
after_build: R -q -e "tic::after_install()"
before_test: R -q -e "tic::before_script()"
test_script: R -q -e "tic::script()"
on_success: R -q -e "try(tic::after_success(), silent = TRUE)"
on_failure: R -q -e "tic::after_failure()"
before_deploy: R -q -e "tic::before_deploy()"
deploy_script: R -q -e "tic::deploy()"
after_deploy: R -q -e "tic::after_deploy()"
on_finish: R -q -e "tic::after_script()"

# Adapt as necessary starting from here

build_script:
- travis-tool.sh install_deps
#on_failure:
# - 7z a failure.zip *.Rcheck\*
# - appveyor PushArtifact failure.zip

test_script:
- travis-tool.sh run_tests

on_failure:
- 7z a failure.zip *.Rcheck\*
- appveyor PushArtifact failure.zip
#environment:
# GITHUB_PAT:
# secure: VXO22OHLkl4YhVIomSMwCZyOTx03Xf2WICaVng9xH7gISlAg8a+qrt1DtFtk8sK5

artifacts:
- path: '*.Rcheck\**\*.log'
Expand Down
15 changes: 15 additions & 0 deletions tic.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
add_package_checks()

if (Sys.getenv("id_rsa") != "" && inherits(ci(), "TravisCI")) {
# pkgdown documentation can be built optionally. Other example criteria:
# - `inherits(ci(), "TravisCI")`: Only for Travis CI
# - `ci()$is_tag()`: Only for tags, not for branches
# - `Sys.getenv("BUILD_PKGDOWN") != ""`: If the env var "BUILD_PKGDOWN" is set
# - `Sys.getenv("TRAVIS_EVENT_TYPE") == "cron"`: Only for Travis cron jobs
get_stage("before_deploy") %>%
add_step(step_setup_ssh())

get_stage("deploy") %>%
add_step(step_build_pkgdown()) %>%
add_step(step_push_deploy(path = "docs", branch = "gh-pages"))
}

0 comments on commit 963f6b1

Please sign in to comment.