-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #138 from NIDAP-Community/update_cd
feat: CI/CD and Conda Recipe
- Loading branch information
Showing
11 changed files
with
415 additions
and
49 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 |
---|---|---|
@@ -0,0 +1,105 @@ | ||
name: Manual Deployment to NIDAP | ||
run-name: Manual Deployment to NIDAP by ${{ github.actor }} | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
|
||
image_to_use: | ||
required: true | ||
default: "<Replace with your image>" | ||
type: string | ||
|
||
package_to_deploy: | ||
required: true | ||
type: string | ||
|
||
artifact_rid: | ||
required: true | ||
default: "<Replace with your artifact RID>" | ||
type: string | ||
|
||
token_to_use: | ||
required: true | ||
type: string | ||
|
||
|
||
jobs: | ||
Adding_documentation_files_and_publish_page: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ${{ inputs.image_to_use }} | ||
credentials: | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- run: echo "Checking in ${{ inputs.image_to_use }}" | ||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: Continuous Deployment to NIDAP | ||
id: nidap-cd | ||
run: | | ||
export current_wd="/__w/${GITHUB_REPOSITORY#*/}/${GITHUB_REPOSITORY#*/}" | ||
cd $current_wd | ||
export MY_GIT_TOKEN=${{ secrets.GITHUB_TOKEN }} | ||
export MY_GIT_USERNAME=${{ github.actor }} | ||
export MY_GIT_EMAIL=${{ github.event.pusher.email }} | ||
git config --global user.name "$MY_GIT_USERNAME" | ||
git config --global user.email "$MY_GIT_EMAIL" | ||
git config --global url."https://api:[email protected]/".insteadOf "https://github.com/" | ||
git config --global url."https://ssh:[email protected]/".insteadOf "ssh://[email protected]/" | ||
git config --global url."https://git:[email protected]/".insteadOf "[email protected]:" | ||
git config --global --add safe.directory "$current_wd" | ||
git clone https://github.com/${GITHUB_REPOSITORY}.git | ||
cd ${GITHUB_REPOSITORY#*/} | ||
BRANCH_NAME="Conda_Package" | ||
git checkout $BRANCH_NAME | ||
echo "########## Git setup complete, moving to deployment... ##########" | ||
conda install curl | ||
current_pkg="${{ inputs.package_to_deploy }}" | ||
echo "Package to Upload: $current_pkg" | ||
TOKEN="${{ inputs.token_to_use }}" | ||
PACKAGE="$current_pkg" | ||
PLATFORM="linux-64" # replace with the package platform (e.g. noarch, linux-64, osx-64) | ||
response=$(curl \ | ||
-H "Authorization: Bearer $TOKEN" \ | ||
-H "Content-Type: application/octet-stream" \ | ||
--data-binary "@$PACKAGE" \ | ||
-XPUT "https://nidap.nih.gov/artifacts/api/repositories/${{ inputs.artifact_rid }}/contents/release/conda/$PLATFORM/$PACKAGE" \ | ||
2>&1) | ||
echo "#########################################################" | ||
current_datetime="$(date +"%Y-%m-%d %H:%M:%S")" | ||
# Check if the response contains an error message | ||
if echo "$response" | grep -q "errorCode"; then | ||
status=$(echo "$response" | grep -o '"errorName":"[^"]*' | awk -F'"' '{print $4}') | ||
echo "Error message: $status" | ||
echo "<br>Deployment Time: $current_datetime; Deployment Status: $status" >> README.md | ||
else | ||
status="Success" | ||
echo "Update Success!" | ||
echo "Package ${{ env.current_pkg }} is now on NIDAP." | ||
echo "<br>Deployment Time: $current_datetime; Deployment Status: Success" >> README.md | ||
fi | ||
git commit -a -m "Deployment Performed on $current_datetime with Status: $status." | ||
git push -f origin $BRANCH_NAME |
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 |
---|---|---|
@@ -1,17 +1,23 @@ | ||
name: Gitflow Action for R Package Development | ||
run-name: ${{ github.actor }} now ${{ github.event_name }} to ${{ github.ref_name }} | ||
run-name: ${{ github.actor }} ${{ github.event_name }} to ${{ github.ref_name }} | ||
|
||
on: | ||
push: | ||
branches: ['*', '!dev', '!main'] | ||
branches: ['*', '!dev', '!main', '!release_dev', '!Conda_Package', '!github_page'] | ||
|
||
pull_request: | ||
types: ['opened', 'closed'] | ||
branches: ['main', 'release*'] | ||
|
||
jobs: | ||
Activating_Parser: | ||
uses: fnlcr-bids-sdsi/gitflow-R/.github/workflows/parser.yml@DSPWorkflow | ||
uses: fnlcr-bids-sdsi/gitflow-R/.github/workflows/parser.yml@master | ||
with: | ||
image_to_use: ghcr.io/nidap-community/dsp_ci_cd:latest | ||
|
||
package_name: "r-dspworkflow" | ||
r_version: "4.1.3" | ||
artifact_rid_production: "ri.artifacts.main.repository.20ce29a2-3803-4eae-b325-8fe367d47d1e" | ||
artifact_rid_development: "ri.stemma.main.repository.2172e505-c98f-43d4-881a-47e170aadbe1" | ||
secrets: | ||
NIDAP_TOKEN_PRODUCTION: ${{ secrets.NIDAP_TOKEN_PRODUCTION }} | ||
NIDAP_TOKEN_DEVELOPMENT: ${{ secrets.NIDAP_TOKEN_DEVELOPMENT }} |
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 |
---|---|---|
@@ -0,0 +1,109 @@ | ||
{% set version = '<CURRENT_VERSION>' %} | ||
|
||
{% set posix = 'm2-' if win else '' %} | ||
{% set native = 'm2w64-' if win else '' %} | ||
|
||
package: | ||
name: r-dspworkflow-test | ||
version: {{ version|replace("-", "_") }} | ||
|
||
channels: | ||
- conda-forge | ||
- bioconda | ||
- file:///local_channel | ||
|
||
source: | ||
|
||
git_url: https://github.com/NIDAP-Community/DSPWorkflow/ | ||
git_tag: continuous_deployment | ||
|
||
build: | ||
merge_build_host: True # [win] | ||
# If this is a new build for the same version, increment the build number. | ||
number: 0 | ||
# no skip | ||
|
||
# This is required to make R link correctly on Linux. | ||
rpaths: | ||
- lib/R/lib/ | ||
- lib/ | ||
|
||
# Suggests: testthat (== 3.1.4) | ||
requirements: | ||
build: | ||
- {{ posix }}filesystem # [win] | ||
- {{ posix }}git | ||
- {{ posix }}zip # [win] | ||
|
||
host: | ||
- r-base =4.1.3=h2f963a2_5 | ||
- bioconductor-biobase =2.54.0=r41hc0cfd56_2 | ||
- bioconductor-biocgenerics =0.40.0=r41hdfd78af_0 | ||
- bioconductor-geomxtools =3.1.1=r41hdfd78af_0 | ||
- bioconductor-nanostringnctools =1.2.0 | ||
- bioconductor-spatialdecon =1.4.3 | ||
- bioconductor-complexheatmap =2.10.0=r41hdfd78af_0 | ||
- bioconductor-genomeinfodbdata =1.2.6 | ||
- r-cowplot =1.1.1=r41hc72bb7e_1 | ||
- r-dplyr =1.0.9=r41h7525677_0 | ||
- r-ggforce =0.3.4=r41h7525677_0 | ||
- r-ggplot2 =3.3.6=r41hc72bb7e_1 | ||
- r-gridextra =2.3=r41hc72bb7e_1004 | ||
- r-gtable =0.3.0=r41hc72bb7e_3 | ||
- r-knitr =1.40=r41hc72bb7e_1 | ||
- r-patchwork =1.1.2=r41hc72bb7e_1 | ||
- r-reshape2 =1.4.4=r41h7525677_2 | ||
- r-scales =1.2.1=r41hc72bb7e_1 | ||
- r-tibble =3.1.8=r41h06615bd_1 | ||
- r-tidyr =1.2.1=r41h7525677_1 | ||
- r-umap =0.2.9.0=r41h7525677_1 | ||
- r-rtsne =0.16=r41h37cf8d7_1 | ||
- r-magrittr =2.0.3=r41h06615bd_1 | ||
- r-rlang =1.1.0=r41h38f115c_0 | ||
- r-ggiraph=0.7.10=r41h03ef668_0 | ||
|
||
run: | ||
- r-base =4.1.3=h2f963a2_5 | ||
- bioconductor-biobase =2.54.0=r41hc0cfd56_2 | ||
- bioconductor-biocgenerics =0.40.0=r41hdfd78af_0 | ||
- bioconductor-geomxtools =3.1.1=r41hdfd78af_0 | ||
- bioconductor-nanostringnctools =1.2.0 | ||
- bioconductor-spatialdecon =1.4.3 | ||
- bioconductor-complexheatmap =2.10.0=r41hdfd78af_0 | ||
- bioconductor-genomeinfodbdata =1.2.6 | ||
- r-cowplot =1.1.1=r41hc72bb7e_1 | ||
- r-dplyr =1.0.9=r41h7525677_0 | ||
- r-ggforce =0.3.4=r41h7525677_0 | ||
- r-ggplot2 =3.3.6=r41hc72bb7e_1 | ||
- r-gridextra =2.3=r41hc72bb7e_1004 | ||
- r-gtable =0.3.0=r41hc72bb7e_3 | ||
- r-knitr =1.40=r41hc72bb7e_1 | ||
- r-patchwork =1.1.2=r41hc72bb7e_1 | ||
- r-reshape2 =1.4.4=r41h7525677_2 | ||
- r-scales =1.2.1=r41hc72bb7e_1 | ||
- r-tibble =3.1.8=r41h06615bd_1 | ||
- r-tidyr =1.2.1=r41h7525677_1 | ||
- r-umap =0.2.9.0=r41h7525677_1 | ||
- r-rtsne =0.16=r41h37cf8d7_1 | ||
- r-magrittr =2.0.3=r41h06615bd_1 | ||
- r-rlang =1.1.0=r41h38f115c_0 | ||
- r-ggiraph=0.7.10=r41h03ef668_0 | ||
|
||
test: | ||
commands: | ||
# You can put additional test commands to be run here. | ||
- $R -e "library('DSPWorkflow')" # [not win] | ||
- "\"%R%\" -e \"library('DSPWorkflow')\"" # [win] | ||
|
||
about: | ||
home: https://github.com/NIDAP-Community/DSPWorkflow | ||
license: MIT | ||
summary: A set of functions for analyzing RNA data from the spatial transcriptomics approach | ||
Digital Spatial Profiling (Nanostring). The user provides read count data and annotations, | ||
and the package outputs normalized differential expression of genes and further | ||
visualizations and analysis based on user input. It can be run in a docker container | ||
and in user-friendly web-based interactive notebooks (NIDAP, Palantir Foundry). | ||
license_family: MIT | ||
license_file: | ||
- '{{ environ["PREFIX"] }}/lib/R/share/licenses/MIT' | ||
- LICENSE |
41 changes: 41 additions & 0 deletions
41
Dockerfile/Conda_container/Building_R_environment/DESCRIPTION
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
Type: project | ||
Description: Digital-Spatial-Profiling v3.1.1 environment for DSP package. | ||
Repository: | ||
CRAN, | ||
biocsoftv314, | ||
biocsoftv315, | ||
biocanadatav313, | ||
biocexpdatav314, | ||
biocworkflowv314 | ||
Depends: | ||
backports (== 1.4.1), | ||
Biobase (== 2.54.0), | ||
BiocGenerics (== 0.40.0), | ||
cowplot (== 1.1.1), | ||
dplyr (== 1.0.9), | ||
GeomxTools (== 3.1.1), | ||
ggforce (== 0.3.4), | ||
ggplot2 (== 3.3.6), | ||
ggiraph (== 0.8.3), | ||
dbplyr (== 2.2.1), | ||
gridExtra (== 2.3), | ||
gtable (== 0.3.0), | ||
knitr (== 1.40), | ||
NanoStringNCTools (== 1.4.0), | ||
patchwork (== 1.1.2), | ||
reshape2 (== 1.4.4), | ||
Rmpfr (== 0.8-9), | ||
Rtsne (== 0.16), | ||
scales (== 1.2.1), | ||
stats (== 4.1.3), | ||
SpatialDecon (== 1.4.3), | ||
tibble (== 3.1.8), | ||
tidyr (== 1.2.1), | ||
tidyverse (== 1.3.2), | ||
umap (== 0.2.9.0), | ||
pheatmap (== 1.0.12), | ||
stringr | ||
Remotes: | ||
url::https://bioconductor.org/packages/3.15/workflows/src/contrib/GeoMxWorkflows_1.2.0.tar.gz, | ||
git::https://github.com/Nanostring-Biostats/SpatialOmicsOverlay.git, | ||
git::https://github.com/Nanostring-Biostats/GeomxTools.git |
44 changes: 44 additions & 0 deletions
44
Dockerfile/Conda_container/Building_R_environment/Generate_Renv.R
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# 9/13/2022 [email protected] | ||
# Creating renv environment now | ||
|
||
############################################################# | ||
|
||
print("Loading repos...") | ||
repos <- c(CRAN = "https://cloud.r-project.org", | ||
biocsoftv314 = "https://bioconductor.org/packages/3.14/bioc/", | ||
biocsoftv315 = "https://bioconductor.org/packages/3.15/bioc/", | ||
biocanadatav313 = "https://bioconductor.org/packages/3.14/data/annotation/", | ||
biocexpdatav314 = "https://bioconductor.org/packages/3.14/data/experiment/", | ||
biocworkflowv314 = "https://bioconductor.org/packages/3.14/workflows/") | ||
options(repos = repos) | ||
print("Repos loaded.") | ||
|
||
############################################################### | ||
|
||
print("Setting up plain R environment now...") | ||
|
||
if(!file.exists("DESCRIPTION")){ | ||
|
||
print("No existing DESCRIPTION file in current working directory:") | ||
print(getwd()) | ||
print("Exiting Environment setup now.") | ||
|
||
auto.snapshot <- getOption("renv.config.auto.snapshot") | ||
options(renv.config.auto.snapshot = TRUE) | ||
break | ||
|
||
}else{ | ||
|
||
print("Installing Packages from DESCRIPTION now...") | ||
|
||
renv::install() | ||
|
||
print("Packages installed.") | ||
|
||
|
||
auto.snapshot <- getOption("renv.config.auto.snapshot") | ||
options(renv.config.auto.snapshot = TRUE) | ||
|
||
} | ||
|
||
|
18 changes: 18 additions & 0 deletions
18
Dockerfile/Conda_container/Building_R_environment/Initiate_Renv.R
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# 9/13/2022 [email protected] | ||
# Creating renv environment now | ||
|
||
# initiate <- FALSE | ||
if (initiate){ | ||
|
||
auto.snapshot <- getOption("renv.config.auto.snapshot") | ||
options(renv.config.auto.snapshot = FALSE) | ||
|
||
renv::settings$snapshot.type("implicit") | ||
renv::init(bare = TRUE) | ||
print("Environment Initiated") | ||
|
||
}else{ | ||
|
||
print("Environment Not Initiated") | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
Dockerfile/Conda_container/Building_R_environment/Load_packages.R
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
print("Loading and recording sessionInfo now...") | ||
|
||
# Load packages | ||
list_of_package <- scan("package_list.txt", what="", sep="\n") | ||
|
||
for (packages in list_of_package){ | ||
lapply(packages, | ||
function(x) suppressMessages(library(x, | ||
character.only = TRUE, | ||
quietly=TRUE, | ||
warn.conflicts = FALSE))) | ||
} | ||
|
||
|
||
sessionInfoName <- "sessionInfo.txt" | ||
writeLines(capture.output(sessionInfo()), sessionInfoName) | ||
print("SessionInfo printed.") |
6 changes: 6 additions & 0 deletions
6
Dockerfile/Conda_container/Building_R_environment/package_list.txt
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
GeomxTools | ||
NanoStringNCTools | ||
SpatialDecon | ||
tidyverse | ||
pheatmap | ||
stringr |
Oops, something went wrong.