Update #18
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 | |
# Prerequisites to run workflows: | |
# Actions -> I understand my workflows... | |
# Settings -> Actions -> General -> Workflow permissions -> Read and write permissions | |
# env: | |
# ENABLED_STEPS: | | |
# checkout_repository | |
# get_package_name | |
# build_r_package | |
# run_r_cmd_check | |
# upload_artifact | |
# When asked to, please add the steps from the list above: | |
env: | |
ENABLED_STEPS: | | |
checkout_repository | |
get_package_name | |
build_r_... | |
run_r_... | |
upload_... | |
jobs: | |
hello-world-from-r: | |
name: Hello, world! | |
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: | |
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 }} | |
ls -l | |
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: ${{ env.PKGBUILD }} | |
name: ${{ env.PKGBUILD }} |