Преглед на файлове

switch from tic to my actions

tags/v0.4.1
Garrick Aden-Buie преди 4 години
родител
ревизия
9809a790c9
No known key found for this signature in database
променени са 6 файла, в които са добавени 303 реда и са изтрити 152 реда
  1. +78
    -0
      .github/workflows/R-CMD-check.yaml
  2. +167
    -0
      .github/workflows/pkg-maintenance.yaml
  3. +57
    -0
      .github/workflows/pkgdown.yaml
  4. +0
    -144
      .github/workflows/tic.yml
  5. +1
    -0
      DESCRIPTION
  6. +0
    -8
      tic.R

+ 78
- 0
.github/workflows/R-CMD-check.yaml Целия файл

# NOTE: This workflow is overkill for most R packages
# check-standard.yaml is likely a better choice
# usethis::use_github_action("check-standard") will install it.
#
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
on:
push:
branches:
- main
pull_request:
branches:
- main

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: windows-latest, r: '3.6'}
- {os: ubuntu-18.04, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-18.04, r: 'release'}
- {os: ubuntu-18.04, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v1
id: install-r
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

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

- name: Install devel system dependencies
if: matrix.config.os == 'ubuntu-18.04' && matrix.config.r == 'devel'
run: sudo apt-get install -y libcurl4-openssl-dev

- uses: r-lib/actions/setup-r-dependencies@v1
with:
cache-version: 1
extra-packages: rcmdcheck

- uses: r-lib/actions/check-r-package@v1

- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Code coverage
if: matrix.config.os == 'macOS-latest' && matrix.config.r == 'release'
shell: Rscript {0}
run: |
pak::pkg_install("covr")
covr::codecov()

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results
path: check

+ 167
- 0
.github/workflows/pkg-maintenance.yaml Целия файл

# Workflow inspired by:
# - https://github.com/rstudio/shinycoreci/blob/master/.github/workflows/call-rituals.yaml
# - https://github.com/r-lib/actions/blob/master/examples/lint.yaml
# - https://github.com/r-lib/actions/blob/master/examples/render-rmarkdown.yaml

on:
pull_request:
push:
branches: main

name: Package Maintenance

jobs:
pkg-maintenance:
runs-on: ubuntu-latest

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
# only add lintr annotations
LINTR_COMMENT_BOT: false

steps:
- uses: actions/checkout@v2

# Make sure the PR branch is checked out for pull requests
- name: Git Pull (PR)
if: github.event_name == 'pull_request'
uses: r-lib/actions/pr-fetch@v1
with:
repo-token: ${{ github.token }}

- name: Git Config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"

- uses: r-lib/actions/setup-r@v1
with:
use-public-rspm: true

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

- uses: r-lib/actions/setup-r-dependencies@v1
with:
extra-packages: |
lintr
styler
devtools
rmarkdown

- name: Tidy Description
run: |
Rscript -e 'usethis::use_tidy_description()'
git add -u && git commit -m 'Tidy DESCRIPTION (GitHub Actions)' || echo "No DESCRIPTION changes to commit"

- name: Document
run: |
Rscript -e 'roxygen2::roxygenise()'
git add man/\* NAMESPACE && git commit -m 'Document (GitHub Actions)' || echo "No documentation changes to commit"

- name: Build README and index
run: |
if [ -f "index.Rmd" ]; then
Rscript -e 'rmarkdown::render("index.Rmd", quiet = FALSE, output_options = list(html_preview = FALSE))'
git add index.md && git commit -m 'Re-build index.Rmd (GitHub Actions)' || echo "No index.Rmd changes to commit"
else
echo "No index.Rmd to build"
fi
if [ -f "README.Rmd" ]; then
Rscript -e 'devtools::build_readme(quiet = FALSE)'
git add man/figures/README\* README.md && git commit -m 'Re-build README.Rmd (GitHub Actions)' || echo "No readme changes to commit"
else
echo "No README.Rmd to build"
fi

- name: URL redirects
if: github.event_name == 'push'
run: |
Rscript -e 'pak::pkg_install("r-lib/urlchecker"); urlchecker::url_update()'
git add -u && git commit -m 'Update links (GitHub Actions)' || echo "No link changes to commit"

- name: Whitespace - Fix indents and trailing
run: |
# tabs to spaces and remove trailing whitespace
transform_indent_two_spaces <- styler::create_style_guide(
style_guide_name = "Indent with two spaces",
style_guide_version = "1.0.0",
indention = local({
ts <- styler::tidyverse_style()$indention
ts$unindent_fun_dec <- NULL
ts$update_indention_ref_fun_dec <- NULL
ts
}),
reindention = styler::specify_reindention(indention = 2, comments_only = FALSE)
)

styler::style_pkg(transformers = transform_indent_two_spaces)
shell: Rscript {0}

- name: Whitespace - Commit
run: |
git add -u && git commit -m 'Fix whitespace (GitHub Actions)' || echo 'No whitespace changes to commit'

# When pushing to main causes package maintenance, create a pull request
- name: Create Pull Request
id: create-pull-request
if: github.event_name == 'push'
uses: peter-evans/create-pull-request@v3
with:
base: main
branch: auto-pkg-maintenance
commit-message: "Package maintenance (Github Actions)"
title: "Automated package maintenance"
body: >
Automated package maintenance changes from
<${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}>

- name: Notify Pull Request
if: steps.create-pull-request.outputs.pull-request-operation
run: |
echo "::notice title=Package Maintenance:: Pull request #${{ steps.create-pull-request.outputs.pull-request-number }} ${{ steps.create-pull-request.outputs.pull-request-operation }}: ${{ steps.create-pull-request.outputs.pull-request-url }}"

# If we're in a PR, then push back to the PR branch
- name: Git Push (PR)
uses: r-lib/actions/pr-push@v1
if: github.event_name == 'pull_request'
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Lint Package
if: github.event_name == 'pull_request'
run: |
# lint package and add notice-style file annotations
Sys.setlocale(locale = "C")
Sys.setenv(R_CLI_NUM_COLORS = 1)
lints <- lintr::lint_package(cache = FALSE)
informal_linters <- c(
"closed_curly_linter",
"commas_linter",
"function_left_parentheses_linter",
"line_length_linter",
"object_length_linter",
"object_name_linter",
"open_curly_linter",
"paren_brace_linter",
"pipe_continuation_linter",
"single_quotes_linter",
"spaces_inside_linter",
"spaces_left_parentheses_linter",
"trailing_blank_lines_linter",
"trailing_whitespace_linter"
)
for (lint in lints) {
msg <- sprintf(
"\n::%s file=%s,line=%d,col=%d,endColumn=%d,title=%s::%s",
if (lint$linter %in% informal_linters) "notice" else "warning",
lint$filename,
lint$line_number,
lint$ranges[[1]][[1]],
lint$ranges[[1]][[2]],
paste("lintr", lint$type, lint$linter, sep = " - "),
# print lintr message as GHA-compatible multiline log message
paste(capture.output(print(lint)), collapse = "%0A")
)
cat(msg)
}
shell: Rscript {0}

+ 57
- 0
.github/workflows/pkgdown.yaml Целия файл

on:
push:
branches:
- main
- rc-**
- docs/**
pull_request:
branches:
- main

name: pkgdown

jobs:
pkgdown:
runs-on: ubuntu-18.04
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v1
id: install-r
with:
use-public-rspm: true

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

- uses: r-lib/actions/setup-r-dependencies@v1
with:
needs: website

- name: Build Site
shell: Rscript {0}
run: |
pkgdown::build_site(new_process = FALSE)

- name: Set environment variable $GIT_BRANCH_NAME
id: git-branch-name
uses: EthanSK/git-branch-name-action@v1

- name: Deploy to Netlify
if: github.event_name == 'push'
id: netlify-deploy
uses: nwtgck/actions-netlify@v1.1
with:
publish-dir: 'reference'
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message:
'Deploy from GHA: ${{ github.event.head_commit.message }} (${{ github.sha }})'
enable-pull-request-comment: false
enable-commit-comment: false
enable-commit-status: true
alias: deploy-preview-${{ env.GIT_BRANCH_NAME }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

+ 0
- 144
.github/workflows/tic.yml Целия файл

## tic GitHub Actions template: linux-macos-windows-deploy
## revision date: 2021-06-27
on:
workflow_dispatch:
push:
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 }}
timeout-minutes: 30

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" }
- { os: ubuntu-latest, r: "devel" }
- { os: ubuntu-latest, r: "release", pkgdown: "true", latex: "true" }

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

- 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
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 (getRversion() < '3.2' && !requireNamespace('curl')) install.packages('curl', type = 'source')"

- 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()"

+ 1
- 0
DESCRIPTION Целия файл

VignetteBuilder: VignetteBuilder:
knitr knitr
Config/testthat/edition: 3 Config/testthat/edition: 3
Config/Needs/website: pkgdown
Encoding: UTF-8 Encoding: UTF-8
Roxygen: list(markdown = TRUE) Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.1 RoxygenNote: 7.1.1

+ 0
- 8
tic.R Целия файл

# installs dependencies, runs R CMD check, runs covr::codecov()
do_package_checks()

if (ci_on_ghactions() && ci_has_env("BUILD_PKGDOWN")) {
# creates pkgdown site and pushes to gh-pages branch
# only for the runner with the "BUILD_PKGDOWN" env var set
do_pkgdown()
}

Loading…
Отказ
Запис