Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/actions/build-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: 'Build and Test LevioSAM2'
description: 'Build and test LevioSAM2 with CMake'
inputs:
build-type:
description: 'CMake build type'
required: false
default: 'Release'
cache-enabled:
description: 'Enable caching for CMake builds'
required: false
default: 'true'

runs:
using: 'composite'
steps:
- name: Cache CMake build
if: inputs.cache-enabled == 'true'
uses: actions/cache@v3
with:
path: ${{github.workspace}}/build
key: cmake-build-${{ runner.os }}-${{ inputs.build-type }}-${{ hashFiles('**/CMakeLists.txt', '**/src/**') }}
restore-keys: |
cmake-build-${{ runner.os }}-${{ inputs.build-type }}-
cmake-build-${{ runner.os }}-

- name: Configure CMake
shell: bash
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{ inputs.build-type }}

- name: Build
shell: bash
run: |
gcc -v &&
cmake --build ${{github.workspace}}/build --config ${{ inputs.build-type }}

- name: Test
shell: bash
working-directory: ${{github.workspace}}/build
run: ./leviosam2 -h && ctest -C ${{ inputs.build-type }}
43 changes: 43 additions & 0 deletions .github/actions/setup-htslib/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 'Setup htslib'
description: 'Install and configure htslib with caching'
inputs:
version:
description: 'htslib version to install'
required: true
cache-enabled:
description: 'Enable caching for htslib builds'
required: false
default: 'true'

runs:
using: 'composite'
steps:
- name: Cache htslib
if: inputs.cache-enabled == 'true'
uses: actions/cache@v3
with:
path: /tmp/htslib-${{ inputs.version }}
key: htslib-${{ inputs.version }}-${{ runner.os }}-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
htslib-${{ inputs.version }}-${{ runner.os }}-
htslib-${{ inputs.version }}-

- name: Set up SDSL
shell: bash
run: sudo apt-get -y install libsdsl-dev

- name: Set up htslib
shell: bash
run: |
if [ ! -d "/tmp/htslib-${{ inputs.version }}" ]; then
sudo apt-get -y install libbz2-dev liblzma-dev &&
wget https://github.com/samtools/htslib/releases/download/${{ inputs.version }}/htslib-${{ inputs.version }}.tar.bz2 &&
tar -vxjf htslib-${{ inputs.version }}.tar.bz2 &&
cd htslib-${{ inputs.version }} &&
./configure --prefix=/tmp/htslib-${{ inputs.version }} &&
make &&
make install &&
cd ../ &&
rm htslib-${{ inputs.version }}.tar.bz2
fi
sudo cp -r /tmp/htslib-${{ inputs.version }}/* /usr/local/
128 changes: 86 additions & 42 deletions .github/workflows/cmake_htslib.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and ctest
name: Build and ctest (with cache)

on:
push:
Expand All @@ -11,63 +11,107 @@ on:
- 'CMakeLists.txt.in'
- 'testdata/**'
pull_request:
branches:
- 'main'
branches: [ main ]
paths:
- '.github/**'
- 'src/**'
- 'leviosam-test.py'
- 'CMakeLists.txt'
- 'CMakeLists.txt.in'
- 'testdata/**'
workflow_dispatch:
inputs:
test_level:
description: 'Test level to run'
required: true
default: 'smart'
type: choice
options:
- smart
- extended
- full

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
htslib_matrix:
# Setup job to define version lists
setup:
runs-on: ubuntu-latest
outputs:
all_versions: ${{ steps.versions.outputs.all }}
critical_versions: ${{ steps.versions.outputs.critical }}
extended_versions: ${{ steps.versions.outputs.extended }}
steps:
- name: Define version lists
id: versions
run: |
ALL_VERSIONS='["1.12", "1.19.1", "1.20", "1.21", "1.22.1"]'
CRITICAL_VERSIONS='["1.12", "1.22.1"]'
EXTENDED_VERSIONS='["1.19.1", "1.20", "1.21"]'

echo "all=$ALL_VERSIONS" >> $GITHUB_OUTPUT
echo "critical=$CRITICAL_VERSIONS" >> $GITHUB_OUTPUT
echo "extended=$EXTENDED_VERSIONS" >> $GITHUB_OUTPUT

# Critical matrix testing - tests edge cases and representative versions
critical_tests:
needs: setup
if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_level == 'smart' || github.event_name != 'workflow_dispatch'
strategy:
matrix:
version: [1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18]
os: [ubuntu-22.04, ubuntu-latest]

# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
version: ${{ fromJSON(needs.setup.outputs.critical_versions) }} # Oldest and newest supported versions
os: ['ubuntu-latest']
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3

- name: Set up SDSL
run: sudo apt-get -y install libsdsl-dev

- name: Set up htslib
run:
sudo apt-get -y install libbz2-dev liblzma-dev &&
wget https://github.com/samtools/htslib/releases/download/${{ matrix.version }}/htslib-${{ matrix.version }}.tar.bz2 &&
tar -vxjf htslib-${{ matrix.version }}.tar.bz2 &&
cd htslib-${{ matrix.version }} &&
./configure &&
make &&
sudo make install &&
cd ../ &&
rm htslib-${{ matrix.version }}.tar.bz2

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- uses: ./.github/actions/setup-htslib
with:
version: ${{ matrix.version }}
cache-enabled: 'true'
- uses: ./.github/actions/build-test
with:
build-type: ${{ env.BUILD_TYPE }}
cache-enabled: 'true'

- name: Build
# Build your program with the given configuration
run:
gcc -v &&
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# Extended testing for PRs
extended_tests:
needs: setup
if: github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.event.inputs.test_level == 'extended')
strategy:
matrix:
# Representative middle versions
version: ${{ fromJSON(needs.setup.outputs.extended_versions) }}
os: ['ubuntu-22.04']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-htslib
with:
version: ${{ matrix.version }}
cache-enabled: 'true'
- uses: ./.github/actions/build-test
with:
build-type: ${{ env.BUILD_TYPE }}
cache-enabled: 'true'

- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ./leviosam2 -h && ctest -C ${{env.BUILD_TYPE}}
# Full compatibility matrix - only for releases or manual trigger
full_tests:
needs: setup
if: github.ref == 'refs/heads/main' || (github.event_name == 'workflow_dispatch' && github.event.inputs.test_level == 'full')
strategy:
matrix:
# Test all supported versions
version: ${{ fromJSON(needs.setup.outputs.all_versions) }}
os: ['ubuntu-22.04', 'ubuntu-latest']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-htslib
with:
version: ${{ matrix.version }}
cache-enabled: 'true'
- uses: ./.github/actions/build-test
with:
build-type: ${{ env.BUILD_TYPE }}
cache-enabled: 'true'
Loading