😎 Give your xaringan slides some style
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

177 lines
8.2KB

  1. on:
  2. push:
  3. pull_request:
  4. # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master)
  5. schedule:
  6. # * is a special character in YAML so you have to quote this string
  7. - cron: "0 4 * * *"
  8. name: CI by {tic}
  9. jobs:
  10. R-CMD-check:
  11. runs-on: ${{ matrix.config.os }}
  12. name: ${{ matrix.config.os }} (${{ matrix.config.r }})
  13. strategy:
  14. fail-fast: false
  15. matrix:
  16. config:
  17. # comment out lines if you do not want to build on certain platforms
  18. - { os: windows-latest, r: "release" }
  19. - { os: macOS-latest, r: "release", pkgdown: "true" }
  20. - { os: macOS-latest, r: "devel" }
  21. - { os: ubuntu-latest, r: "release" }
  22. env:
  23. # otherwise remotes::fun() errors cause the build to fail. Example: Unavailability of binaries
  24. R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
  25. CRAN: ${{ matrix.config.cran }}
  26. # we are not allowed to write to ~/.ccache on GH Actions
  27. # setting some ccache options
  28. CCACHE_BASEDIR: ${{ GITHUB.WORKSPACE }}
  29. CCACHE_DIR: ${{ GITHUB.WORKSPACE }}/.ccache
  30. CCACHE_NOHASHDIR: true
  31. CCACHE_SLOPPINESS: include_file_ctime
  32. # make sure to run `tic::use_ghactions_deploy()` to set up deployment
  33. TIC_DEPLOY_KEY: ${{ secrets.TIC_DEPLOY_KEY }}
  34. # prevent rgl issues because no X11 display is available
  35. RGL_USE_NULL: true
  36. # if you use bookdown or blogdown, replace "PKGDOWN" by the respective
  37. # capitalized term. This also might need to be done in tic.R
  38. BUILD_PKGDOWN: ${{ matrix.config.pkgdown }}
  39. # macOS >= 10.15.4 linking
  40. SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
  41. steps:
  42. - uses: actions/checkout@v2
  43. - uses: r-lib/actions/setup-r@master
  44. with:
  45. r-version: ${{ matrix.config.r }}
  46. Ncpus: 4
  47. # LaTeX. Installation time:
  48. # Linux: ~ 1 min
  49. # macOS: ~ 1 min 30s
  50. # Windows: never finishes
  51. - uses: r-lib/actions/setup-tinytex@v1
  52. if: runner.os != 'Windows'
  53. - uses: r-lib/actions/setup-pandoc@master
  54. # set date/week for use in cache creation
  55. # https://github.community/t5/GitHub-Actions/How-to-set-and-access-a-Workflow-variable/m-p/42970
  56. # - cache R packages daily
  57. # - cache ccache weekly -> 'ccache' helps rebuilding the package cache faster
  58. - name: "[Cache] Prepare daily timestamp for cache"
  59. if: runner.os != 'Windows'
  60. id: date
  61. run: echo "::set-output name=date::$(date '+%d-%m')"
  62. - name: "[Cache] Prepare weekly timestamp for cache"
  63. if: runner.os != 'Windows'
  64. id: datew
  65. run: echo "::set-output name=datew::$(date '+%Y-%V')"
  66. - name: "[Cache] Cache R packages"
  67. if: runner.os != 'Windows'
  68. uses: pat-s/always-upload-cache@v1.1.4
  69. with:
  70. path: ${{ env.R_LIBS_USER }}
  71. key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}}
  72. restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}}
  73. - name: "[Cache] Cache ccache"
  74. if: runner.os != 'Windows'
  75. uses: pat-s/always-upload-cache@v1.1.4
  76. with:
  77. path: ${{ env.CCACHE_DIR}}
  78. key: ${{ runner.os }}-r-${{ matrix.config.r }}-ccache-${{steps.datew.outputs.datew}}
  79. restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-ccache-${{steps.datew.outputs.datew}}
  80. # install ccache and write config file
  81. - name: "[Linux] ccache"
  82. if: runner.os == 'Linux'
  83. run: |
  84. sudo apt install ccache libcurl4-openssl-dev
  85. mkdir -p ~/.R && echo -e 'CC=ccache gcc -std=gnu99\nCXX=ccache g++\nFC=ccache gfortran\nF77=ccache gfortran' > $HOME/.R/Makevars
  86. # install ccache and write config file
  87. # mirror the setup described in https://github.com/rmacoslib/r-macos-rtools
  88. - name: "[macOS] ccache"
  89. if: runner.os == 'macOS' && matrix.config.r != 'devel'
  90. run: |
  91. brew install ccache
  92. wget https://cran.r-project.org/bin/macosx/tools/clang-7.0.0.pkg
  93. sudo installer -package clang-7.0.0.pkg -target /
  94. mkdir -p ~/.R && echo -e 'CC=ccache /usr/local/clang7/bin/clang\nCXX=ccache /usr/local/clang7/bin/clang++\nCXX11=ccache /usr/local/clang7/bin/clang++\nCXX14=ccache /usr/local/clang7/bin/clang++\nCXX17=ccache /usr/local/clang7/bin/clang++\nF77=ccache gfortran/nCFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk\nCXXFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk\nCCFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk\nCPPFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' > $HOME/.R/Makevars
  95. # install ccache and write config file
  96. # mirror the setup described in https://github.com/rmacoslib/r-macos-rtools
  97. - name: "[macOS-devel] ccache"
  98. if: runner.os == 'macOS' && matrix.config.r == 'devel'
  99. run: |
  100. brew install ccache
  101. # install SDK 10.13 (High Sierra, used by CRAN)
  102. wget -nv https://github.com/phracker/MacOSX-SDKs/releases/download/10.15/MacOSX10.13.sdk.tar.xz
  103. tar fxz MacOSX10.13.sdk.tar.xz
  104. sudo mv MacOSX10.13.sdk /Library/Developer/CommandLineTools/SDKs/
  105. rm -rf MacOSX10.13*
  106. # install gfortran 8.2 (used by CRAN)
  107. wget -nv https://github.com/fxcoudert/gfortran-for-macOS/releases/download/8.2/gfortran-8.2-Mojave.dmg
  108. sudo hdiutil attach gfortran*.dmg
  109. sudo installer -package /Volumes/gfortran*/gfortran*/gfortran*.pkg -target /
  110. sudo hdiutil detach /Volumes/gfortran-8.2-Mojave
  111. rm gfortran-8*
  112. # set compiler flags
  113. mkdir -p ~/.R && echo -e 'CC=ccache clang\nCPP=ccache clang\nCXX=ccache clang++\nCXX11=ccache clang++\nCXX14=ccache clang++\nCXX17=ccache clang++\nCFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.13.sdk\nCCFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.13.sdk\nCXXFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.13.sdk\nCPPFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.13.sdk\nF77=ccache /usr/local/gfortran/bin/gfortran\nFC=ccache /usr/local/gfortran/bin/gfortran' > $HOME/.R/Makevars
  114. # install xquartz for {sysfonts}
  115. - name: "[macOS] xquartz"
  116. if: runner.os == 'macOS'
  117. run: |
  118. brew cask install xquartz
  119. # for some strange Windows reason this step and the next one need to be decoupled
  120. - name: "[Stage] Prepare"
  121. run: |
  122. Rscript -e "if (!requireNamespace('remotes')) install.packages('remotes', type = 'source')"
  123. Rscript -e "if (getRversion() < '3.2' && !requireNamespace('curl')) install.packages('curl', type = 'source')"
  124. - name: "[Stage] Install"
  125. if: matrix.config.os != 'macOS-latest' || matrix.config.r != 'devel'
  126. run: Rscript -e "remotes::install_github('ropensci/tic')" -e "print(tic::dsl_load())" -e "tic::prepare_all_stages()" -e "tic::before_install()" -e "tic::install()"
  127. # macOS devel needs its own stage because we need to work with an options to suppress the usage of binaries
  128. - name: "[Stage] Prepare & Install (macOS-devel)"
  129. if: matrix.config.os == 'macOS-latest' && matrix.config.r == 'devel'
  130. run: |
  131. echo -e 'options(Ncpus = 4, pkgType = "source", repos = structure(c(CRAN = "https://cloud.r-project.org/")))' > $HOME/.Rprofile
  132. Rscript -e "remotes::install_github('ropensci/tic')" -e "print(tic::dsl_load())" -e "tic::prepare_all_stages()" -e "tic::before_install()" -e "tic::install()"
  133. - name: "[Stage] Script"
  134. run: Rscript -e 'tic::script()'
  135. - name: "[Stage] After Success"
  136. if: matrix.config.os == 'macOS-latest' && matrix.config.r == 'release'
  137. run: Rscript -e "tic::after_success()"
  138. - name: "[Stage] Upload R CMD check artifacts"
  139. if: failure()
  140. uses: actions/upload-artifact@master
  141. with:
  142. name: ${{ runner.os }}-r${{ matrix.config.r }}-results
  143. path: check
  144. - name: "[Stage] Before Deploy"
  145. run: |
  146. Rscript -e "tic::before_deploy()"
  147. - name: "[Stage] Deploy"
  148. run: Rscript -e "tic::deploy()"
  149. - name: "[Stage] After Deploy"
  150. run: Rscript -e "tic::after_deploy()"