From 1d32d42bca23d59a028b369176faedbb2d249d06 Mon Sep 17 00:00:00 2001 From: pat-s Date: Mon, 29 Aug 2022 09:34:20 +0200 Subject: [PATCH] manual update GHA WF --- .github/workflows/main.yml | 157 ------------------------------------- .github/workflows/tic.yml | 100 +++++++++++++++++++++++ 2 files changed, 100 insertions(+), 157 deletions(-) delete mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/tic.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index edcb5a93..00000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,157 +0,0 @@ -## tic GitHub Actions template: custom-deploy -## revision date: 2022-03-01 -# [Custom header] -on: - workflow_dispatch: - push: - branches: - - main - - master - pull_request: - branches: - - main - - master - # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master) - schedule: - # * is a special character in YAML so you have to quote this string - - cron: "0 4 * * *" - -name: tic - -jobs: - all: - runs-on: ${{ matrix.config.os }} - - name: ${{ matrix.config.os }} (${{ matrix.config.r }}) - - strategy: - fail-fast: false - matrix: - config: - ### Custom configs (specify your own runners here) - # [Custom matrix env var] - # - { os: windows-latest, r: "release" } - # [Custom matrix env var] - # - { os: macOS-latest, r: "release", pkgdown: "true", latex: "true" } - # [Custom matrix env var] - - { os: ubuntu-latest, r: "release", pkgdown: "true", latex: "true" } - # [Custom matrix env var] - # - { os: ubuntu-latest, r: "devel" } - - env: - # [Custom env var] fake virtual display for rgl package - DISPLAY: ":99" - # otherwise remotes::fun() errors cause the build to fail. Example: Unavailability of binaries - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - CRAN: ${{ matrix.config.cran }} - # make sure to run `tic::use_ghactions_deploy()` to set up deployment - TIC_DEPLOY_KEY: ${{ secrets.TIC_DEPLOY_KEY }} - # prevent rgl issues because no X11 display is available - RGL_USE_NULL: true - # if you use bookdown or blogdown, replace "PKGDOWN" by the respective - # capitalized term. This also might need to be done in tic.R - BUILD_PKGDOWN: ${{ matrix.config.pkgdown }} - # macOS >= 10.15.4 linking - SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk - # use GITHUB_TOKEN from GitHub to workaround rate limits in {remotes} - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - - steps: - - uses: actions/checkout@v3 - - - uses: r-lib/actions/setup-r@v2 - with: - r-version: ${{ matrix.config.r }} - Ncpus: 4 - - - uses: r-lib/actions/setup-tinytex@v2 - if: matrix.config.latex == 'true' - - - uses: r-lib/actions/setup-pandoc@v2 - - # set date/week for use in cache creation - # https://github.community/t5/GitHub-Actions/How-to-set-and-access-a-Workflow-variable/m-p/42970 - # - cache R packages daily - - name: "[Cache] Prepare daily timestamp for cache" - if: runner.os != 'Windows' - id: date - run: echo "::set-output name=date::$(date '+%d-%m')" - - - name: "[Cache] Cache R packages" - if: runner.os != 'Windows' - uses: pat-s/always-upload-cache@v2 - with: - path: ${{ env.R_LIBS_USER }} - key: ${{ 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 - - name: "[Stage] Prepare" - run: | - Rscript -e "if (!requireNamespace('remotes')) install.packages('remotes', type = 'source')" - Rscript -e "if (!requireNamespace('curl')) install.packages('curl', type = 'source')" - - - name: "[Custom block] [macOS] macOS system libs setup" - if: runner.os == 'macOS' - run: | - brew install --cask xquartz - - - name: "[Stage] [macOS] Install libgit2" - if: runner.os == 'macOS' - run: brew install libgit2 - - - name: "[Stage] [macOS] Install system libs for pkgdown" - if: runner.os == 'macOS' && matrix.config.pkgdown != '' - run: brew install harfbuzz fribidi - - - name: "[Stage] [Linux] Install system libs for pkgdown" - if: runner.os == 'Linux' && matrix.config.pkgdown != '' - 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" - 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()" - - # macOS devel needs its own stage because we need to work with an option to suppress the usage of binaries - - name: "[Stage] Prepare & Install (macOS-devel)" - if: matrix.config.os == 'macOS-latest' && matrix.config.r == 'devel' - run: | - echo -e 'options(Ncpus = 4, pkgType = "source", repos = structure(c(CRAN = "https://cloud.r-project.org/")))' > $HOME/.Rprofile - 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] Script" - run: Rscript -e 'tic::script()' - - - name: "[Stage] After Success" - if: matrix.config.os == 'macOS-latest' && matrix.config.r == 'release' - run: Rscript -e "tic::after_success()" - - - name: "[Stage] Upload R CMD check artifacts" - if: failure() - uses: actions/upload-artifact@v2 - with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check - - name: "[Stage] Before Deploy" - run: | - Rscript -e "tic::before_deploy()" - - - name: "[Stage] Deploy" - run: Rscript -e "tic::deploy()" - - - name: "[Stage] After Deploy" - run: Rscript -e "tic::after_deploy()" diff --git a/.github/workflows/tic.yml b/.github/workflows/tic.yml new file mode 100644 index 00000000..fafcb990 --- /dev/null +++ b/.github/workflows/tic.yml @@ -0,0 +1,100 @@ +## tic GitHub Actions template: linux-deploy +## revision date: 2022-08-28 +on: + workflow_dispatch: + push: + branches: + - main + - master + - cran-* + pull_request: + branches: + - main + - master + # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master) + schedule: + # * is a special character in YAML so you have to quote this string + - cron: "0 4 * * *" + +name: tic + +jobs: + all: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + # use a different tic template type if you do not want to build on all listed platforms + - { os: ubuntu-latest, r: "release", pkgdown: "true" } + + env: + # make sure to run `tic::use_ghactions_deploy()` to set up deployment + TIC_DEPLOY_KEY: ${{ secrets.TIC_DEPLOY_KEY }} + # prevent rgl issues because no X11 display is available + RGL_USE_NULL: true + # if you use bookdown or blogdown, replace "PKGDOWN" by the respective + # capitalized term. This also might need to be done in tic.R + BUILD_PKGDOWN: ${{ matrix.config.pkgdown }} + # use GITHUB_TOKEN from GitHub to workaround rate limits in {remotes} + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v3 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + Ncpus: 4 + + - uses: r-lib/actions/setup-tinytex@v2 + if: matrix.config.latex == 'true' + + - uses: r-lib/actions/setup-pandoc@v2 + + # set date/week for use in cache creation + # https://github.community/t5/GitHub-Actions/How-to-set-and-access-a-Workflow-variable/m-p/42970 + # - cache R packages daily + - name: "[Cache] Prepare daily timestamp for cache" + if: runner.os != 'Windows' + id: date + run: echo "::set-output name=date::$(date '+%d-%m')" + + - name: "[Cache] Cache R packages" + if: runner.os != 'Windows' + uses: pat-s/always-upload-cache@v3 + with: + path: ${{ env.R_LIBS_USER }} + key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}} + restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}} + + - name: "[Stage] Install pak" + run: Rscript -e "install.packages('pak', repos = 'https://r-lib.github.io/p/pak/stable')" + + - name: "[Stage] Install" + run: Rscript -e "if (grepl('Ubuntu', Sys.info()[['version']])) {options(repos = c(CRAN = sprintf('https://packagemanager.rstudio.com/all/__linux__/%s/latest', system('lsb_release -cs', intern = TRUE))))}; pak::pkg_install('ropensci/tic')" -e "print(tic::dsl_load())" -e "tic::prepare_all_stages()" -e "tic::before_install()" -e "tic::install()" + + - name: "[Stage] Script" + run: Rscript -e 'tic::script()' + + - name: "[Stage] After Success" + run: Rscript -e "tic::after_success()" + + - name: "[Stage] Upload R CMD check artifacts" + if: failure() + uses: actions/upload-artifact@v2 + with: + name: ${{ runner.os }}-r${{ matrix.config.r }}-results + path: check + - name: "[Stage] Before Deploy" + run: | + Rscript -e "tic::before_deploy()" + + - name: "[Stage] Deploy" + run: Rscript -e "tic::deploy()" + + - name: "[Stage] After Deploy" + run: Rscript -e "tic::after_deploy()"