mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-10 07:28:01 -05:00
173 lines
6.2 KiB
YAML
173 lines
6.2 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- ghactions
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
name: Rituals
|
|
|
|
jobs:
|
|
rituals:
|
|
name: Rituals
|
|
# if: false
|
|
runs-on: ${{ matrix.config.os }}
|
|
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
config:
|
|
- { os: ubuntu-16.04, r: '4.0', node: "14.x", rspm: "https://packagemanager.rstudio.com/all/__linux__/xenial/latest"}
|
|
|
|
env:
|
|
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
|
|
RSPM: ${{ matrix.config.rspm }}
|
|
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
|
|
- uses: r-lib/actions/pr-fetch@master
|
|
name: Git Pull (PR)
|
|
if: github.event_name == 'pull_request'
|
|
with:
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- uses: r-lib/actions/setup-r@master
|
|
id: install-r
|
|
with:
|
|
r-version: ${{ matrix.config.r }}
|
|
|
|
- uses: r-lib/actions/setup-pandoc@master
|
|
|
|
- name: Git Config
|
|
run: |
|
|
git config user.name "${GITHUB_ACTOR}"
|
|
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
|
|
|
- name: Install pak and query dependencies
|
|
shell: Rscript {0}
|
|
run: |
|
|
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
|
|
saveRDS(pak::pkg_deps_tree("local::.", dependencies = TRUE), ".github/r-depends.rds")
|
|
|
|
- name: Cache R packages
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ env.R_LIBS_USER }}
|
|
key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
|
|
restore-keys: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-
|
|
|
|
- name: Install system dependencies
|
|
# if: runner.os == 'Linux'
|
|
shell: Rscript {0}
|
|
run: |
|
|
pak::local_system_requirements(execute = TRUE)
|
|
|
|
- name: Install dependencies
|
|
shell: Rscript {0}
|
|
run: |
|
|
pak::local_install_dev_deps(upgrade = TRUE)
|
|
|
|
- name: Session info
|
|
shell: Rscript {0}
|
|
run: |
|
|
options(width = 100)
|
|
pak::pkg_install("sessioninfo")
|
|
pkgs <- installed.packages()[, "Package"]
|
|
sessioninfo::session_info(pkgs, include_base = TRUE)
|
|
|
|
- name: Url redirects
|
|
# only perform if in an RC branch (`rc-vX.Y.Z`)
|
|
if: ${{ github.event_name == 'push' && contains(github.ref, '/rc-v') }}
|
|
run: |
|
|
Rscript -e 'pak::pkg_install("r-lib/urlchecker"); urlchecker::url_update()'
|
|
# throw an error if man files were updated
|
|
if [ -n "$(git status --porcelain man)" ]
|
|
then
|
|
git status --porcelain
|
|
>&2 echo "Updated links found in files above"
|
|
>&2 echo 'Run `urlchecker::url_update()` to fix links locally'
|
|
exit 1
|
|
fi
|
|
# Add locally changed urls
|
|
git add .
|
|
git commit -m 'Update links (GitHub Actions)' || echo "No link changes to commit"
|
|
|
|
- name: Document
|
|
run: |
|
|
Rscript -e 'pak::pkg_install("devtools")'
|
|
Rscript -e 'devtools::document()'
|
|
git add man/\* NAMESPACE
|
|
git commit -m 'Document (GitHub Actions)' || echo "No documentation changes to commit"
|
|
|
|
- name: Check documentation
|
|
run: |
|
|
./tools/documentation/checkDocsCurrent.sh
|
|
|
|
- uses: actions/setup-node@v1
|
|
with:
|
|
node-version: ${{ matrix.config.node }}
|
|
# https://github.com/actions/cache/blame/ccf96194800dbb7b7094edcd5a7cf3ec3c270f10/examples.md#L185-L200
|
|
- name: Get yarn cache directory path
|
|
id: yarn-cache-dir-path
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
- name: yarn cache
|
|
uses: actions/cache@v2
|
|
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
|
with:
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
key: ${{ matrix.config.os }}-${{ matrix.config.node }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ matrix.config.os }}-${{ matrix.config.node }}-yarn-
|
|
|
|
- name: Sync DESCRIPTION and package.json versions
|
|
run: |
|
|
Rscript -e 'pak::pkg_install("jsonlite")'
|
|
Rscript -e 'pkg <- jsonlite::read_json("package.json", simplifyVector = TRUE)' \
|
|
-e 'version <- as.list(read.dcf("DESCRIPTION")[1,])$Version' \
|
|
-e 'pkg$version <- gsub("^(\\d+).(\\d+).(\\d+).(.+)$", "\\1.\\2.\\3-alpha.\\4", version)' \
|
|
-e 'pkg$files <- as.list(pkg$files)' \
|
|
-e 'jsonlite::write_json(pkg, path = "package.json", pretty = TRUE, auto_unbox = TRUE)'
|
|
git add package.json && git commit -m 'sync package version (GitHub Actions)' || echo "No version changes to commit"
|
|
- name: Build JS
|
|
run: |
|
|
tree srcts
|
|
rm -r srcts/types
|
|
yarn install --immutable && yarn build
|
|
git add ./srcts/src && git commit -m 'yarn lint (GitHub Actions)' || echo "No yarn lint changes to commit"
|
|
git add ./srcts/types && git commit -m 'yarn tsc (GitHub Actions)' || echo "No type definition changes to commit"
|
|
git add ./inst && git commit -m 'yarn build (GitHub Actions)' || echo "No yarn build changes to commit"
|
|
if [ -n "$(git status --porcelain)" ]
|
|
then
|
|
git status --porcelain
|
|
>&2 echo "The above files changed when we built the JavaScript assets."
|
|
exit 1
|
|
else
|
|
echo "No difference detected; TypeScript build is current."
|
|
fi
|
|
|
|
- name: Git Push (PR)
|
|
uses: r-lib/actions/pr-push@master
|
|
if: github.event_name == 'pull_request'
|
|
with:
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Verify no un-pushed commits (MASTER)
|
|
if: github.event_name == 'push'
|
|
run: |
|
|
# Can't push to a protected branch
|
|
if [ -n "`git cherry origin/master`" ]; then
|
|
echo "Un-pushed commits:"
|
|
git cherry -v origin/master
|
|
echo "\nCan not push to a protected branch. Exiting"
|
|
exit 1
|
|
fi
|
|
|
|
# Execute after pushing, as no updated files will be produced
|
|
- name: Test TypeScript code
|
|
run: |
|
|
yarn test
|