Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
114 changes: 114 additions & 0 deletions .github/workflows/singularity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Singularity Build (native)
on:
push:

# Edit the branches here if you want to change deploy behavior
branches:
- main
- master

# Do the builds on all pull requests (to test them)
pull_request: []

jobs:
changes:
name: "Changed Singularity Recipes"
runs-on: ubuntu-latest
outputs:
changed_file: ${{ steps.files.outputs.added_modified }}
steps:
- id: files
uses: jitterbit/get-changed-files@b17fbb00bdc0c0f63fcf166580804b4d2cdc2a42
with:
format: 'json'

build-test-containers:
needs:
- changes
runs-on: ubuntu-latest
strategy:
# Keep going on other deployments if anything bloops
fail-fast: false
matrix:
changed_file: ${{ fromJson(needs.changes.outputs.changed_file) }}

name: Check ${{ matrix.changed_file }}
steps:
- name: Continue if Singularity Recipe
run: |
# Continue if we have a changed Singularity recipe
if [[ "${{ matrix.changed_file }}" = *Singularity* ]]; then
echo "keepgoing=true" >> $GITHUB_ENV
fi

- name: Set up Go 1.13
if: ${{ env.keepgoing == 'true' }}
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go

- name: Install Dependencies
if: ${{ env.keepgoing == 'true' }}
run: |
sudo apt-get update && sudo apt-get install -y \
build-essential \
libssl-dev \
uuid-dev \
libgpgme11-dev \
squashfs-tools \
libseccomp-dev \
pkg-config

- name: Install Singularity
if: ${{ env.keepgoing == 'true' }}
env:
SINGULARITY_VERSION: 3.8.1
GOPATH: /tmp/go

run: |
mkdir -p $GOPATH
sudo mkdir -p /usr/local/var/singularity/mnt && \
mkdir -p $GOPATH/src/github.com/sylabs && \
cd $GOPATH/src/github.com/sylabs && \
wget -qO- https://github.com/sylabs/singularity/releases/download/v${SINGULARITY_VERSION}/singularity-ce-${SINGULARITY_VERSION}.tar.gz | \
tar xzv && \
cd singularity-ce-${SINGULARITY_VERSION} && \
./mconfig -p /usr/local && \
make -C builddir && \
sudo make -C builddir install

- name: Check out code for the container build
if: ${{ env.keepgoing == 'true' }}
uses: actions/checkout@v2

- name: Build Container
if: ${{ env.keepgoing == 'true' }}
env:
recipe: ${{ matrix.changed_file }}
run: |
ls
if [ -f "${{ matrix.changed_file }}" ]; then
sudo -E singularity build container.sif ${{ matrix.changed_file }}
tag=$(echo "${recipe/Singularity\./}")
if [ "$tag" == "Singularity" ]; then
tag=latest
fi
# Build the container and name by tag
echo "Tag is $tag."
echo "tag=$tag" >> $GITHUB_ENV
else
echo "${{ matrix.changed_file }} is not found."
echo "Present working directory: $PWD"
ls
fi

- name: Login and Deploy Container
if: (github.event_name != 'pull_request')
env:
keepgoing: ${{ env.keepgoing }}
run: |
if [[ "${keepgoing}" == "true" ]]; then
echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ secrets.GHCR_USERNAME }} --password-stdin oras://ghcr.io
singularity push container.sif oras://ghcr.io/${GITHUB_REPOSITORY}:${tag}
fi
34 changes: 34 additions & 0 deletions Singularity
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Bootstrap: docker
From: ubuntu:20.04
IncludeCmd: yes

%environment
#R_VERSION=4.1
#export R_VERSION
#R_CONFIG_DIR=/etc/R/
#export R_CONFIG_DIR
export LC_ALL=C
export PATH=$PATH:/opt/software/miniconda3/bin

%post
apt-get update
apt-get install -y apt-transport-https apt-utils software-properties-common
apt-get install -y add-apt-key
export DEBIAN_FRONTEND=noninteractive
ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
apt-get install -y tzdata
dpkg-reconfigure --frontend noninteractive tzdata

apt-get install -y wget

mkdir -p /opt/software

# MAPseq installation
cd /opt/software
wget -q https://github.com/jfmrod/MAPseq/releases/download/2.0.1alpha/mapseq-2.0.1alpha-linux.tar.gz
tar xvzf mapseq-2.0.1alpha-linux.tar.gz
rm mapseq-2.0.1alpha-linux.tar.gz
mv mapseq-2.0.1alpha-linux mapseq

ln -s /opt/software/mapseq/mapseq /usr/bin/
ln -s /opt/softwaremapseq/share /usr/bin/