😎 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.

145 lines
5.7KB

  1. ## tic GitHub Actions template: linux-macos-windows-deploy
  2. ## revision date: 2021-06-27
  3. on:
  4. workflow_dispatch:
  5. push:
  6. pull_request:
  7. # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master)
  8. schedule:
  9. # * is a special character in YAML so you have to quote this string
  10. - cron: "0 4 * * *"
  11. name: tic
  12. jobs:
  13. all:
  14. runs-on: ${{ matrix.config.os }}
  15. timeout-minutes: 30
  16. name: ${{ matrix.config.os }} (${{ matrix.config.r }})
  17. strategy:
  18. fail-fast: false
  19. matrix:
  20. config:
  21. # use a different tic template type if you do not want to build on all listed platforms
  22. - { os: windows-latest, r: "release" }
  23. - { os: macOS-latest, r: "release" }
  24. - { os: ubuntu-latest, r: "devel" }
  25. - { os: ubuntu-latest, r: "release", pkgdown: "true", latex: "true" }
  26. env:
  27. # otherwise remotes::fun() errors cause the build to fail. Example: Unavailability of binaries
  28. R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
  29. CRAN: ${{ matrix.config.cran }}
  30. # make sure to run `tic::use_ghactions_deploy()` to set up deployment
  31. TIC_DEPLOY_KEY: ${{ secrets.TIC_DEPLOY_KEY }}
  32. # prevent rgl issues because no X11 display is available
  33. RGL_USE_NULL: true
  34. # if you use bookdown or blogdown, replace "PKGDOWN" by the respective
  35. # capitalized term. This also might need to be done in tic.R
  36. BUILD_PKGDOWN: ${{ matrix.config.pkgdown }}
  37. # macOS >= 10.15.4 linking
  38. SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
  39. # use GITHUB_TOKEN from GitHub to workaround rate limits in {remotes}
  40. GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
  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@master
  52. if: matrix.config.latex == 'true'
  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. - name: "[Cache] Prepare daily timestamp for cache"
  58. if: runner.os != 'Windows'
  59. id: date
  60. run: echo "::set-output name=date::$(date '+%d-%m')"
  61. - name: "[Cache] Cache R packages"
  62. if: runner.os != 'Windows'
  63. uses: pat-s/always-upload-cache@v2
  64. with:
  65. path: ${{ env.R_LIBS_USER }}
  66. key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}}
  67. restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}}
  68. - name: "[Stage] [Linux] Install required system libs"
  69. if: runner.os == 'Linux'
  70. run: sudo apt install libcurl4-openssl-dev libgit2-dev
  71. # for some strange Windows reason this step and the next one need to be decoupled
  72. - name: "[Stage] Prepare"
  73. run: |
  74. Rscript -e "if (!requireNamespace('remotes')) install.packages('remotes', type = 'source')"
  75. Rscript -e "if (getRversion() < '3.2' && !requireNamespace('curl')) install.packages('curl', type = 'source')"
  76. - name: "[Stage] [macOS] Install libgit2"
  77. if: runner.os == 'macOS'
  78. run: brew install libgit2
  79. - name: "[Stage] [macOS] Install system libs for pkgdown"
  80. if: runner.os == 'macOS' && matrix.config.pkgdown != ''
  81. run: brew install harfbuzz fribidi
  82. - name: "[Stage] [Linux] Install system libs for pkgdown"
  83. if: runner.os == 'Linux' && matrix.config.pkgdown != ''
  84. run: sudo apt install libharfbuzz-dev libfribidi-dev
  85. # Try to automatically check for system dependencies and install them
  86. # Note: this might not catch all required system libs and manual action might be needed
  87. - name: "[Stage] [Linux] Install linux system dependencies"
  88. if: runner.os == 'Linux'
  89. run: |
  90. while read -r cmd
  91. do
  92. eval sudo $cmd
  93. done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
  94. - name: "[Stage] Install"
  95. if: matrix.config.os != 'macOS-latest' || matrix.config.r != 'devel'
  96. 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()"
  97. # macOS devel needs its own stage because we need to work with an option to suppress the usage of binaries
  98. - name: "[Stage] Prepare & Install (macOS-devel)"
  99. if: matrix.config.os == 'macOS-latest' && matrix.config.r == 'devel'
  100. run: |
  101. echo -e 'options(Ncpus = 4, pkgType = "source", repos = structure(c(CRAN = "https://cloud.r-project.org/")))' > $HOME/.Rprofile
  102. Rscript -e "remotes::install_github('ropensci/tic')" -e "print(tic::dsl_load())" -e "tic::prepare_all_stages()" -e "tic::before_install()" -e "tic::install()"
  103. - name: "[Stage] Script"
  104. run: Rscript -e 'tic::script()'
  105. - name: "[Stage] After Success"
  106. if: matrix.config.os == 'macOS-latest' && matrix.config.r == 'release'
  107. run: Rscript -e "tic::after_success()"
  108. - name: "[Stage] Upload R CMD check artifacts"
  109. if: failure()
  110. uses: actions/upload-artifact@v2
  111. with:
  112. name: ${{ runner.os }}-r${{ matrix.config.r }}-results
  113. path: check
  114. - name: "[Stage] Before Deploy"
  115. run: |
  116. Rscript -e "tic::before_deploy()"
  117. - name: "[Stage] Deploy"
  118. run: Rscript -e "tic::deploy()"
  119. - name: "[Stage] After Deploy"
  120. run: Rscript -e "tic::after_deploy()"