Merge pull request #1 from ecohealthalliance/mkrproj #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: make-targets | ||
# By default this action runs only manually | ||
on: | ||
workflow_dispatch: | ||
branches: | ||
- '*' | ||
# Alternately, for jobs such as updating dashboard, you can set a regular schedule | ||
#schedule: | ||
# - cron: "0 8 * * *" | ||
jobs: | ||
container-workflow-template: | ||
runs-on: ubuntu-latest # Run on GitHub Actions runner | ||
#runs-on: [self-hosted, linux, x64, onprem-aegypti] # Run the workflow on EHA aegypti runner (permissions required) | ||
#runs-on: [self-hosted, linux, x64, onprem-prospero] # Run the workflow on EHA prospero runner (permissions required) | ||
container: | ||
image: rocker/r-ver:4.2.1 | ||
steps: | ||
steps: | ||
# update to: git config --global --add safe.directory /__w/your-repo/your-repo | ||
- name: update permissions for container based workflows | ||
run: git config --global --add safe.directory /__w/container-template/container-template | ||
- uses: actions/checkout@v2 | ||
- name: Install system dependencies | ||
run: | | ||
apt-get update && apt-get install -y --no-install-recommends \ | ||
libcurl4-openssl-dev \ | ||
libssl-dev | ||
- name: Install packages from renv.lock (with cache) | ||
if: ${{ !env.ACT }} ## Doesn't work locally with ACT | ||
uses: r-lib/actions/setup-renv@v2 | ||
with: | ||
cache-version: 2 | ||
- name: Install packages from renv.lock (local, no cache) | ||
if: ${{ env.ACT }} ## Only locally with ACT, use `act -r` to reuse containers, effectively caching locally | ||
run: | | ||
renv::restore() | ||
shell: Rscript {0} | ||
- name: Run targets workflow | ||
run: | | ||
targets::tar_make() | ||
shell: Rscript {0} | ||
- name: On failure, launch a temporary interactive debugging session | ||
uses: mxschmitt/action-tmate@v3 | ||
if: ${{ failure() }} | ||
timeout-minutes: 15 | ||