Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New images for CRAN emulations #65

Merged
merged 5 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,28 @@ on:
- scheduled
workflow_dispatch:
inputs:
origin:
description: Org or username where the base image is located
cicdguy marked this conversation as resolved.
Show resolved Hide resolved
required: true
type: choice
default: rstudio
options:
- rstudio
- rhub
distribution:
description: Rocker Distro Name. Eg. rstudio
description: Rocker/RHub Distro Name. Eg. rstudio or fedora-gcc-devel
required: true
type: choice
default: rstudio
options:
- rstudio
- rstudio-local
- debian-clang-devel
- debian-gcc-devel
- fedora-clang-devel
- fedora-gcc-devel
- debian-gcc-patched
- debian-gcc-release
r_version:
description: R Version
required: true
Expand All @@ -30,6 +44,7 @@ on:
- "4.2.0"
- "4.2.1"
- "4.2.2"
- "latest"
bioc_version:
description: BioConductor Release
required: true
Expand All @@ -40,6 +55,7 @@ on:
- "3.14"
- "3.15"
- "3.16"
- "devel"
tag:
description: |
Custom Image Tag/Version. Defaults to current date in the `YYYY.MM.DD` format if unspecified.
Expand Down Expand Up @@ -67,6 +83,7 @@ jobs:
fi
echo ${var}
}
ORIGIN=$(normalize ${{ github.event.inputs.origin }} ${{ github.event.client_payload.origin }})
DISTRIBUTION=$(normalize ${{ github.event.inputs.distribution }} ${{ github.event.client_payload.distribution }})
R_VERSION=$(normalize ${{ github.event.inputs.r_version }} ${{ github.event.client_payload.r_version }})
BIOC_VERSION=$(normalize ${{ github.event.inputs.bioc_version }} ${{ github.event.client_payload.bioc_version }})
Expand All @@ -79,6 +96,7 @@ jobs:
echo "::set-output name=TAG_LATEST::$TAG_LATEST"
shell: bash
outputs:
origin: ${{ steps.normalizer.outputs.ORIGIN }}
distribution: ${{ steps.normalizer.outputs.DISTRIBUTION }}
r_version: ${{ steps.normalizer.outputs.R_VERSION }}
bioc_version: ${{ steps.normalizer.outputs.BIOC_VERSION }}
Expand Down Expand Up @@ -132,6 +150,11 @@ jobs:
run: |
# Set Image name
image_name="${{ needs.normalize-inputs.outputs.distribution }}_${{ needs.normalize-inputs.outputs.r_version }}_bioc_${{ needs.normalize-inputs.outputs.bioc_version }}"
if [[ "${{ needs.normalize-inputs.outputs.distribution }}" =~ ^debian.*|^fedora.* ]]
then {
image_name="${{ needs.normalize-inputs.outputs.distribution }}"
}
fi

# Set default tag as 'YYYY.MM.DD' date if it isn't set
tag="${{ needs.normalize-inputs.outputs.tag }}"
Expand Down Expand Up @@ -171,6 +194,7 @@ jobs:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
build-args: |
ORIGIN=${{ needs.normalize-inputs.outputs.origin }}
DISTRIBUTION=${{ needs.normalize-inputs.outputs.distribution }}
R_VERSION=${{ needs.normalize-inputs.outputs.r_version }}
BIOC_VERSION=${{ needs.normalize-inputs.outputs.bioc_version }}
Expand Down
33 changes: 30 additions & 3 deletions .github/workflows/scheduled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,38 @@ jobs:
strategy:
matrix:
image:
- r: '4.2.2'
- distro_tag: '4.2.2'
bioc: '3.16'
distro: rstudio-local
- r: '4.2.2'
origin: rstudio
- distro_tag: '4.2.2'
bioc: '3.16'
distro: rstudio
origin: rstudio
- distro_tag: 'latest'
bioc: 'devel'
distro: debian-clang-devel
origin: rhub
- distro_tag: 'latest'
bioc: 'devel'
distro: debian-gcc-devel
origin: rhub
- distro_tag: 'latest'
bioc: 'devel'
distro: fedora-clang-devel
origin: rhub
- distro_tag: 'latest'
bioc: 'devel'
distro: fedora-gcc-devel
origin: rhub
- distro_tag: 'latest'
bioc: '3.15'
distro: debian-gcc-patched
origin: rhub
- distro_tag: 'latest'
bioc: '3.16'
distro: debian-gcc-release
origin: rhub

# Trigger steps
steps:
Expand All @@ -33,8 +59,9 @@ jobs:
event-type: scheduled
client-payload: >
{
"origin": "${{ matrix.image.origin }}",
"distribution": "${{ matrix.image.distro }}",
"r_version": "${{ matrix.image.r }}",
"r_version": "${{ matrix.image.distro_tag }}",
"bioc_version": "${{ matrix.image.bioc }}",
"tag": "",
"tag_latest": "true"
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Build arguments
ARG ORIGIN=rocker
ARG ORIGIN_DISTRIBUTION=rstudio
ARG R_VERSION=4.2.0
ARG R_VERSION=4.2.2

# Fetch base image
FROM ${ORIGIN}/${ORIGIN_DISTRIBUTION}:${R_VERSION}

# Reset args in build context
ARG DISTRIBUTION=rstudio-local
ARG BIOC_VERSION=3.15
ARG BIOC_VERSION=3.16

# Set image metadata
LABEL org.opencontainers.image.licenses="GPL-2.0-or-later" \
Expand Down
3 changes: 2 additions & 1 deletion scripts/install_bioc.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ args <- commandArgs(trailing = TRUE)
bioc_version <- args[1]

# Install Bioc Installer
if (!requireNamespace("BiocManager", quietly = TRUE))
if (!requireNamespace("BiocManager", quietly = TRUE)) {
install.packages("BiocManager")
}
BiocManager::install(
version = bioc_version,
Ncpus = parallel::detectCores(),
Expand Down
18 changes: 13 additions & 5 deletions scripts/install_bioc_pkgs.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ shared_pkgs <- c(
# Per distro BioC packages to install
bioc_pkgs <- list(
rstudio = shared_pkgs,
`rstudio-local` = shared_pkgs
`rstudio-local` = shared_pkgs,
`debian-clang-devel` = shared_pkgs,
`debian-gcc-devel` = shared_pkgs,
`fedora-clang-devel` = shared_pkgs,
`fedora-gcc-devel` = shared_pkgs,
`debian-gcc-patched` = shared_pkgs,
`debian-gcc-release` = shared_pkgs
)

# Get diff of installed and uninstalled packages for
Expand All @@ -38,8 +44,10 @@ new_pkgs <- bioc_pkgs[[distribution]][
]

# Install only uninstalled packages
if (length(new_pkgs))
if (length(new_pkgs)) {
BiocManager::install(new_pkgs,
Ncpus = parallel::detectCores(),
upgrade = "never",
force = TRUE)
Ncpus = parallel::detectCores(),
upgrade = "never",
force = TRUE
)
}
29 changes: 21 additions & 8 deletions scripts/install_cran_pkgs.R
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,20 @@ cran_pkgs <- list(
shared_pkgs,
"diffviewer",
"languageserver"
)
),
`debian-clang-devel` = shared_pkgs,
`debian-gcc-devel` = shared_pkgs,
`fedora-clang-devel` = shared_pkgs,
`fedora-gcc-devel` = shared_pkgs,
`debian-gcc-patched` = shared_pkgs,
`debian-gcc-release` = shared_pkgs
)

# Re-install packages with newer versions
install.packages(reinstall_with_newer_version, type = "source",
Ncpus = parallel::detectCores())
install.packages(reinstall_with_newer_version,
type = "source",
Ncpus = parallel::detectCores()
)

# Get diff of installed and uninstalled packages for
# idempotent package installation
Expand All @@ -189,9 +197,12 @@ new_pkgs_from_src <- cran_pkgs_from_src[[distribution]][
]

# Install "source only" packages from source
if (length(new_pkgs_from_src))
install.packages(new_pkgs_from_src, type = "source",
Ncpus = parallel::detectCores())
if (length(new_pkgs_from_src)) {
install.packages(new_pkgs_from_src,
type = "source",
Ncpus = parallel::detectCores()
)
}


# Get diff of installed and uninstalled packages for
Expand All @@ -201,9 +212,11 @@ new_pkgs <- cran_pkgs[[distribution]][
]

# Install all other packages, only if they are uninstalled on the image
if (length(new_pkgs))
if (length(new_pkgs)) {
install.packages(new_pkgs,
Ncpus = parallel::detectCores())
Ncpus = parallel::detectCores()
)
}

# Conditionally install phantonJS
if (require("shinytest")) {
Expand Down
25 changes: 15 additions & 10 deletions scripts/install_gh_pkgs.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,22 @@ args <- commandArgs(trailing = TRUE)
distribution <- args[1]

# Packages to install
# Regular CRAN packages to install
shared_pkgs <- c(
"tlverse/sl3@v1.4.4",
"insightsengineering/nesttemplate",
"openpharma/staged.dependencies@*release"
)

gh_pkgs <- list(
rstudio = c(
"tlverse/sl3@v1.4.4",
"insightsengineering/nesttemplate",
"openpharma/staged.dependencies@*release"
),
`rstudio-local` = c(
"tlverse/sl3@v1.4.4",
"insightsengineering/nesttemplate",
"openpharma/staged.dependencies@*release"
)
rstudio = shared_pkgs,
`rstudio-local` = shared_pkgs,
`debian-clang-devel` = shared_pkgs,
`debian-gcc-devel` = shared_pkgs,
`fedora-clang-devel` = shared_pkgs,
`fedora-gcc-devel` = shared_pkgs,
`debian-gcc-patched` = shared_pkgs,
`debian-gcc-release` = shared_pkgs
)

# Get diff of installed and uninstalled packages for
Expand Down
18 changes: 12 additions & 6 deletions scripts/install_other_pkgs.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,18 @@ stat_pkgs <- c(

# List for packages to be installed in a given distribution
other_pkgs <- list(
rstudio = c(
stat_pkgs
),
`rstudio-local` = c(
nest_packages
)
rstudio = c(
stat_pkgs
),
`rstudio-local` = c(
nest_packages
),
`debian-clang-devel` = c(),
`debian-gcc-devel` = c(),
`fedora-clang-devel` = c(),
`fedora-gcc-devel` = c(),
`debian-gcc-patched` = c(),
`debian-gcc-release` = c()
)

# Get diff of installed and uninstalled packages for
Expand Down
6 changes: 6 additions & 0 deletions scripts/install_pip_pkgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ def install(packages=[]):
"rstudio-local": shared_packages + [
"pre-commit",
],
"debian-clang-devel": [],
"debian-gcc-devel": [],
"fedora-clang-devel": [],
"fedora-gcc-devel": [],
"debian-gcc-patched": [],
"debian-gcc-release": [],
}

# Install packages
Expand Down
Loading