Update #12
Workflow file for this run
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: Simple workflow | |
on: | |
push: | |
branches: | |
- main | |
# TODO update this | |
- setup-workflows | |
# pull_request: | |
# types: | |
# - opened | |
# - synchronize | |
# - reopened | |
# - ready_for_review | |
# branches: | |
# - main | |
# To make sure you can run this workflow in your forked repository, please go to: | |
# Actions and click I understand my workflows... | |
# For reference, this is how the full list of steps will look like: | |
# Remove just a single # character at the beginning of line to uncomment. | |
# | |
#env: | |
# ENABLED_STEPS: | | |
# checkout_repository | |
# get_package_name | |
# build_r_package | |
# run_r_cmd_check | |
# upload_artifact | |
# Please set this variable to include proper steps. | |
env: | |
ENABLED_STEPS: | | |
None for now, when asked to, please add the steps from above, like this: | |
step_name_from_above (four spaces before the step name are important!) | |
jobs: | |
hello-world-from-r: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup R π§ | |
uses: r-lib/actions/setup-r@v2 | |
- name: Hello world! π¬ | |
run: cat(paste0("Hello ", Sys.getenv("NAME"), "! π")) | |
shell: Rscript {0} | |
env: | |
NAME: "Your name" | |
build-r-package: | |
runs-on: ubuntu-latest | |
container: | |
# image: rocker/r-ubuntu:latest | |
image: rocker/verse:4.4.0 | |
steps: | |
- name: Checkout repo π | |
# This means we're actually using an official GitHub Action. | |
uses: actions/[email protected] | |
if: contains(env.ENABLED_STEPS, 'checkout_repository') | |
with: | |
path: ${{ github.event.repository.name }} | |
- name: Get package name π¦ | |
if: contains(env.ENABLED_STEPS, 'get_package_name') | |
run: | | |
PKGBUILD="$(Rscript -e 'cat(sprintf("%s_%s.tar.gz",(dcf <- read.dcf("DESCRIPTION"))[,"Package"], dcf[,"Version"]))')" | |
echo "PKGBUILD = $PKGBUILD" | |
echo "PKGBUILD=$PKGBUILD" >> $GITHUB_ENV | |
shell: bash | |
working-directory: ${{ github.event.repository.name }} | |
- name: Build R package π | |
if: contains(env.ENABLED_STEPS, 'build_r_package') | |
run: | | |
R CMD build ${{ github.event.repository.name }} | |
shell: bash | |
# TODO Decide if we use an image with these packages installed, | |
# or we want to show how to install them (takes 2-3 minutes). | |
# Additionally, LaTeX is needed to create manual, | |
# so rocker/verse is working well for this purpose. | |
# - name: Install packages | |
# run: | |
# install.packages(c("cli", "testthat")) | |
# shell: Rscript {0} | |
- name: Run R CMD check π | |
if: contains(env.ENABLED_STEPS, 'run_r_cmd_check') | |
run: | | |
R CMD check ${{ env.PKGBUILD }} | |
shell: bash | |
env: | |
_R_CHECK_TESTS_NLINES_: 0 | |
_R_CHECK_VIGNETTES_NLINES_: 0 | |
- name: Upload package build ‴ | |
if: contains(env.ENABLED_STEPS, 'upload_artifact') | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ github.event.repository.name }}/${{ env.PKGBUILD }} | |
name: ${{ env.PKGBUILD }} |