Update Github actions (#227) #86
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# copied from Daniel Cook's Seq collection | |
name: Build | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, macos-13] | |
version: | |
- 1.6.18 | |
- 2.0.2 | |
steps: | |
- uses: actions/checkout@v4 | |
# Caching | |
- name: Cache choosenim | |
id: cache-choosenim | |
uses: actions/cache@v4 | |
with: | |
path: ~/.choosenim | |
key: ${{ runner.os }}-choosenim-stable | |
- name: Cache nimble | |
id: cache-nimble | |
uses: actions/cache@v4 | |
with: | |
path: ~/.nimble | |
key: ${{ runner.os }}-nimble-stable | |
- name: Cache htslib | |
id: cache-htslib | |
uses: actions/cache@v4 | |
with: | |
path: $HOME/htslib | |
key: ${{ runner.os }}-htslib-1.10 | |
# Install Dependencies | |
- name: Install dependencies (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get -qy install bwa make build-essential cmake libncurses-dev ncurses-dev libbz2-dev lzma-dev liblzma-dev \ | |
curl libssl-dev libtool autoconf automake libcurl4-openssl-dev zlib1g-dev | |
# Setup htslib | |
- name: Install htslib (linux) | |
if: runner.os == 'Linux' | |
run: | | |
cd | |
git clone --recursive https://github.com/samtools/htslib.git | |
cd htslib && git checkout 1.11 && autoheader && autoconf && ./configure --enable-libcurl | |
sudo make -j 4 install | |
sudo ldconfig | |
#echo "::set-env name=LD_LIBRARY_PATH::${LD_LIBRARY_PATH}:${HOME}/htslib" | |
#ls -lh $HOME/htslib/*.so | |
- name: Install hstlib (macos) | |
if: runner.os == 'macOS' | |
run: | | |
brew install htslib | |
- name: Install d4 | |
run: | | |
#export HTSLIB=system | |
git clone https://github.com/38/d4-format | |
echo 'location' >> ~/.curlrc # https://github.com/38/d4-format/pull/77#issuecomment-2044438359 | |
cd d4-format | |
cargo build --release --all-features --package=d4binding | |
sudo cp target/release/libd4binding.* /usr/local/lib | |
sudo cp d4binding/include/d4.h /usr/local/include/ | |
sudo ldconfig || true | |
- uses: iffy/install-nim@v5 | |
with: | |
version: ${{ matrix.version }} | |
- name: Rust Toolchain | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
toolchain: stable | |
# Build and Test | |
- name: Build test executable | |
run: nimble build -Y mosdepth.nimble | |
- name: "Copy binary" | |
run: chmod +x mosdepth && mkdir bin && cp mosdepth bin/mosdepth_debug_${{ matrix.os }} | |
- name: "Build and Copy release binary" | |
run: nim c -d:danger -d:release -o:bin/mosdepth_${{ matrix.os }} mosdepth | |
- name: Functional Tests | |
env: | |
TERM: "xterm" | |
run: | | |
bash ./functional-tests.sh | |
- name: Unit Tests | |
run: | | |
nim c -r tests/all.nim | |
- name: Upload Artifact | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mosdepth_${{ matrix.os }}_executable | |
path: bin/ |