Skip to content

Commit

Permalink
Merge pull request #223 from sigven/bundle_update_2023
Browse files Browse the repository at this point in the history
PCGR v.2.0rc - 2024
  • Loading branch information
sigven authored Jun 26, 2024
2 parents 04419da + 49398ab commit 06f6d04
Show file tree
Hide file tree
Showing 311 changed files with 280,161 additions and 20,021 deletions.
16 changes: 12 additions & 4 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[bumpversion]
current_version = 1.4.1
current_version = 1.4.1.9021
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<dev>\d+))?
serialize =
{major}.{minor}.{patch}.{dev}
{major}.{minor}.{patch}

[bumpversion:file:pcgrr/DESCRIPTION]
search = Version: {current_version}
Expand All @@ -15,9 +19,13 @@ replace = {new_version}
search = __version__ = '{current_version}'
replace = __version__ = '{new_version}'

[bumpversion:file:setup.py]
search = version='{current_version}'
replace = version='{new_version}'
[bumpversion:file:pyproject.toml]
search = version = "{current_version}"
replace = version = "{new_version}"

[bumpversion:file:conda/recipe/pcgr/meta.yaml]
search = version: {current_version}
replace = version: {new_version}

[bumpversion:file:conda/recipe/pcgrr/meta.yaml]
search = version: {current_version}
Expand Down
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*
!conda
!.dockerignore
65 changes: 65 additions & 0 deletions .github/workflows/apptainer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: apptainer

on:
push:
branches:
- patch1

env:
VERSION: '1.4.1.9015' # versioned by bump2version
jobs:
docker2apptainer:
name: Docker2apptainer
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
- name: Check free space
run: |
echo "Free space:"
df -h
- name: Code checkout
uses: actions/checkout@v4
with:
ref: v${{ env.VERSION }}
- name: 🏰 QEMU setup
uses: docker/setup-qemu-action@v3
- name: 🏯 Buildx setup
uses: docker/setup-buildx-action@v3
- name: DockerHub login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: 🐳 Docker img build and push to DockerHub
uses: docker/build-push-action@v6
with:
context: . # yes, dot
push: false
platforms: linux/amd64
tags: |
sigven/pcgr:${{ env.VERSION }}
outputs: type=docker,dest=pcgr_${{ env.VERSION }}.tar

- name: Apptainer setup
uses: eWaterCycle/setup-apptainer@v2

- name: Apptainer build
run: |
docker image ls -a
#docker save sigven/pcgr:${VERSION} -o pcgr_${VERSION}.tar
ls -la
df -h
echo "Building Apptainer SIF"
echo "---------------------------------"
apptainer build pcgr_singularity_${VERSION}.sif docker-archive://pcgr_${VERSION}.tar
echo "---------------------------------"
ls -la
df -h
#- name: Upload SIF to GHCR
# run: |
# echo ${{ secrets.GITHUB_TOKEN }} | apptainer registry login -u ${{ github.actor }} --password-stdin oras://ghcr.io
# apptainer push pcgr_${VERSION}.sif oras://ghcr.io/${GITHUB_REPOSITORY}:${VERSION}
147 changes: 77 additions & 70 deletions .github/workflows/build_conda_recipes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,68 +4,76 @@ on:
push:
branches:
- master
- dev
- bundle_update_2023
- locale
env:
atoken: ${{ secrets.ANACONDA_UPLOAD_TOKEN }}
recipe_path: conda/recipe
env_yml_path: conda/env/yml
env_lock_path: conda/env/lock
VERSION: '1.4.1' # versioned by bump2version
VERSION: '1.4.1.9021' # versioned by bump2version
jobs:
build_conda_pkgs:
build_pcgrr_conda_pkg:
# When merging to one of the branches above and the commit message matches
if: "startsWith(github.event.head_commit.message, 'Bump version:')"
name: Build conda packages
name: Build pcgrr conda pkg
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Code checkout
uses: actions/checkout@v4
- name: Micromamba setup
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ${{ env.env_yml_path }}/condabuild.yml
- name: 🐍 Conda pkg build and upload
run: |
conda mambabuild ${recipe_path}/pcgrr -c conda-forge -c bioconda --token ${atoken}
build_pcgr_conda_pkg:
# When merging to one of the branches above and the commit message matches
if: "startsWith(github.event.head_commit.message, 'Bump version:')"
name: Build pcgr conda pkg
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Code checkout
uses: actions/checkout@v3
- name: Mambaforge setup
uses: conda-incubator/setup-miniconda@v2
uses: actions/checkout@v4
- name: Micromamba setup
uses: mamba-org/setup-micromamba@v1
with:
miniforge-variant: Mambaforge
miniforge-version: "latest"
show-channel-urls: true
auto-activate-base: false
activate-environment: condabuild
environment-file: ${{ env.env_yml_path }}/condabuild.yml
use-mamba: true
- name: 🐍 Conda pkg build and upload
run: |
conda mambabuild ${recipe_path}/pcgr -c conda-forge -c bioconda --token ${atoken} --quiet
conda mambabuild ${recipe_path}/pcgrr -c conda-forge -c bioconda --token ${atoken} --quiet
# spin up fresh instance since conda-lock
# takes ages when run on previous one
# spin up fresh instance since conda-lock takes ages when run on previous one
conda_lock:
name: Conda lock
runs-on: ubuntu-latest
needs: build_conda_pkgs
needs: [build_pcgr_conda_pkg, build_pcgrr_conda_pkg]
defaults:
run:
shell: bash -l {0}

steps:
- name: Code checkout
uses: actions/checkout@v3
- name: Set up Mambaforge
uses: conda-incubator/setup-miniconda@v2
uses: actions/checkout@v4
- name: Micromamba setup
uses: mamba-org/setup-micromamba@v1
with:
miniforge-variant: Mambaforge
miniforge-version: "latest"
show-channel-urls: true
auto-activate-base: false
activate-environment: condabuild
environment-file: ${{ env.env_yml_path }}/condabuild.yml
use-mamba: true
- name: Generate conda locks
- name: 🔒 Conda lock
run: |
conda-lock lock --mamba --file ${env_yml_path}/pcgr.yml --filename-template 'pcgr-{platform}.lock' -p osx-64 -p linux-64
conda-lock lock --mamba --file ${env_yml_path}/pcgrr.yml --filename-template 'pcgrr-{platform}.lock' -p osx-64 -p linux-64
# 1. generate a combined lock file
# 2. render platform-specific locks
conda-lock lock --file ${env_yml_path}/pcgr.yml -p osx-64 -p linux-64
conda-lock render --kind explicit -p osx-64 -p linux-64 conda-lock.yml --filename-template 'pcgr-{platform}.lock' && rm conda-lock.yml
conda-lock lock --file ${env_yml_path}/pcgrr.yml -p osx-64 -p linux-64
conda-lock render --kind explicit -p osx-64 -p linux-64 conda-lock.yml --filename-template 'pcgrr-{platform}.lock' && rm conda-lock.yml
mv pcgrr-*.lock ${env_lock_path}
mv pcgr-*.lock ${env_lock_path}
- name: Commit changes
Expand All @@ -77,37 +85,15 @@ jobs:
git add .
git commit -m "${MSG}"
git push
pkgdown-site:
name: Deploy pkgdown website
runs-on: ubuntu-latest
needs: build_conda_pkgs
defaults:
run:
shell: bash -l {0}
steps:
- name: Code checkout
uses: actions/checkout@v3
- name: Set up miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: "latest"
auto-update-conda: true
auto-activate-base: true
activate-environment: ""
channels: "pcgr,conda-forge,bioconda"
- name: Install conda packages
run: mamba env create -n pkgdown -f ${env_yml_path}/pkgdown.yml
- name: 🌐 Website publish
if: github.ref_name == 'master'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
conda activate pkgdown
cp pcgrr/DESCRIPTION . # hack for pkgdown to work
printf "pcgrr version:\n"
Rscript -e "packageVersion('pcgrr')"
Rscript -e "pkgdown::deploy_to_branch(pkg = 'pcgrr', commit_message = paste(pkgdown:::construct_commit_message('.'), '- see https://sigven.github.io/pcgr/'), branch = 'gh-pages', new_process = FALSE)"
micromamba env create -n pkgdownenv -f ${env_yml_path}/pkgdown.yml
micromamba activate pkgdownenv
cp pcgrr/DESCRIPTION . # hack for pkgdown to work
printf "pcgrr version:\n"
Rscript -e "packageVersion('pcgrr')"
Rscript -e "pkgdown::deploy_to_branch(pkg = 'pcgrr', commit_message = 'Built PCGR website: https://sigven.github.io/pcgr/', branch = 'gh-pages', new_process = FALSE)"
docker_deploy:
name: Build and deploy Docker
Expand All @@ -116,10 +102,9 @@ jobs:
defaults:
run:
shell: bash -l {0}

steps:
- name: Code checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- id: pull_lock_commit
name: 📥 Pull lock commit
run: |
Expand All @@ -128,7 +113,7 @@ jobs:
LATEST_COMMIT_HASH="$(git --no-pager log -1 --format='%H')"
echo "latest_commit_hash=${LATEST_COMMIT_HASH}" >> $GITHUB_OUTPUT
- name: 🔖 Tag creation
uses: actions/github-script@v5
uses: actions/github-script@v7
env:
LATEST_COMMIT_HASH: ${{ steps.pull_lock_commit.outputs.latest_commit_hash }}
with:
Expand All @@ -142,24 +127,46 @@ jobs:
sha: the_sha
})
- name: 🗑 Free Disk Space
uses: jlumbroso/free-disk-space@main
# work with tag from above
- name: Code checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: v${{ env.VERSION }}
- name: Buildx setup
id: buildx
uses: docker/setup-buildx-action@v2
- name: 🏰 QEMU setup
uses: docker/setup-qemu-action@v3
- name: 🏯 Buildx setup
uses: docker/setup-buildx-action@v3
- name: DockerHub login
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: 🐳 Docker img build and push to DockerHub
uses: docker/build-push-action@v4
# use the outputs=docker with dest to directly save to tar for apptainer
- name: 🐳 Docker img build, tar and push to Docker Hub
uses: docker/build-push-action@v6
with:
context: . # yes, dot
context: .
push: true
platforms: linux/amd64
tags: |
sigven/pcgr:${{ env.VERSION }}
outputs: type=docker,dest=pcgr_${{ env.VERSION }}.tar

# Apptainer
- name: Apptainer setup
uses: eWaterCycle/setup-apptainer@v2
- name: 🕹️ Apptainer build
run: |
ls -lSha
df -h
echo "Building Apptainer SIF"
echo "---------------------------------"
apptainer build pcgr_singularity_${VERSION}.sif docker-archive://pcgr_${VERSION}.tar
echo "---------------------------------"
ls -lSha
- name: Upload SIF to GHCR
run: |
echo ${{ secrets.GITHUB_TOKEN }} | apptainer registry login -u ${{ github.actor }} --password-stdin oras://ghcr.io
apptainer push pcgr_singularity_${VERSION}.sif oras://ghcr.io/${GITHUB_REPOSITORY}:${VERSION}.singularity
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ docs/_build/

.Rhistory
*.Rproj

tests
17 changes: 12 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
FROM ubuntu:20.04
LABEL maintainer="https://github.com/pdiakumis"
LABEL org.opencontainers.image.authors='[email protected], [email protected]' \
org.opencontainers.image.description='Personal Cancer Genome Reporter (PCGR)' \
org.opencontainers.image.source='https://github.com/sigven/pcgr' \
org.opencontainers.image.url='https://github.com/sigven/pcgr' \
org.opencontainers.image.documentation='https://sigven.github.io/pcgr' \
org.opencontainers.image.licenses='MIT'

ARG MINI_VERSION=4.11.0-0
ARG MINI_VERSION=24.3.0-0
ARG MINI_URL=https://github.com/conda-forge/miniforge/releases/download/${MINI_VERSION}/Mambaforge-${MINI_VERSION}-Linux-x86_64.sh

# install core pkgs, mambaforge
RUN apt-get update && \
apt-get install --yes --no-install-recommends \
bash bzip2 curl git less vim wget zip ca-certificates && \
bash bzip2 curl less wget zip ca-certificates && \
apt-get clean && \
rm -r /var/lib/apt/lists/* && \
rm -r /var/cache/apt/* && \
curl --silent -L "${MINI_URL}" -o "mambaforge.sh" && \
/bin/bash mambaforge.sh -b -p /opt/mambaforge/ && \
rm mambaforge.sh
Expand All @@ -23,6 +26,10 @@ RUN mamba create -n pcgr --file ${PCGR_CONDA_ENV_DIR}/pcgr-linux-64.lock
RUN mamba create -n pcgrr --file ${PCGR_CONDA_ENV_DIR}/pcgrr-linux-64.lock
RUN mamba clean --all --force-pkgs-dirs --yes

FROM quay.io/bioconda/base-glibc-debian-bash:3.1

COPY --from=0 /opt/mambaforge/envs/ /opt/mambaforge/envs/

ARG PCGR_ENV_NAME="pcgr"
# pcgr env is activated by default
ENV PATH="/opt/mambaforge/envs/${PCGR_ENV_NAME}/bin:${PATH}"
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Sigve Nakken
Copyright (c) 2024 Sigve Nakken

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit 06f6d04

Please sign in to comment.