Skip to content

Commit 30548ed

Browse files
committed
add .github/workflow
from @danielecook requires changes to functional tests due to zcat differences on osx
1 parent ada9402 commit 30548ed

3 files changed

Lines changed: 105 additions & 6 deletions

File tree

.github/workflows/build.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# copied from Daniel Cook's Seq collection
2+
name: Build
3+
4+
on:
5+
- push
6+
- pull_request
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-18.04, macos-10.15]
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
# Caching
20+
- name: Cache choosenim
21+
id: cache-choosenim
22+
uses: actions/cache@v1
23+
with:
24+
path: ~/.choosenim
25+
key: ${{ runner.os }}-choosenim-stable
26+
27+
- name: Cache nimble
28+
id: cache-nimble
29+
uses: actions/cache@v1
30+
with:
31+
path: ~/.nimble
32+
key: ${{ runner.os }}-nimble-stable
33+
34+
- name: Cache htslib
35+
id: cache-htslib
36+
uses: actions/cache@v1
37+
with:
38+
path: $HOME/htslib
39+
key: ${{ runner.os }}-htslib-1.10
40+
41+
# Setup nim
42+
- uses: jiro4989/setup-nim-action@v1.0.2
43+
with:
44+
nim-version: 1.0.6
45+
46+
# Install Dependencies
47+
- name: Install dependencies (Linux)
48+
if: runner.os == 'Linux'
49+
run: |
50+
sudo apt-get update
51+
sudo apt-get -qy install bwa make build-essential cmake libncurses-dev ncurses-dev libbz2-dev lzma-dev liblzma-dev \
52+
curl libssl-dev libtool autoconf automake libcurl4-openssl-dev
53+
54+
# Setup htslib
55+
- name: Install htslib (linux)
56+
if: runner.os == 'Linux'
57+
run: |
58+
cd
59+
git clone --recursive https://github.com/samtools/htslib.git
60+
cd htslib && git checkout 1.10 && autoheader && autoconf && ./configure --enable-libcurl
61+
cd
62+
make -j 4 -C htslib
63+
echo "::set-env name=LD_LIBRARY_PATH::${LD_LIBRARY_PATH}:${HOME}/htslib"
64+
ls -lh $HOME/htslib/*.so
65+
66+
- name: Install hstlib (macos)
67+
if: runner.os == 'macOS'
68+
run: |
69+
brew install htslib
70+
71+
# Build and Test
72+
- name: Build test executable
73+
run: nimble build -Y mosdepth.nimble
74+
75+
- name: "Copy binary"
76+
run: chmod +x mosdepth && mkdir bin && cp mosdepth bin/mosdepth_debug_${{ matrix.os }}
77+
78+
- name: "Build and Copy release binary"
79+
run: nim c -d:danger -d:release -o:bin/mosdepth_${{ matrix.os }} mosdepth
80+
81+
- name: Functional Tests
82+
env:
83+
TERM: "xterm"
84+
run: |
85+
bash ./functional-tests.sh
86+
87+
- name: Unit Tests
88+
run: |
89+
nim c -r tests/all.nim
90+
91+
#- run: nimble test -Y
92+
- name: Upload Artifact
93+
if: success()
94+
uses: actions/upload-artifact@v1.0.0
95+
with:
96+
# Artifact name
97+
name: mosdepth_${{ matrix.os }}
98+
path: bin

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ fast BAM/CRAM depth calculation for **WGS**, **exome**, or **targeted sequencing
44

55
![logo](https://user-images.githubusercontent.com/1739/29678184-da1f384c-88ba-11e7-9d98-df4fe3a59924.png "logo")
66

7+
[![Build](https://github.com/brentp/mosdepth/workflows/Build/badge.svg?branch=master)](https://github.com/brentp/mosdepth/actions?query=workflow%3ABuild)
78
[![Build Status](https://travis-ci.com/brentp/mosdepth.svg?branch=master)](https://travis-ci.com/brentp/mosdepth)
89

910
[![citation](https://img.shields.io/badge/cite-open%20access-orange.svg)](https://academic.oup.com/bioinformatics/article/doi/10.1093/bioinformatics/btx699/4583630?guestAccessKey=35b55064-4566-4ab3-a769-32916fa1c6e6)

functional-tests.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ assert_exit_code 1
4747

4848
run unordered_bed $exe --by tests/unordered.bed t tests/ovl.bam
4949
assert_exit_code 0
50-
assert_equal $(zcat t.regions.bed.gz | wc -l) 2
50+
assert_equal $(zcat < t.regions.bed.gz | wc -l) 2
5151

5252
# theres data left in the bam but the region tree is empty...
5353
run missing_bed_chrom $exe --by tests/missing.bed t tests/ovl.bam
@@ -74,13 +74,13 @@ assert_exit_code 0
7474

7575
rm -f t.thresholds.bed.gz*
7676
run threshold_test $exe --by 100 -T 0,1,2,3,4,5 -c MT t tests/ovl.bam
77-
assert_equal "$(zcat t.thresholds.bed.gz | tail -n +2 | head -1)" "MT 0 100 unknown 100 80 0 0 0 0"
78-
assert_equal "0" "$(zcat t.thresholds.bed.gz | tail -n+2 | cut -f 7 | uniq)"
77+
assert_equal "$(zcat < t.thresholds.bed.gz | tail -n +2 | head -1)" "MT 0 100 unknown 100 80 0 0 0 0"
78+
assert_equal "0" "$(zcat < t.thresholds.bed.gz | tail -n+2 | cut -f 7 | uniq)"
7979
assert_exit_code 0
8080

8181
rm -f t.thresholds.bed.gz*
8282
run threshold_test_by $exe --by tests/track.bed -T 0,1,2 -c MT t tests/ovl.bam
83-
assert_equal "$(zcat t.thresholds.bed.gz | tail -n +2)" "MT 2 80 aregion 78 78 0"
83+
assert_equal "$(zcat < t.thresholds.bed.gz | tail -n +2)" "MT 2 80 aregion 78 78 0"
8484
assert_exit_code 0
8585

8686
export MOSDEPTH_Q0=AAA
@@ -97,7 +97,7 @@ assert_equal "$(tail -n 1 t.mosdepth.summary.txt)" "total 16569 80 0.0048283 0 1
9797

9898
run track_header $exe --by tests/track.bed t tests/ovl.bam
9999
assert_exit_code 0
100-
assert_equal "$(zcat t.regions.bed.gz)" "MT 2 80 aregion 1.00"
100+
assert_equal "$(zcat < t.regions.bed.gz)" "MT 2 80 aregion 1.00"
101101

102102
run track_header_by $exe --by tests/bad.bed t tests/ovl.bam
103103
assert_exit_code 1
@@ -136,7 +136,7 @@ assert_equal $(diff -u t_regions.mosdepth.region.dist.txt t_regions.mosdepth.glo
136136
rm -f t_regions.*
137137

138138
run overlappingPairs $exe t tests/overlapping-pairs.bam
139-
assert_equal "$(zcat t.per-base.bed.gz)" "1 0 565173 0
139+
assert_equal "$(zcat < t.per-base.bed.gz)" "1 0 565173 0
140140
1 565173 565253 1
141141
1 565253 249250621 0"
142142
assert_exit_code 0

0 commit comments

Comments
 (0)