| ## tic GitHub Actions template: linux-macos-windows-deploy | ## tic GitHub Actions template: linux-macos-windows-deploy | ||||
| ## revision date: 2020-12-11 | |||||
| ## revision date: 2021-06-27 | |||||
| on: | on: | ||||
| workflow_dispatch: | workflow_dispatch: | ||||
| push: | push: | ||||
| jobs: | jobs: | ||||
| all: | all: | ||||
| runs-on: ${{ matrix.config.os }} | runs-on: ${{ matrix.config.os }} | ||||
| timeout-minutes: 30 | |||||
| name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | ||||
| config: | config: | ||||
| # use a different tic template type if you do not want to build on all listed platforms | # use a different tic template type if you do not want to build on all listed platforms | ||||
| - { os: windows-latest, r: "release" } | - { os: windows-latest, r: "release" } | ||||
| - { os: macOS-latest, r: "release", pkgdown: "true", latex: "true" } | |||||
| - { os: macOS-latest, r: "release" } | |||||
| - { os: ubuntu-latest, r: "devel" } | - { os: ubuntu-latest, r: "devel" } | ||||
| - { os: ubuntu-latest, r: "release" } | |||||
| - { os: ubuntu-latest, r: "release", pkgdown: "true", latex: "true" } | |||||
| env: | env: | ||||
| # otherwise remotes::fun() errors cause the build to fail. Example: Unavailability of binaries | # otherwise remotes::fun() errors cause the build to fail. Example: Unavailability of binaries | ||||
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||||
| steps: | steps: | ||||
| - uses: actions/checkout@v2.3.4 | |||||
| - uses: actions/checkout@v2 | |||||
| - uses: r-lib/actions/setup-r@master | - uses: r-lib/actions/setup-r@master | ||||
| with: | with: | ||||
| - name: "[Cache] Cache R packages" | - name: "[Cache] Cache R packages" | ||||
| if: runner.os != 'Windows' | if: runner.os != 'Windows' | ||||
| uses: pat-s/always-upload-cache@v2.1.3 | |||||
| uses: pat-s/always-upload-cache@v2 | |||||
| with: | with: | ||||
| path: ${{ env.R_LIBS_USER }} | path: ${{ env.R_LIBS_USER }} | ||||
| key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}} | key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}} | ||||
| restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}} | restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}} | ||||
| - name: "[Stage] [Linux] Install required system libs" | |||||
| if: runner.os == 'Linux' | |||||
| run: sudo apt install libcurl4-openssl-dev libgit2-dev | |||||
| # for some strange Windows reason this step and the next one need to be decoupled | # for some strange Windows reason this step and the next one need to be decoupled | ||||
| - name: "[Stage] Prepare" | - name: "[Stage] Prepare" | ||||
| run: | | run: | | ||||
| Rscript -e "if (!requireNamespace('remotes')) install.packages('remotes', type = 'source')" | Rscript -e "if (!requireNamespace('remotes')) install.packages('remotes', type = 'source')" | ||||
| Rscript -e "if (getRversion() < '3.2' && !requireNamespace('curl')) install.packages('curl', type = 'source')" | Rscript -e "if (getRversion() < '3.2' && !requireNamespace('curl')) install.packages('curl', type = 'source')" | ||||
| - name: "[Stage] [Linux] Install curl and libgit2" | |||||
| if: runner.os == 'Linux' | |||||
| run: sudo apt install libcurl4-openssl-dev libgit2-dev | |||||
| # install xquartz for {sysfonts} | |||||
| - name: "[macOS] xquartz" | |||||
| if: runner.os == 'macOS' | |||||
| run: | | |||||
| brew install --cask xquartz | |||||
| - name: "[Stage] [macOS] Install libgit2" | - name: "[Stage] [macOS] Install libgit2" | ||||
| if: runner.os == 'macOS' | if: runner.os == 'macOS' | ||||
| run: brew install libgit2 | run: brew install libgit2 | ||||
| if: runner.os == 'Linux' && matrix.config.pkgdown != '' | if: runner.os == 'Linux' && matrix.config.pkgdown != '' | ||||
| run: sudo apt install libharfbuzz-dev libfribidi-dev | run: sudo apt install libharfbuzz-dev libfribidi-dev | ||||
| # Try to automatically check for system dependencies and install them | |||||
| # Note: this might not catch all required system libs and manual action might be needed | |||||
| - name: "[Stage] [Linux] Install linux system dependencies" | |||||
| if: runner.os == 'Linux' | |||||
| run: | | |||||
| while read -r cmd | |||||
| do | |||||
| eval sudo $cmd | |||||
| done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') | |||||
| - name: "[Stage] Install" | - name: "[Stage] Install" | ||||
| if: matrix.config.os != 'macOS-latest' || matrix.config.r != 'devel' | if: matrix.config.os != 'macOS-latest' || matrix.config.r != 'devel' | ||||
| 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()" | 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()" | ||||
| - name: "[Stage] Upload R CMD check artifacts" | - name: "[Stage] Upload R CMD check artifacts" | ||||
| if: failure() | if: failure() | ||||
| uses: actions/upload-artifact@v2.2.1 | |||||
| uses: actions/upload-artifact@v2 | |||||
| with: | with: | ||||
| name: ${{ runner.os }}-r${{ matrix.config.r }}-results | name: ${{ runner.os }}-r${{ matrix.config.r }}-results | ||||
| path: check | path: check | ||||
| - name: "[Stage] After Deploy" | - name: "[Stage] After Deploy" | ||||
| run: Rscript -e "tic::after_deploy()" | run: Rscript -e "tic::after_deploy()" | ||||
| - name: "[Status] Update dashboard at gadenbuie/status" | |||||
| uses: peter-evans/repository-dispatch@v1 | |||||
| if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') && matrix.config.os == 'macOS-latest' && matrix.config.r == 'release' | |||||
| with: | |||||
| token: ${{ secrets.TIC_UPDATE }} | |||||
| event-type: status-update | |||||
| repository: gadenbuie/status |