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

148 lines
5.8KB

  1. ## tic GitHub Actions template: linux-macos-windows-deploy
  2. ## revision date: 2020-12-11
  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. name: ${{ matrix.config.os }} (${{ matrix.config.r }})
  16. strategy:
  17. fail-fast: false
  18. matrix:
  19. config:
  20. # use a different tic template type if you do not want to build on all listed platforms
  21. - { os: windows-latest, r: "release" }
  22. - { os: macOS-latest, r: "release", pkgdown: "true", latex: "true" }
  23. - { os: ubuntu-latest, r: "devel" }
  24. - { os: ubuntu-latest, r: "release" }
  25. env:
  26. # otherwise remotes::fun() errors cause the build to fail. Example: Unavailability of binaries
  27. R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
  28. CRAN: ${{ matrix.config.cran }}
  29. # make sure to run `tic::use_ghactions_deploy()` to set up deployment
  30. TIC_DEPLOY_KEY: ${{ secrets.TIC_DEPLOY_KEY }}
  31. # prevent rgl issues because no X11 display is available
  32. RGL_USE_NULL: true
  33. # if you use bookdown or blogdown, replace "PKGDOWN" by the respective
  34. # capitalized term. This also might need to be done in tic.R
  35. BUILD_PKGDOWN: ${{ matrix.config.pkgdown }}
  36. # macOS >= 10.15.4 linking
  37. SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
  38. # use GITHUB_TOKEN from GitHub to workaround rate limits in {remotes}
  39. GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
  40. steps:
  41. - uses: actions/checkout@v2.3.4
  42. - uses: r-lib/actions/setup-r@master
  43. with:
  44. r-version: ${{ matrix.config.r }}
  45. Ncpus: 4
  46. # LaTeX. Installation time:
  47. # Linux: ~ 1 min
  48. # macOS: ~ 1 min 30s
  49. # Windows: never finishes
  50. - uses: r-lib/actions/setup-tinytex@master
  51. if: matrix.config.latex == 'true'
  52. - uses: r-lib/actions/setup-pandoc@master
  53. # set date/week for use in cache creation
  54. # https://github.community/t5/GitHub-Actions/How-to-set-and-access-a-Workflow-variable/m-p/42970
  55. # - cache R packages daily
  56. - name: "[Cache] Prepare daily timestamp for cache"
  57. if: runner.os != 'Windows'
  58. id: date
  59. run: echo "::set-output name=date::$(date '+%d-%m')"
  60. - name: "[Cache] Cache R packages"
  61. if: runner.os != 'Windows'
  62. uses: pat-s/always-upload-cache@v2.1.3
  63. with:
  64. path: ${{ env.R_LIBS_USER }}
  65. key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}}
  66. restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}}
  67. # for some strange Windows reason this step and the next one need to be decoupled
  68. - name: "[Stage] Prepare"
  69. run: |
  70. Rscript -e "if (!requireNamespace('remotes')) install.packages('remotes', type = 'source')"
  71. Rscript -e "if (getRversion() < '3.2' && !requireNamespace('curl')) install.packages('curl', type = 'source')"
  72. - name: "[Stage] [Linux] Install curl and libgit2"
  73. if: runner.os == 'Linux'
  74. run: sudo apt install libcurl4-openssl-dev libgit2-dev
  75. # install xquartz for {sysfonts}
  76. - name: "[macOS] xquartz"
  77. if: runner.os == 'macOS'
  78. run: |
  79. brew install --cask xquartz
  80. - name: "[Stage] [macOS] Install libgit2"
  81. if: runner.os == 'macOS'
  82. run: brew install libgit2
  83. - name: "[Stage] [macOS] Install system libs for pkgdown"
  84. if: runner.os == 'macOS' && matrix.config.pkgdown != ''
  85. run: brew install harfbuzz fribidi
  86. - name: "[Stage] [Linux] Install system libs for pkgdown"
  87. if: runner.os == 'Linux' && matrix.config.pkgdown != ''
  88. run: sudo apt install libharfbuzz-dev libfribidi-dev
  89. - name: "[Stage] Install"
  90. if: matrix.config.os != 'macOS-latest' || matrix.config.r != 'devel'
  91. 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()"
  92. # macOS devel needs its own stage because we need to work with an option to suppress the usage of binaries
  93. - name: "[Stage] Prepare & Install (macOS-devel)"
  94. if: matrix.config.os == 'macOS-latest' && matrix.config.r == 'devel'
  95. run: |
  96. echo -e 'options(Ncpus = 4, pkgType = "source", repos = structure(c(CRAN = "https://cloud.r-project.org/")))' > $HOME/.Rprofile
  97. Rscript -e "remotes::install_github('ropensci/tic')" -e "print(tic::dsl_load())" -e "tic::prepare_all_stages()" -e "tic::before_install()" -e "tic::install()"
  98. - name: "[Stage] Script"
  99. run: Rscript -e 'tic::script()'
  100. - name: "[Stage] After Success"
  101. if: matrix.config.os == 'macOS-latest' && matrix.config.r == 'release'
  102. run: Rscript -e "tic::after_success()"
  103. - name: "[Stage] Upload R CMD check artifacts"
  104. if: failure()
  105. uses: actions/upload-artifact@v2.2.1
  106. with:
  107. name: ${{ runner.os }}-r${{ matrix.config.r }}-results
  108. path: check
  109. - name: "[Stage] Before Deploy"
  110. run: |
  111. Rscript -e "tic::before_deploy()"
  112. - name: "[Stage] Deploy"
  113. run: Rscript -e "tic::deploy()"
  114. - name: "[Stage] After Deploy"
  115. run: Rscript -e "tic::after_deploy()"
  116. - name: "[Status] Update dashboard at gadenbuie/status"
  117. uses: peter-evans/repository-dispatch@v1
  118. if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') && matrix.config.os == 'macOS-latest' && matrix.config.r == 'release'
  119. with:
  120. token: ${{ secrets.TIC_UPDATE }}
  121. event-type: status-update
  122. repository: gadenbuie/status