11# copied from Daniel Cook's Seq collection
22name : Build
33
4- on :
4+ on :
55 push :
66 branches :
77 - master
@@ -13,116 +13,146 @@ on:
1313
1414jobs :
1515 build :
16-
1716 runs-on : ${{ matrix.os }}
1817 strategy :
1918 fail-fast : false
2019 matrix :
21- os : [ubuntu-20 .04, macos-14]
20+ os : [ubuntu-22 .04, macos-14]
2221 version :
23- - 1.6.18
24- - 2.0.2
25-
22+ - 1.6.18
23+ - 2.0.2
2624
2725 steps :
28- - uses : actions/checkout@v4
29-
30- # Caching
31- - name : Cache choosenim
32- id : cache-choosenim
33- uses : actions/cache@v4
34- with :
35- path : ~/.choosenim
36- key : ${{ runner.os }}-choosenim-stable
37-
38- - name : Cache nimble
39- id : cache-nimble
40- uses : actions/cache@v4
41- with :
42- path : ~/.nimble
43- key : ${{ runner.os }}-nimble-stable
44-
45- - name : Cache htslib
46- id : cache-htslib
47- uses : actions/cache@v4
48- with :
49- path : $HOME/htslib
50- key : ${{ runner.os }}-htslib-1.10
51-
52- # Install Dependencies
53- - name : Install dependencies (Linux)
54- if : runner.os == 'Linux'
55- run : |
56- sudo apt-get update
57- sudo apt-get -qy install bwa make build-essential cmake libncurses-dev ncurses-dev libbz2-dev lzma-dev liblzma-dev \
58- curl libssl-dev libtool autoconf automake libcurl4-openssl-dev zlib1g-dev
59-
60- # Setup htslib
61- - name : Install htslib (linux)
62- if : runner.os == 'Linux'
63- run : |
64- cd
65- git clone -b 1.22.1 --recursive https://github.com/samtools/htslib.git
66- cd htslib && autoheader && autoconf && ./configure --enable-libcurl
67- sudo make -j 4 install
68- sudo ldconfig
69- #echo "::set-env name=LD_LIBRARY_PATH::${LD_LIBRARY_PATH}:${HOME}/htslib"
70- #ls -lh $HOME/htslib/*.so
71-
72- - name : Install hstlib (macos)
73- if : runner.os == 'macOS'
74- run : |
75- brew install htslib
76-
77- - name : Set DYLD_LIBRARY_PATH
78- if : runner.os == 'macOS'
79- run : |
26+ - uses : actions/checkout@v4
27+
28+ # Caching
29+ - name : Cache choosenim
30+ id : cache-choosenim
31+ uses : actions/cache@v4
32+ with :
33+ path : ~/.choosenim
34+ key : ${{ runner.os }}-choosenim-stable
35+
36+ - name : Cache nimble
37+ id : cache-nimble
38+ uses : actions/cache@v4
39+ with :
40+ path : ~/.nimble
41+ key : ${{ runner.os }}-nimble-stable
42+
43+ - name : Cache htslib
44+ id : cache-htslib
45+ uses : actions/cache@v4
46+ with :
47+ path : $HOME/htslib
48+ key : ${{ runner.os }}-htslib-1.10
49+
50+ # Install Dependencies
51+ - name : Install dependencies (Linux)
52+ if : runner.os == 'Linux'
53+ run : |
54+ sudo apt-get update
55+ sudo apt-get -qy install bwa make build-essential cmake libncurses-dev ncurses-dev libbz2-dev lzma-dev liblzma-dev \
56+ curl libssl-dev libtool autoconf automake libcurl4-openssl-dev zlib1g-dev
57+
58+ # Setup htslib
59+ - name : Install htslib (linux)
60+ if : runner.os == 'Linux'
61+ run : |
62+ cd
63+ git clone -b 1.22.1 --recursive https://github.com/samtools/htslib.git
64+ cd htslib && autoheader && autoconf && ./configure --enable-libcurl
65+ sudo make -j 4 install
66+ sudo ldconfig
67+ #echo "::set-env name=LD_LIBRARY_PATH::${LD_LIBRARY_PATH}:${HOME}/htslib"
68+ #ls -lh $HOME/htslib/*.so
69+
70+ - name : Install hstlib (macos)
71+ if : runner.os == 'macOS'
72+ run : |
73+ brew install htslib
74+
75+ - name : Set DYLD_LIBRARY_PATH
76+ if : runner.os == 'macOS'
77+ run : |
8078 echo "DYLD_LIBRARY_PATH=$(brew --prefix htslib)/lib" >> $GITHUB_ENV
81-
82- - name : Install d4
83- run : |
84- #export HTSLIB=system
85- git clone https://github.com/38/d4-format
86- echo 'location' >> ~/.curlrc # https://github.com/38/d4-format/pull/77#issuecomment-2044438359
87- cd d4-format
88- cargo build --release --all-features --package=d4binding
89- sudo cp target/release/libd4binding.* /usr/local/lib
90- sudo cp d4binding/include/d4.h /usr/local/include/
91- sudo ldconfig || true
92-
93-
94- - uses : iffy/install-nim@v5
95- with :
96- version : ${{ matrix.version }}
97-
98- - name : Rust Toolchain
99- uses : dtolnay/rust-toolchain@nightly
100- with :
101- toolchain : stable
102-
103- # Build and Test
104- - name : Build test executable
105- run : nimble build -Y mosdepth.nimble
106-
107- - name : " Copy binary"
108- run : chmod +x mosdepth && mkdir bin && cp mosdepth bin/mosdepth_debug_${{ matrix.os }}
109-
110- - name : " Build and Copy release binary"
111- run : nim c --mm:refc -d:danger -d:release -o:bin/mosdepth_${{ matrix.os }} mosdepth
112-
113- - name : Functional Tests
114- env :
115- TERM : " xterm"
116- run : |
117- bash ./functional-tests.sh
118-
119- - name : Unit Tests
120- run : |
121- nim c -r tests/all.nim
122-
123- - name : Upload Artifact
124- if : success()
125- uses : actions/upload-artifact@v4
126- with :
127- name : mosdepth_${{ matrix.os }}_nim${{ matrix.version }}_executable
128- path : bin/
79+ echo "DYLD_INCLUDE_PATH=$(brew --prefix htslib)/include" >> $GITHUB_ENV
80+
81+ - name : Set DYLD_LIBRARY_PATH (Linux)
82+ if : runner.os == 'Linux'
83+ run : |
84+ echo "DYLD_LIBRARY_PATH=/usr/local/lib" >> $GITHUB_ENV
85+ echo "DYLD_INCLUDE_PATH=/usr/local/include" >> $GITHUB_ENV
86+
87+ - name : Make libhts discoverable for tests
88+ run : |
89+ # Detect htslib location via Homebrew or fallback to $HOME/htslib
90+ HTS_LIB_DIR=""
91+ if command -v brew >/dev/null 2>&1; then
92+ BREW_PREFIX="$(brew --prefix htslib 2>/dev/null || true)"
93+ if [ -n "$BREW_PREFIX" ] && [ -d "$BREW_PREFIX/lib" ]; then
94+ HTS_LIB_DIR="$BREW_PREFIX/lib"
95+ fi
96+ fi
97+ if [ -z "$HTS_LIB_DIR" ] && [ -d "$HOME/htslib" ]; then
98+ HTS_LIB_DIR="$HOME/htslib"
99+ fi
100+ if [ -z "$HTS_LIB_DIR" ]; then
101+ echo "ERROR: libhts not found via Homebrew or at \$HOME/htslib" >&2
102+ exit 1
103+ fi
104+ echo "Using htslib dir: $HTS_LIB_DIR"
105+ if [ "${RUNNER_OS:-}" = "macOS" ]; then
106+ #echo "DYLD_LIBRARY_PATH=$HTS_LIB_DIR:${DYLD_LIBRARY_PATH:-}" >> "$GITHUB_ENV"
107+ echo "DYLD_LIBRARY_PATH=$HTS_LIB_DIR" >> "$GITHUB_ENV"
108+ else
109+ #echo "LD_LIBRARY_PATH=$HTS_LIB_DIR:${LD_LIBRARY_PATH:-}" >> "$GITHUB_ENV"
110+ echo "LD_LIBRARY_PATH=$HTS_LIB_DIR" >> "$GITHUB_ENV"
111+ fi
112+
113+ - name : Install d4
114+ run : |
115+ #export HTSLIB=system
116+ git clone https://github.com/38/d4-format
117+ echo 'location' >> ~/.curlrc # https://github.com/38/d4-format/pull/77#issuecomment-2044438359
118+ cd d4-format
119+ cargo build --release --all-features --package=d4binding
120+ sudo cp target/release/libd4binding.* $DYLD_LIBRARY_PATH
121+ sudo cp d4binding/include/d4.h $DYLD_INCLUDE_PATH
122+ sudo ldconfig || true
123+
124+ - uses : iffy/install-nim@v5
125+ with :
126+ version : ${{ matrix.version }}
127+
128+ - name : Rust Toolchain
129+ uses : dtolnay/rust-toolchain@nightly
130+ with :
131+ toolchain : stable
132+
133+ # Build and Test
134+ - name : Build test executable
135+ run : nimble build -Y mosdepth.nimble
136+
137+ - name : " Copy binary"
138+ run : chmod +x mosdepth && mkdir bin && cp mosdepth bin/mosdepth_debug_${{ matrix.os }}
139+
140+ - name : " Build and Copy release binary"
141+ run : nim c --mm:refc -d:danger -d:release -o:bin/mosdepth_${{ matrix.os }} mosdepth
142+
143+ - name : Functional Tests
144+ env :
145+ TERM : " xterm"
146+ run : |
147+ bash ./functional-tests.sh
148+
149+ - name : Unit Tests
150+ run : |
151+ nim c -r tests/all.nim
152+
153+ - name : Upload Artifact
154+ if : success()
155+ uses : actions/upload-artifact@v4
156+ with :
157+ name : mosdepth_${{ matrix.os }}_nim${{ matrix.version }}_executable
158+ path : bin/
0 commit comments