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

Add github action to build a Docker image and update for Nextflow 21.04.1 #109

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
07bc7e5
Create docker-image.yml
antunderwood Jun 24, 2021
c3539fb
Create docker-publish.yml
antunderwood Jun 25, 2021
b046484
Revert "Create docker-publish.yml"
antunderwood Jun 25, 2021
c984de4
add nanopre build action
antunderwood Jun 25, 2021
25c6b3a
test variables
antunderwood Jun 25, 2021
06851a9
more tests
antunderwood Jun 25, 2021
683055d
don't build on PR
antunderwood Jun 25, 2021
b9d00fd
test opposite
antunderwood Jun 25, 2021
0e64974
test
antunderwood Jun 25, 2021
3413040
test PR
antunderwood Jun 25, 2021
45669a6
tag
antunderwood Jun 25, 2021
b436c10
push again
antunderwood Jun 25, 2021
443d4fa
push to latest if v tag
antunderwood Jun 25, 2021
e937ea6
testing
antunderwood Jun 25, 2021
54256e4
correct typo
antunderwood Jun 25, 2021
a72b462
back to latest test
antunderwood Jun 25, 2021
59f9590
test tag name
antunderwood Jun 25, 2021
320e094
test
antunderwood Jun 25, 2021
615c8a5
test
antunderwood Jun 25, 2021
9b7a508
test
antunderwood Jun 25, 2021
bf2e02b
tag
antunderwood Jun 25, 2021
440e913
tag again
antunderwood Jun 25, 2021
a415cbc
ref
antunderwood Jun 25, 2021
95e9763
event ref starts with
antunderwood Jun 25, 2021
b651dec
latest
antunderwood Jun 25, 2021
ebb9b0b
debug
antunderwood Jun 25, 2021
440291f
add IMAGE_ID
antunderwood Jun 25, 2021
31497e6
update schema
antunderwood Jun 25, 2021
1909089
correct typo
antunderwood Jun 25, 2021
61accf0
change string vars to null not false
antunderwood Jun 25, 2021
9c10f4a
build containers for NF tower
antunderwood Jun 25, 2021
1c0b8ae
correct yml
antunderwood Jun 25, 2021
e7517f4
Correct config
antunderwood Jun 25, 2021
29aff9a
updated schema
antunderwood Jun 25, 2021
1877ad9
use wget rather than git
antunderwood Jun 25, 2021
2c83b32
revert to git and use correct container name
antunderwood Jun 25, 2021
899a94b
use correct sytax for DLS2
antunderwood Jun 26, 2021
5283539
remove artic entrypoint from nanopore container
antunderwood Jun 26, 2021
a3808d1
Add test workflow back
antunderwood Jun 28, 2021
cdfbd4a
change download name for singularity tarball
antunderwood Jun 28, 2021
644a7ed
cd into correct dir
antunderwood Jun 28, 2021
95e59f5
update to NF 21.04.1
antunderwood Jun 28, 2021
4e98c38
Merge pull request #1 from cgps-dev/nextflow-tower
antunderwood Jun 28, 2021
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
4 changes: 2 additions & 2 deletions .github/scripts/install_singularity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ go version
# install Singularity
export VERSION=3.5.3
echo Install Singularity version $VERSION .. >> artifacts/test_artifact.log
wget https://github.com/sylabs/singularity/releases/download/v${VERSION}/singularity-${VERSION}.tar.gz
wget https://codeload.github.com/sylabs/singularity/tar.gz/refs/tags/v${VERSION} -O singularity-${VERSION}.tar.gz
tar -xzf singularity-${VERSION}.tar.gz
cd singularity
cd singularity-${VERSION}
./mconfig
make -C builddir
sudo make -C builddir install
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/test_PR_against_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export PATH=/opt/conda/bin:$PATH
singularity --version
# write test log as github Action artifact
echo Nextflow run current PR in --illumina mode.. >> artifacts/test_artifact.log
NXF_VER=20.03.0-edge nextflow run ./main.nf \
NXF_VER=21.04.1 nextflow run ./main.nf \
-profile singularity \
--directory $PWD/.github/data/fastqs/ \
--illumina \
Expand All @@ -25,7 +25,7 @@ git checkout tags/v1.1.1
sed -i s'/cpus = 4/cpus = 2/'g conf/resources.config
ln -s ../*.sif ./
echo Nextflow run previous release in --illumina mode.. >> ../artifacts/test_artifact.log
NXF_VER=20.03.0-edge nextflow run ./main.nf \
NXF_VER=21.04.1 nextflow run ./main.nf \
-profile singularity \
--directory $PWD/../.github/data/fastqs/ \
--illumina \
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/test_bed_ref_input.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ echo bed file: $BED_FILE >> artifacts/test_artifact.log
# run current pull request code
singularity --version
echo Nextflow run --illumina mode with --ref, --bed .. >> artifacts/test_artifact.log
NXF_VER=20.03.0-edge nextflow run ./main.nf \
NXF_VER=21.04.1 nextflow run ./main.nf \
-profile singularity \
--ref $REF_FILE \
--bed $BED_FILE \
Expand Down Expand Up @@ -58,7 +58,7 @@ rm $REF_FILE
ln -s $REAL_REF $REF_FILE

echo Nextflow run --illumina mode with symlinked --ref, --bed .. >> artifacts/test_artifact.log
NXF_VER=20.03.0-edge nextflow run ./main.nf \
NXF_VER=21.04.1 nextflow run ./main.nf \
-profile singularity \
--ref $REF_FILE \
--bed $BED_FILE \
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/test_conda_cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export REPO=$PWD
echo REPO=$REPO >> artifacts/test_artifact.log
cd ..
echo PWD=$PWD >> $REPO/artifacts/test_artifact.log
NXF_VER=20.03.0-edge nextflow run $REPO \
NXF_VER=21.04.1 nextflow run $REPO \
-profile conda \
--cache $REPO/conda_cache_dir \
--directory $REPO/.github/data/fastqs/ \
Expand All @@ -25,7 +25,7 @@ cat .nextflow.log | grep 'Conda create complete env=/home/runner/work/ncov2019-a
rm -rf results && rm -rf work && rm -rf .nextflow*
# second NF run will use the conda env created in the previous run
echo re-run pipeline with conda --cache.. >> $REPO/artifacts/test_artifact.log
NXF_VER=20.03.0-edge nextflow run $REPO \
NXF_VER=21.04.1 nextflow run $REPO \
-profile conda \
--cache $REPO/conda_cache_dir \
--directory $REPO/.github/data/fastqs/ \
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/test_cram_input.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ echo bed file: $BED_FILE
sed -i s'/cpus = 4/cpus = 2/'g conf/coguk/sanger.config
singularity --version
echo Nextflow run --illumina mode with --ref, --bed and --cram.. >> artifacts/test_artifact.log
NXF_VER=20.03.0-edge nextflow run ./main.nf \
NXF_VER=21.04.1 nextflow run ./main.nf \
-profile sanger,singularity \
--ref $REF_FILE \
--bed $BED_FILE \
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/test_cram_output.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ echo bed file: $BED_FILE
sed -i s'/cpus = 4/cpus = 2/'g conf/coguk/sanger.config
singularity --version
echo Nextflow run --illumina mode with --ref, --bed --cram and outCram... >> artifacts/test_artifact.log
NXF_VER=20.03.0-edge nextflow run ./main.nf \
NXF_VER=21.04.1 nextflow run ./main.nf \
-profile sanger,singularity \
--ref $REF_FILE \
--bed $BED_FILE \
Expand Down
8 changes: 4 additions & 4 deletions .github/scripts/test_nanopore_pipelines.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export PATH=/opt/conda/bin:$PATH
singularity --version
# write test log as github Action artifact
echo "Nextflow run current PR in --nanopolish mode (no barcodes).." >> artifacts/test_artifact.log
NXF_VER=20.03.0-edge nextflow run ./main.nf \
NXF_VER=21.04.1 nextflow run ./main.nf \
-profile singularity \
--nanopolish \
--sequencing_summary $PWD/.github/data/nanopore/20200311_1427_X4_FAK72834_a3787181/sequencing_summary_FAK72834_298b7829.txt \
Expand All @@ -17,7 +17,7 @@ cp .nextflow.log artifacts/nanopolish.nextflow.log
rm -rf results && rm -rf work && rm -rf .nextflow*

echo "Nextflow run current PR in --nanopolish mode (barcodes).." >> artifacts/test_artifact.log
NXF_VER=20.03.0-edge nextflow run ./main.nf \
NXF_VER=21.04.1 nextflow run ./main.nf \
-profile singularity \
--nanopolish \
--sequencing_summary $PWD/.github/data/nanopore/20200311_1427_X1_FAK72834_a3787181/sequencing_summary_FAK72834_298b7829.txt \
Expand All @@ -28,7 +28,7 @@ cp .nextflow.log artifacts/nanopolish_barcodes.nextflow.log
rm -rf results && rm -rf work && rm -rf .nextflow*

echo "Nextflow run current PR in --medaka mode (no barcodes).." >> artifacts/test_artifact.log
NXF_VER=20.03.0-edge nextflow run ./main.nf \
NXF_VER=21.04.1 nextflow run ./main.nf \
-profile singularity \
--medaka \
--basecalled_fastq $PWD/.github/data/nanopore/20200311_1427_X4_FAK72834_a3787181/fastq_pass/ \
Expand All @@ -37,7 +37,7 @@ cp .nextflow.log artifacts/medaka.nextflow.log
rm -rf results && rm -rf work && rm -rf .nextflow*

echo "Nextflow run current PR in --medaka mode (barcodes).." >> artifacts/test_artifact.log
NXF_VER=20.03.0-edge nextflow run ./main.nf \
NXF_VER=21.04.1 nextflow run ./main.nf \
-profile singularity \
--medaka \
--basecalled_fastq $PWD/.github/data/nanopore/20200311_1427_X1_FAK72834_a3787181/fastq_pass/ \
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/test_sanger_profile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export PATH=/opt/conda/bin:$PATH
# there are only 2 available cpus in the github runner execution
sed -i s'/cpus = 4/cpus = 2/'g conf/coguk/sanger.config
echo run pipeline in --illumina mode with --sanger profile.. >> artifacts/test_artifact.log
NXF_VER=20.03.0-edge nextflow run ./main.nf \
NXF_VER=21.04.1 nextflow run ./main.nf \
-profile sanger,singularity \
--directory $PWD/.github/data/fastqs/ \
--illumina \
Expand Down
6 changes: 3 additions & 3 deletions .github/scripts/test_typing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export PATH=/opt/conda/bin:$PATH
singularity --version
# write test log as github Action artifact
echo "Nextflow run current PR in --nanopolish mode with typing.." >> artifacts/test_artifact.log
NXF_VER=20.03.0-edge nextflow run ./main.nf \
NXF_VER=21.04.1 nextflow run ./main.nf \
-profile singularity \
--gff $PWD/typing/MN908947.3.gff \
--yaml $PWD/typing/SARS-CoV-2.types.yaml \
Expand All @@ -19,7 +19,7 @@ cp .nextflow.log artifacts/nanopolish_typing.nextflow.log
rm -rf results && rm -rf work && rm -rf .nextflow*

echo "Nextflow run current PR in --medaka mode with typing .." >> artifacts/test_artifact.log
NXF_VER=20.03.0-edge nextflow run ./main.nf \
NXF_VER=21.04.1 nextflow run ./main.nf \
-profile singularity \
--medaka \
--gff $PWD/typing/MN908947.3.gff \
Expand All @@ -30,7 +30,7 @@ cp .nextflow.log artifacts/medaka_typing.nextflow.log
rm -rf results && rm -rf work && rm -rf .nextflow*

echo Nextflow run current PR in --illumina mode with typing.. >> artifacts/test_artifact.log
NXF_VER=20.03.0-edge nextflow run ./main.nf \
NXF_VER=21.04.1 nextflow run ./main.nf \
-profile singularity \
--gff $PWD/typing/MN908947.3.gff \
--yaml $PWD/typing/SARS-CoV-2.types.yaml \
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/docker-build-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Create and publish a Docker image

on:
push:
branches:
- master
# Publish `v1.2.3` tags as releases.
tags:
- v*
- t*
# Run tests for any PRs.
pull_request:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read

steps:
- uses: actions/checkout@v2

- name: Build image
run: |
docker build . --file environments/nanopore/Dockerfile --tag $IMAGE_NAME-nanopore --label "runnumber=${GITHUB_RUN_ID}"
docker build . --file environments/illumina/Dockerfile --tag $IMAGE_NAME-illumina --label "runnumber=${GITHUB_RUN_ID}"

- name: Log in to registry
if: ${{ github.event_name != 'pull_request' }}
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push image
if: ${{ github.event_name != 'pull_request' }}
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME

# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
docker tag $IMAGE_NAME-nanopore $IMAGE_ID:$VERSION-nanopore
docker push $IMAGE_ID:$VERSION-nanopore
docker tag $IMAGE_NAME-illumina $IMAGE_ID:$VERSION-illumina
docker push $IMAGE_ID:$VERSION-illumina
- name: Push latest
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v')}}
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
docker tag $IMAGE_NAME-nanopore $IMAGE_ID:latest-nanopore
docker push $IMAGE_ID:latest-nanopore
docker tag $IMAGE_NAME-illumina $IMAGE_ID:latest-illumina
docker push $IMAGE_ID:latest-illumina
14 changes: 7 additions & 7 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ jobs:
run: mkdir artifacts
- name: install Singularity
run: |
bash .github/scripts/install_singularity.sh
bash .github/scripts/install_singularity.sh
- name: Build pipeline Singularity containers
run: |
echo $(which singularity)
bash scripts/build_singularity_containers.sh
echo $(which singularity)
bash scripts/build_singularity_containers.sh
- name: install Conda
run: bash .github/scripts/install_conda.sh
- name: install Nextflow via Conda
run: |
export PATH=/opt/conda/bin:$PATH
conda install -c bioconda nextflow
NXF_VER=20.03.0-edge nextflow -version
export PATH=/opt/conda/bin:$PATH
conda install -c bioconda nextflow
NXF_VER=21.04.1 nextflow -version
- name: test nanopore pipelines
run: bash .github/scripts/test_nanopore_pipelines.sh
- name: test typing functionality
Expand All @@ -50,4 +50,4 @@ jobs:
if: always()
with:
name: test_artifacts
path: artifacts
path: artifacts
10 changes: 5 additions & 5 deletions conf/base.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

params{
// Boilerplate to keep nextflow happy about undefined vars
directory = false
prefix = false
basecalled_fastq = false
fast5_pass = false
sequencing_summary = false
directory = null
prefix = null
basecalled_fastq = null
fast5_pass = null
sequencing_summary = null
ref = false
bed = false
gff = false
Expand Down
1 change: 0 additions & 1 deletion environments/nanopore/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ apt-get install -y git procps && \
apt-get clean -y
COPY --from=condabuild /opt/conda/envs/artic /opt/conda/envs/artic
ENV PATH=/opt/conda/envs/artic/bin:$PATH
ENTRYPOINT ["/opt/conda/envs/artic/bin/artic"]
2 changes: 1 addition & 1 deletion main.nf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env nextflow

// enable dsl2
nextflow.preview.dsl = 2
nextflow.enable.dsl = 2

// include modules
include {printHelp} from './modules/help.nf'
Expand Down
20 changes: 10 additions & 10 deletions modules/artic.nf
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ process articMinIONMedaka {
output:
file("${sampleName}*")

tuple sampleName, file("${sampleName}.primertrimmed.rg.sorted.bam"), emit: ptrim
tuple sampleName, file("${sampleName}.sorted.bam"), emit: mapped
tuple sampleName, file("${sampleName}.consensus.fasta"), emit: consensus_fasta
tuple sampleName, file("${sampleName}.pass.vcf.gz"), emit: vcf
tuple val(sampleName), file("${sampleName}.primertrimmed.rg.sorted.bam"), emit: ptrim
tuple val(sampleName), file("${sampleName}.sorted.bam"), emit: mapped
tuple val(sampleName), file("${sampleName}.consensus.fasta"), emit: consensus_fasta
tuple val(sampleName), file("${sampleName}.pass.vcf.gz"), emit: vcf

script:
// Make an identifier from the fastq filename
Expand Down Expand Up @@ -102,10 +102,10 @@ process articMinIONNanopolish {
output:
file("${sampleName}*")

tuple sampleName, file("${sampleName}.primertrimmed.rg.sorted.bam"), emit: ptrim
tuple sampleName, file("${sampleName}.sorted.bam"), emit: mapped
tuple sampleName, file("${sampleName}.consensus.fasta"), emit: consensus_fasta
tuple sampleName, file("${sampleName}.pass.vcf.gz"), emit: vcf
tuple val(sampleName), file("${sampleName}.primertrimmed.rg.sorted.bam"), emit: ptrim
tuple val(sampleName), file("${sampleName}.sorted.bam"), emit: mapped
tuple val(sampleName), file("${sampleName}.consensus.fasta"), emit: consensus_fasta
tuple val(sampleName), file("${sampleName}.pass.vcf.gz"), emit: vcf

script:
// Make an identifier from the fastq filename
Expand Down Expand Up @@ -144,10 +144,10 @@ process articRemoveUnmappedReads {
cpus 1

input:
tuple(sampleName, path(bamfile))
tuple(val(sampleName), path(bamfile))

output:
tuple( sampleName, file("${sampleName}.mapped.sorted.bam"))
tuple(val(sampleName), file("${sampleName}.mapped.sorted.bam"))

script:
"""
Expand Down
Loading