Skip to content

Commit

Permalink
Merge pull request #324 from insightsengineering/cran-release
Browse files Browse the repository at this point in the history
Cran release
  • Loading branch information
gowerc authored Mar 3, 2022
2 parents 895edb1 + 20f0fd0 commit 539d258
Show file tree
Hide file tree
Showing 16 changed files with 273 additions and 134 deletions.
6 changes: 5 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@

^CRAN-SUBMISSION$
^cran-comments\.md$
^.vscode$
^.vscode$

^.*\.tar\.gz$
^.*\.Rcheck$

1 change: 0 additions & 1 deletion .github/.gitignore

This file was deleted.

42 changes: 42 additions & 0 deletions .github/actions/rcmdcheck/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

name: 'Build src'
description: 'Build src!'
inputs:
slim:
description: 'Should the reduced set of checks be run'
default: false
runs:
using: "composite"
steps:
- name: Build R package
shell: bash
run: |
R CMD build .
- name: Run R CMD check
env:
_R_CHECK_CRAN_INCOMING_: false
_R_CHECK_CRAN_INCOMING_REMOTE_: false
shell: bash
run: |
echo "inputs.slim = ${{ inputs.slim }}"
if ${{ inputs.slim }} ; then
R CMD check --no-manual --no-build-vignettes --no-vignettes --ignore-vignettes *.tar.gz
else
R CMD check --no-manual --as-cran *.tar.gz
fi
- name: Catch warnings in R CMD check output
id: catch-errors
shell: Rscript {0}
run: |
check_dir <- grep("*\\.Rcheck$", list.dirs(), value = TRUE)
check_log <- sprintf("%s/00check.log", check_dir)
if (file.exists(check_log)) {
x <- tail(readLines(check_log), 1)
if (!grepl("^Status", x)) stop("No status line found in R CMD check log")
if (grepl("ERROR", x)) stop("R CMD check has errors")
if (grepl("WARNING", x)) stop("R CMD check has warnings")
} else {
stop("Could not find check log")
}
14 changes: 2 additions & 12 deletions .github/workflows/build_docker.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
name: Deploy image to GHCR
name: Build fixed version Docker images

env:
REGISTRY: ghcr.io

on:
push:
branches:
- main
paths:
- 'misc/docker/**'
pull_request:
branches:
- main
paths:
- 'misc/docker/**'
workflow_dispatch:


Expand Down Expand Up @@ -79,7 +69,7 @@ jobs:
uses: docker/build-push-action@v2
with:
context: ./misc/docker
push: ${{ github.event_name == 'push' }}
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.config.tag }}
build-args: |
IMAGE=${{ matrix.config.src_image }}
Expand Down
83 changes: 83 additions & 0 deletions .github/workflows/build_docker_latest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Build latest version Docker images

env:
REGISTRY: ghcr.io

on:
schedule:
- cron: '0 5 1,15 * *'
workflow_dispatch:


jobs:
build:
runs-on: ubuntu-latest
name: Build & Deploy Docker Images


strategy:
fail-fast: true
matrix:
config:
- {
src_image: "rocker/r-ver:latest",
cran_url: "https://packagemanager.rstudio.com/cran/latest",
tag: "rbmi:latest"
}

# Token permissions
permissions:
contents: read
packages: write

# Build steps
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
id: buildx
with:
install: true

- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: docker-cache-${{ matrix.config.tag }}


- name: debug
run: |
echo push = ${{ github.event_name == 'push' }}
echo tag = ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.config.tag }}
echo IMAGE=${{ matrix.config.src_image }}
echo CRANURL=${{ matrix.config.cran_url }}
- name: Build and push image
uses: docker/build-push-action@v2
with:
context: ./misc/docker
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.config.tag }}
build-args: |
IMAGE=${{ matrix.config.src_image }}
CRANURL=${{ matrix.config.cran_url }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new

# Fix bug where docker cache just continiously grows as it doesn't purge older layers
# That are no longer in use
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#local-cache
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
41 changes: 0 additions & 41 deletions .github/workflows/on_nightly_cran.yaml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/on_nightly_main.yaml

This file was deleted.

8 changes: 3 additions & 5 deletions .github/workflows/on_pr_cran.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,11 @@ jobs:
cache-version: 2
extra-packages: |
remotes
rcmdcheck
- name: Install Pandoc
uses: r-lib/actions/setup-pandoc@v1

- name: Check
run: |
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning")
shell: Rscript {0}
uses: ./.github/actions/rcmdcheck
with:
slim: false
31 changes: 15 additions & 16 deletions .github/workflows/on_pr.yaml → .github/workflows/on_pr_main.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@


on:
on:
pull_request:
paths-ignore:
- 'misc/**'
branches:
- main

name: On Pull Request

Expand All @@ -17,32 +19,25 @@ jobs:
config:
- { image: "ghcr.io/${{ github.repository_owner }}/rbmi:r404"}
- { image: "ghcr.io/${{ github.repository_owner }}/rbmi:r410"}


runs-on: ubuntu-latest

container:
image: ${{ matrix.config.image }}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_TEST_NIGHTLY: 'FALSE'

steps:
- name: Checkout
uses: actions/checkout@v2



- name: Build src
uses: ./.github/actions/build-src

- name: Check
run: |
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning")
shell: Rscript {0}


uses: ./.github/actions/rcmdcheck
with:
slim: true


vignettes:
strategy:
fail-fast: true
Expand All @@ -56,6 +51,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: testthat

- name: Build src
uses: ./.github/actions/build-src

- name: Build Vignettes
run: |
Rscript ./vignettes/build.R
Loading

0 comments on commit 539d258

Please sign in to comment.