-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
37 additions
and
14 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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)" | ||
|
@@ -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 }} |