Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
walkowif committed May 15, 2024
1 parent caf7a35 commit 357b297
Showing 1 changed file with 37 additions and 14 deletions.
51 changes: 37 additions & 14 deletions .github/workflows/simple.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,42 @@ on:
# branches:
# - main

# For reference, this is how the full list of steps will look like:
#
#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: "checkout_repository,get_package_name,build_r_package,run_r_cmd_check"
ENABLED_STEPS: |
checkout_repository
get_package_name
build_r_package
run_r_cmd_check
upload_artifact
jobs:
hello-world:
runs-on: ubuntu-latest
container:
image: rocker/r-ubuntu:latest
# image: rocker/r-ubuntu:latest
image: rocker/tidyverse:4.4.0

steps:
- name: Checkout repo 🛎
# This means we're actually using a GitHub Action.
uses: actions/[email protected]
if: >
contains(env.ENABLED_STEPS, 'checkout_repository')
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')
if: contains(env.ENABLED_STEPS, 'get_package_name')
run: |
PKGBUILD="$(echo $(awk -F: '/Package:/{gsub(/[ ]+/,"") ; print $2}' DESCRIPTION)_"\
"$(awk -F: '/Version:/{gsub(/[ ]+/,"") ; print $2}' DESCRIPTION).tar.gz)"
Expand All @@ -45,23 +61,30 @@ jobs:
working-directory: ${{ github.event.repository.name }}

- name: Build R package 🏗
if: >
contains(env.ENABLED_STEPS, 'build_r_package')
if: contains(env.ENABLED_STEPS, 'build_r_package')
run: |
R CMD build ${{ github.event.repository.name }}
shell: bash

- name: Install packages
run:
install.packages(c("cli", "testthat"))
shell: Rscript {0}
# TODO Decide if we use an image with these packages installed,
# or we want to show how to install them (takes 2-3 minutes).
# - 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')
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 }}

0 comments on commit 357b297

Please sign in to comment.