Skip to content

Commit

Permalink
Merge pull request #49 from krlmlr/use-gha
Browse files Browse the repository at this point in the history
- Use GitHub Actions (#49).
  • Loading branch information
krlmlr committed Aug 14, 2020
2 parents 6164d68 + 5980fad commit 85714cd
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 98 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Expand Up @@ -7,3 +7,5 @@
^tic\.R$
^_pkgdown\.yml$
^docs$
^\.ccache$
^\.github$
123 changes: 123 additions & 0 deletions .github/workflows/tic.yml
@@ -0,0 +1,123 @@
## tic GitHub Actions template: linux-macos-windows-deploy
## revision date: 2020-08-06
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
# 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: windows-latest, r: "release" }
- { os: macOS-latest, r: "release", pkgdown: "true", latex: "true" }
- { os: ubuntu-latest, r: "devel" }
- { os: ubuntu-latest, r: "release" }

env:
# 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@v2.3.1

- uses: r-lib/actions/setup-r@master
with:
r-version: ${{ matrix.config.r }}
Ncpus: 4

# LaTeX. Installation time:
# Linux: ~ 1 min
# macOS: ~ 1 min 30s
# Windows: never finishes
- uses: r-lib/actions/setup-tinytex@master
if: matrix.config.latex == 'true'

- uses: r-lib/actions/setup-pandoc@master

# 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.1.0
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}}

# 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 (getRversion() < '3.2' && !requireNamespace('curl')) install.packages('curl', type = 'source')"
- name: "[Stage] [Linux] Install curl"
if: runner.os == 'Linux'
run: sudo apt install libcurl4-openssl-dev

- 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.1.1
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()"
67 changes: 0 additions & 67 deletions .travis.yml

This file was deleted.

7 changes: 4 additions & 3 deletions DESCRIPTION
Expand Up @@ -7,8 +7,8 @@ Authors@R:
family = "M\u00fcller",
role = c("aut", "cre"),
email = "krlmlr+r@mailbox.org")
Description: Streamlines the process of versioning R
packages and updating NEWS. Numbers are cheap, why not use them?
Description: Streamlines the process of versioning R packages
and updating NEWS. Numbers are cheap, why not use them?
License: GPL-3
URL: http://krlmlr.github.io/fledge,
https://github.com/krlmlr/fledge
Expand All @@ -20,6 +20,7 @@ Imports:
purrr (>= 0.3.2),
rematch2,
rlang,
tibble,
usethis (>= 1.5.0),
withr
Suggests:
Expand All @@ -34,4 +35,4 @@ VignetteBuilder:
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.0
RoxygenNote: 7.1.1
1 change: 1 addition & 0 deletions NAMESPACE
Expand Up @@ -17,3 +17,4 @@ importFrom(purrr,map)
importFrom(purrr,map_chr)
importFrom(purrr,map_int)
importFrom(purrr,some)
importFrom(tibble,add_column)
1 change: 1 addition & 0 deletions R/import.R
@@ -1,3 +1,4 @@
#' @import rlang
#' @importFrom purrr map map_chr map_int discard keep some
#' @importFrom tibble add_column
NULL
28 changes: 0 additions & 28 deletions appveyor.yml

This file was deleted.

0 comments on commit 85714cd

Please sign in to comment.