[fix carpentries/styles#477] rewrite travis script
[rnaseq-cwl-training.git] / bin / boilerplate / .travis.yml
index d91aaf4210b17b4f6525bf6db11e116ccb70d6f7..f6885e9ae3964866c04dd2a17f34860ebab75dc3 100644 (file)
@@ -1,24 +1,57 @@
 # Travis CI is only used to check the lesson and is not involved in its deployment
-dist: xenial  # Ubuntu 16.04 (required for python 3.7)
-language: python
-python: 3.7
+dist: bionic
+language: ruby
+rvm:
+  - 2.7.1
+
 branches:
   only:
   - gh-pages
   - /.*/
+
+cache:
+  apt: true
+  bundler: true
+  directories:
+    - /home/travis/.rvm/
+    - $R_LIBS_USER
+    - $HOME/.cache/pip
+
+env:
+  global:
+    - NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer
+    - R_LIBS_USER=~/R/Library
+    - R_LIBS_SITE=/usr/local/lib/R/site-library:/usr/lib/R/site-library
+    - R_VERSION=4.0.2
+
 before_install:
-  - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
-  - echo "deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/" | sudo tee -a /etc/apt/sources.list
-  - sudo apt-get update -y
-  - sudo apt-get install -y r-base
-  - sudo Rscript -e "install.packages('knitr', repos = 'https://', dependencies = TRUE)"
-  - sudo Rscript -e "install.packages('stringr', repos = 'https://cran.rstudio.com', dependencies = TRUE)"
-  - sudo Rscript -e "install.packages('checkpoint', repos = 'https://cran.rstudio.com', dependencies = TRUE)"
-  - sudo Rscript -e "install.packages('ggplot2', repos = 'https://cran.rstudio.com', dependencies = TRUE)"
-  - rvm default
-  - gem install json kramdown jekyll bundler
-install:
-  - pip install pyyaml
+  ## Install R + pandoc + dependencies
+  - sudo add-apt-repository -y "ppa:marutter/rrutter4.0"
+  - sudo add-apt-repository -y "ppa:c2d4u.team/c2d4u4.0+"
+  - sudo add-apt-repository -y "ppa:ubuntugis/ppa"
+  - sudo add-apt-repository -y "ppa:cran/travis"
+  - travis_apt_get_update
+  - sudo apt-get install -y --no-install-recommends build-essential gcc g++ libblas-dev liblapack-dev libncurses5-dev libreadline-dev libjpeg-dev libpcre3-dev libpng-dev zlib1g-dev libbz2-dev liblzma-dev libicu-dev cdbs qpdf texinfo libssh2-1-dev gfortran jq python3.5 python3-pip r-base
+  - export PATH=${TRAVIS_HOME}/R-bin/bin:$PATH
+  - export LD_LIBRARY_PATH=${TRAVIS_HOME}/R-bin/lib:$LD_LIBRARY_PATH
+  - sudo mkdir -p /usr/local/lib/R/site-library $R_LIBS_USER
+  - sudo chmod 2777 /usr/local/lib/R /usr/local/lib/R/site-library $R_LIBS_USER
+  - echo 'options(repos = c(CRAN = "https://packagemanager.rstudio.com/all/__linux__/bionic/latest"))' > ~/.Rprofile.site
+  - export R_PROFILE=~/.Rprofile.site
+  - curl -fLo /tmp/texlive.tar.gz https://github.com/jimhester/ubuntu-bin/releases/download/latest/texlive.tar.gz
+  - tar xzf /tmp/texlive.tar.gz -C ~
+  - export PATH=${TRAVIS_HOME}/texlive/bin/x86_64-linux:$PATH
+  - tlmgr update --self
+  - curl -fLo /tmp/pandoc-2.2-1-amd64.deb https://github.com/jgm/pandoc/releases/download/2.2/pandoc-2.2-1-amd64.deb
+  - sudo dpkg -i /tmp/pandoc-2.2-1-amd64.deb
+  - sudo apt-get install -f
+  - rm /tmp/pandoc-2.2-1-amd64.deb
+  - Rscript -e "install.packages(setdiff(c('renv', 'rprojroot'), installed.packages()), loc = Sys.getenv('R_LIBS_USER')); update.packages(lib.loc = Sys.getenv('R_LIBS_USER'), ask = FALSE, checkBuilt = TRUE)"
+  - Rscript -e 'sessionInfo()'
+  ## Install python and dependencies
+  - python3 -m pip install --upgrade pip setuptools wheel
+  - python3 -m pip install pyyaml
+
 script:
   - make lesson-check-all
   - make --always-make site