Skip to content

Commit

Permalink
add GitHub Actions build, modernizing docker image & WDL
Browse files Browse the repository at this point in the history
  • Loading branch information
mlin committed Jan 7, 2022
1 parent 27bbcd0 commit becb461
Show file tree
Hide file tree
Showing 9 changed files with 439 additions and 351 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: build
on: [push, pull_request]

jobs:

lint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: deps
run: |
sudo apt-get -qq update
sudo apt-get install -y clang-format cppcheck python3-pip
sudo pip3 install --system pre-commit
- name: pre-commit
run: pre-commit run --all-files

build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: build
run: |
docker pull ubuntu:18.04
docker pull ubuntu:20.04
docker build --no-cache -t spvcf .
- name: inspect
run: |
docker run -v $(pwd):/mnt spvcf cp /usr/local/bin/spvcf /mnt
ldd spvcf
sha256sum spvcf
- name: upload exe
uses: actions/upload-artifact@v2
with:
name: spvcf
path: spvcf
- name: WDL test
run: |
pip3 install --upgrade miniwdl
miniwdl run test/test_spvcf.wdl vcf_gz=test/data/small.vcf.gz docker=spvcf:latest --verbose
- name: docker login ghcr.io
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: push image
run: |
REPO="ghcr.io/mlin/spvcf"
TAG="$(git describe --tags --always --dirty)"
docker tag spvcf:latest "${REPO}:${TAG}"
docker push "${REPO}:${TAG}"
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
repos:
- repo: local
hooks:
- id: clang-format
name: clang-format
language: system
files: \.(c|cc|cxx|cpp|h|hpp|hxx)$
exclude: (json1|uint)\.c
verbose: true
entry: clang-format
args: [-i,'-style={IndentWidth: 4, ColumnLimit: 100, BreakStringLiterals: false, ReflowComments: false}']
- id: cppcheck
name: cppcheck
language: system
files: \.(c|cc|cxx|cpp|h|hpp|hxx)$
exclude: json1\.c
verbose: true
entry: cppcheck
args: [-q,--language=c++,--std=c++14]
12 changes: 10 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04
FROM ubuntu:18.04 AS builder
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get -qq update && \
Expand All @@ -14,4 +14,12 @@ RUN make -j $(nproc) && make install
ADD . /src
WORKDIR /src
RUN rm -f CMakeCache.txt && cmake -DCMAKE_BUILD_TYPE=Release /src && make clean && make -j$(nproc)
CMD ctest -V
RUN ctest -V


FROM ubuntu:20.04
RUN apt-get -qq update && \
apt-get -qq install -y --no-install-recommends --no-install-suggests \
tabix bcftools less
COPY --from=builder /src/spvcf /usr/local/bin/spvcf
CMD ["spvcf"]
30 changes: 9 additions & 21 deletions spvcf.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ task spvcf_encode {
input {
File vcf_gz
Boolean multithread = false
String release = "v1.1.0"
String docker = "ghcr.io/mlin/spvcf:v1.2.0"
Int cpu = if multithread then 8 else 4
}

Expand All @@ -15,10 +15,6 @@ task spvcf_encode {
command <<<
set -euxo pipefail

apt-get -qq update && apt-get install -y wget tabix
wget -nv https://github.com/mlin/spVCF/releases/download/~{release}/spvcf
chmod +x spvcf

threads_arg=""
if [ "~{multithread}" == "true" ]; then
threads_arg="--threads 4"
Expand All @@ -27,11 +23,11 @@ task spvcf_encode {
nm=$(basename "~{vcf_gz}" .vcf.gz)
nm="${nm}.spvcf.gz"
mkdir out
bgzip -dc "~{vcf_gz}" | ./spvcf encode $threads_arg | bgzip -@ 4 > "out/${nm}"
bgzip -dc "~{vcf_gz}" | spvcf encode $threads_arg | bgzip -@ 4 > "out/${nm}"
>>>

runtime {
docker: "ubuntu:20.04"
docker: docker
cpu: cpu
memory: "~{cpu} GB"
disks: "local-disk ~{ceil(size(vcf_gz,'GB'))} SSD"
Expand All @@ -45,7 +41,7 @@ task spvcf_encode {
task spvcf_decode {
input {
File spvcf_gz
String release = "v1.1.0"
String docker = "ghcr.io/mlin/spvcf:v1.2.0"
}

parameter_meta {
Expand All @@ -55,18 +51,14 @@ task spvcf_decode {
command <<<
set -euxo pipefail

apt-get -qq update && apt-get install -y wget tabix
wget -nv https://github.com/mlin/spVCF/releases/download/~{release}/spvcf
chmod +x spvcf

nm=$(basename "~{spvcf_gz}" .spvcf.gz)
nm="${nm}.vcf.gz"
mkdir out
bgzip -dc "~{spvcf_gz}" | ./spvcf decode | bgzip -@ 4 > "out/${nm}"
bgzip -dc "~{spvcf_gz}" | spvcf decode | bgzip -@ 4 > "out/${nm}"
>>>

runtime {
docker: "ubuntu:20.04"
docker: docker
cpu: 4
memory: "4 GB"
disks: "local-disk ~{10*ceil(size(spvcf_gz,'GB'))} SSD"
Expand All @@ -81,7 +73,7 @@ task spvcf_squeeze {
input {
File vcf_gz
Boolean multithread = false
String release = "v1.1.0"
String docker = "ghcr.io/mlin/spvcf:v1.2.0"
Int cpu = if multithread then 8 else 4
}

Expand All @@ -92,10 +84,6 @@ task spvcf_squeeze {
command <<<
set -euxo pipefail

apt-get -qq update && apt-get install -y wget tabix
wget -nv https://github.com/mlin/spVCF/releases/download/~{release}/spvcf
chmod +x spvcf

threads_arg=""
if [ "~{multithread}" == "true" ]; then
threads_arg="--threads 4"
Expand All @@ -104,11 +92,11 @@ task spvcf_squeeze {
nm=$(basename "~{vcf_gz}" .vcf.gz)
nm="${nm}.squeeze.vcf.gz"
mkdir out
bgzip -dc "~{vcf_gz}" | ./spvcf squeeze $threads_arg | bgzip -@ 4 > "out/${nm}"
bgzip -dc "~{vcf_gz}" | spvcf squeeze $threads_arg | bgzip -@ 4 > "out/${nm}"
>>>

runtime {
docker: "ubuntu:20.04"
docker: docker
cpu: cpu
memory: "~{cpu} GB"
disks: "local-disk ~{ceil(size(vcf_gz,'GB'))} SSD"
Expand Down
Loading

0 comments on commit becb461

Please sign in to comment.