Merge pull request #351 from ksahlin/rl250 #1454
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
name: CI | |
on: [push, pull_request] | |
defaults: | |
run: | |
shell: bash # For -o pipefail | |
jobs: | |
lint: | |
# Run for PRs only if they come from a forked repo (avoids duplicate runs) | |
if: >- | |
github.event_name != 'pull_request' || | |
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check for tab characters | |
run: "! grep -P -R '\\t' src/ tests/*.{cpp,py}" | |
build: | |
if: >- | |
github.event_name != 'pull_request' || | |
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build | |
run: | | |
cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo | |
cd build | |
make -j3 | |
make install | |
- name: Install Linux dependencies | |
if: runner.os == 'Linux' | |
run: sudo apt-get install samtools | |
- name: Install macOS dependencies | |
if: runner.os == 'macOS' | |
run: brew install samtools | |
- name: Run | |
run: tests/run.sh | |
pythonbindings: | |
if: >- | |
github.event_name != 'pull_request' || | |
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install Python dependencies | |
run: pip install pytest | |
- name: Install Python bindings | |
run: pip install . | |
- name: Run tests | |
run: pytest tests | |
compare: | |
if: >- | |
github.event_name != 'pull_request' || | |
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: cat tests/baseline-commit.txt >> $GITHUB_ENV | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ env.baseline_commit }} | |
path: baseline | |
- name: Install Linux dependencies | |
if: runner.os == 'Linux' | |
run: sudo apt-get install samtools python3-pysam picard-tools | |
- name: Install macOS dependencies | |
if: runner.os == 'macOS' | |
run: brew install samtools pysam picard-tools | |
- name: Cache test dataset | |
uses: actions/cache@v3 | |
with: | |
key: test-data-${{ hashFiles('tests/download.sh') }} | |
path: tests/drosophila/ | |
- name: Download test dataset | |
run: tests/download.sh | |
- name: Cache baseline BAM | |
id: cache-baseline-bam | |
uses: actions/cache@v3 | |
with: | |
key: baseline-bam-${{ hashFiles('tests/baseline-commit.txt') }} | |
path: baseline.bam | |
- name: Generate baseline BAM | |
if: ${{ steps.cache-baseline-bam.outputs.cache-hit != 'true' }} | |
run: | | |
( cd baseline && cmake -B build ) | |
make -j3 -C baseline/build | |
baseline/build/strobealign tests/drosophila/ref.fasta tests/drosophila/reads.1.fastq.gz tests/drosophila/reads.2.fastq.gz | samtools view -o baseline.bam | |
- name: Build HEAD version | |
run: | | |
cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo | |
make -j3 -C build | |
- name: Generate HEAD BAM | |
run: build/strobealign tests/drosophila/ref.fasta tests/drosophila/reads.1.fastq.gz tests/drosophila/reads.2.fastq.gz | samtools view -o head.bam | |
- name: Compare | |
run: python3 tests/samdiff.py baseline.bam head.bam | |
- name: Validate with Picard | |
run: | | |
PicardCommandLine ValidateSamFile IGNORE=RECORD_MISSING_READ_GROUP IGNORE=MISSING_READ_GROUP I=head.bam |